Frame(s)work

Frame(s)workFrame(s)workFrame(s)work

Frame(s)work

Frame(s)workFrame(s)workFrame(s)work
  • Home
  • Origin
  • Directory
  • Mitch's Blog
  • Contact Me
  • More
    • Home
    • Origin
    • Directory
    • Mitch's Blog
    • Contact Me

  • Home
  • Origin
  • Directory
  • Mitch's Blog
  • Contact Me

Method Routing

Introduction

I designed the concept of method routing from my constant frustration of creating new pathways to functionality hubs (like Web APIs and Databases). When I was programming each call to the Web API I would build a 

  1. create new controller-> 
  2. create new web method -> 
  3. create new business layer class>method -> 
  4. create new data layer class>method -> 
  5. create new stored procedure -> 
  6. create new concrete class model ->
  7. create new object relational mapping>collection  of classes -> 
  8. casting view models to json. 


After pursuing a solution for years, I developed a solution for the typical Microsoft Stack of technologies.  Here is the stack:


1. Call to a Web API with 1 Controller/ 1 Method (ReST) with QueryString (Stringified JSON)

2. Read Method Information and Parameter Values from QueryString casted to JSON

3. Execute Method, Return JSON from Database


In my estimations, using the method routing design will reduce the time for developing new features and functionality by over 50%. This design will also significantly reduce the requirements for unit testing (code coverage is impacted negligibly, due to the reusability of the functional methods).


Front-End Technology Agnostic


Since the driving force for the Method Routing is the json object as a query string, any web page tech can call a web method empowered with Method Routing.

Design of Simplified Round Trip for data processing

Explanation of Design

At the heart of this design is the simplification of the layering between data and request <-> display. Much of modern system design is abstraction and services: event driven, distributed.  However this has constricted the velocity of feature development by requiring the mapping of data created from external sources. 


Accessibility does not mean assessible. On a project that I work on, there was a requirement to create JSON objects for submission to Salesforce. The data sources were a number of 'micro-services' that produced generic data models. This placed the burden on me to not only request the data from each of the seperate data sources and then retrieve the applicable data fields required for populating the Salesforce JSON schema object.


  • In cloud development the primary design pattern is 'microservices'. 
  • Microservices are a powerful approach to 'services' architecture. 
  • Services are based on domains of functionality and processing.  


BUT, web applications are not extensions of microservices they are Client/Server applications that provide user interfaces to interact with data and system processing.


As a Client<->Server Application, the front-end needs to access data stored for consumption. A mistake that many make in  modern development is to carry forward the process of manufacturing data 'On-Demand'.  Much time and coordination was mandated, within the monolith structure, for the optimization of data extraction and transformation, while the user waits. 


I am reminded of advancements within the 'Fast Food' industry, in the 50's and 60's. Although, not perfect, the solutions for providing good food, fast, was to do one of the following:


  1. Prepare a wide menu of items staged under the heat lamps for immediate consumption.
  2. Reduce the menu to very few items and be in a constant state of preparing the primary ingredients for assemble upon ordering. 


In keeping with this analogy, data can be manufactured 


EXAMPLE:


Web Controller:

Single Controller Providing ReSTful Methods 

  1. Post
  2. Put
  3. Get
  4. Delete

Each Method will accept a JSON Object based on a JSON Schema Interface

  1. Action → equivalent method calling the business coding. Using System. Reflection- Invoke Method
  2. Parameters → array of variable names and data values

    public class MethodRouting

    {

        public dynamic ProcessRequest(string JsonPayload)

        {

            JObject jObject = JObject.Parse(JsonPayload);

            string methodName = jObject["methodName"].ToString();

            DataProcessing dataProcessing = new DataProcessing();

            MethodInfo methodInfo = dataProcessing.GetType().GetMethod(methodName);

            var parameterLength = methodInfo.GetParameters().Count();

            var methodParameters = new object[parameterLength];

            var parametersRequest = jObject["parameters"];

            for (int i = 0; i < parameterLength; i++)

            {

                methodParameters.SetValue(parametersRequest[i], i);

            }

            methodInfo.Invoke(dataProcessing, (parameterLength == 0) ? null : methodParameters);

        }

    }

Bruce Lee Quote

 “To reach the masses, some sort of big organization (whether) domestic and foreign branch affiliation, is not necessary. To reach the growing number of students, some sort of pre-conformed members will be conditioned according to the prescribed system. Many will probably end up as a prisoner of a systematized drill."

  • Origin
  • Business Solutions
  • Technology Landscapes
  • Architecture
  • Client-Server Websites
  • Method Routing
  • Tools and Techniques
  • Code Projection
  • Data EcoSystem
  • Application Migration
  • User Experience
  • Getting Started
  • Mitch's Blog
  • Contact Me

Copyright © 2023 Fundamental Technology - All Rights Reserved.

Powered by GoDaddy

Welcome to Frame(s)work

A Place to Explore Programming that is Efficient and Elegant. Frame(s)work is designed for those looking to interact directly with HTML5.

Learn more

This website uses cookies.

We use cookies to analyze website traffic and optimize your website experience. By accepting our use of cookies, your data will be aggregated with all other user data.

Accept