Sequencing Programs and Network Effects: JavaScript (ES12)

Joe Alongi
Geek Culture
Published in
7 min readSep 25, 2021

--

Sessions are essential to access, as passwords are essential to privacy. In common day, even later, connecting to a storage source such as a database, requires the provider to enable multiple paths to the source.

If one user is finding the database then one user requires one connection, one connection requires one path. The math is simple if only one person is ever connecting, though how frequent are we running personal databases.

1:1 sequences are often found in premise based programs that only require the local variables to fulfill functionality.

Arrays of connections and sequenced connections allow a network of tools for each of the many forecasted people to connect to a database, application, hosting, external network, internal network, service and so on.

Machine programs are often built with this concept of serving many, as many a software, and application does the same. In fact this is the concept of scale, which is essentially the calculation of uses or instantiation of the base offering.

Contextual Sequencing with Feed Patterns

If you are not frequently creating programs at scale, learning the methodology, or have a small core user base, these performance focused metrics may seem rigid and costly to support.

Scale is a burden of the creator, but a pathway to access, progress, achievement, and hopefully evolution — because the more people that can access the more people that are likely to inform you choices — that is from a data or contribution perspective.

Feed Forward

The idea behind this methodology as a networking pattern is to take one instance of a program, create a unique iteration for each connection, and provide the same experience for every connection.

A similar concept is constructed for ML (Machine Learning), often utilized as a filtering method for DL (Deep Learning).

Pooling, Instances, and Sessions with Scaled Services

When connecting across a network to any series of programs that may be a software, application interfaces, data feed, and even API — there is often a discrepancy in the distance of the user from the machine that is computing the outcome.

Pooling

An essential connection protocol that allows the systematic exchange of interactions to occur and be distrusted at a pace that will enable a consistent and stable connection between the sender and receiver.

Pooling takes the intended source material and either buffers or streams those contents into a sequence that is more fitting for the network. Depending on the receiving entity the server that conducts the connection is enabled to provide a conducive connection between the sending platform and the receiving platform.

If the data is transferred too quickly, the connection may break, if it is gathered too slowly, the experience may suffer. Chunking parts of data is a modern way to exchange whole parts of larger outcomes into smaller parts for a transfer over a network.

Instances

Viable expressions of the core program in a unique version for each connection that spatially provides concurrent operations to the user or users of that instance.

Instantiating programs creates a secondary version of the core program to build up based on the users actions. It would be infrequent for a group of people to behave exactly the same, require exactly the same, and find exactly the same general outcome.

The procedural exchange occurred through the second iteration of the program, that may at any time, be many is the evolution of usage that meets the scale of use, to support a mass audience over a general principle.

Sessions

In accordance with both pooling and instances is the idea of creating a method to capture or specify the unique iteration and limit the connection, usage, and services to that exchange.

Sessions distribute services, whether hardware as RAM, bandwidth as quality, and even security as access. They are the method for which, in which the sender knows for how long and with what to complete the objective of the program or programs being accessed. Whether it is simply a measurement of time or even the maximum usage and security role of the receiver accessing the information.

Simplifying Connections & Modular Performance

The predisposition of many programs at scale, in software and applications, is to provide the minimum required resources to complete the task before reaching a maxima that is diminishing returns, resulting in decremented Quality of Service (QoS).

That is a lot to understand, but as people we want the best possible outcome and the most efficient pace so therefore we build programs to achieve those tasks quite similarly.

Sequencing is a referential term to any languages event loop, the methods as a process which intake and output responses to requests, whether sequentially or synchronously. Programs are sequenced to limit the rate of occurrence, steps of procedure, and resource costs allocated to accommodate the required action. At scale this becomes a balancing act in which a server often mitigates these costs in delivery by devising new resources and balancing the quality of those resources.

Sessions, security, pooling, instances, protocols, servers, and networking connections are often created to inherently have these features to continue the use of a program by many people at the same time, concurrently. Based often on the first connection point and then the requirement of time to fulfill the task is a procedure is the evaluation that becomes that programs base session value.

Services that are accessible through application interfaces often set these base procedures, with room for user decisions and even error. Once the session has ended, the accessing program is required to reestablish the connection. The burden of the resource, when not computing is then reduced, along with it’s usage of the overall system it is accessing to continuously provide those services.

Sessions as a Service through Procured Persistence

When devising a protocol that provides a session it is important to mention the above networking theories and use-cases to understand what discrepancies contributed to this logic.

Establishing sessions and smoothing the creation of sessions to reduce cost and improve quality of service for users is an upmost concern for continued usage of the platform. A longer more verbose session often requires more resources which in turn costs the connected service more monetary distribution to support the user.

If you are the developer of the application, you would want to reduce your cost to meet your forecasted billable usage cost. If you are the provider of the service, even more, you would want to limit the unused access to the service that requires more enabled performant systems to occur.

JavaScript Sessions

Elevating the aforementioned can be established as a layer between the services, and the use protocol to enable security, measurement, and efficiency of the requested services in accordance with an established policy.

For example, a program can limit and refresh a connection based on a time derived value in which expires or re-enables access as that time occurs.

JavaScript provides a very simple scripting ability to layer on top of services for extrapolating current time, evaluating the required time, and checking those two variables against each other.

Step One (1): Is there (not) a Session?

In the example a rolling session occurs when the page is loaded, the existence of a session is checked from the storage in the browser.

<body onload="checkSession()"></body>

Step Two (2): If there is not a Session, create one

Proceeding on, if there is no session stored in the browser, a function to create a session is then ran.

if(!javascript_session){

// Set New Session
setSession();
}

The session is based on the current time, in milliseconds, with an addition of milliseconds based on the set time for the session Five (5) Minutes.

Step Three (3): If there is a Session, tell me how much time left

This is an informational procedure that could be catalyzed or redacted but occurs based on an increment of the total required session time, and continuously checks if there is a session.

let checkSecondsLeft = (javascript_session - new Date().getTime());

Occurrences could shift this session so knowing if there is a session and the time remaining could inform other procedures or even the user to extend the session.

Step Four (4): If the Session, is expired, create a new one

After the session has been check against the current time, the session is then checked if it still has time available.

if (checkSecondsLeft > 0){} else {  // Set New Session
setSession();
}

If there is no time left in the session, the session then regenerates at the last tick of the increment previously mentioned to reestablish the session.

Opinionated Defaults

There are some defaults about the time, recurrence, and concurrency of the session checks that are baked into this example. Programmatically this may not be specifically efficient, but serves to cater to quality and continuance, as a session for a service, less a session for security.

Sessions can provide a great example of how time over cost can be improved and utilized to be efficient in programming and still reduce the incurred cost of services.

All of the aforementioned details about how these sessions can be derived should be considered before objurgating the session itself, as limiting the services could bottleneck the solution or timing out the interval could refuse the user too quickly.

Thanks for Reading, Keep Instructing!

Looking for more Application Development advice? Follow along on Twitter, GitHub, and LinkedIn. Visit online for the latest updates, news, and information at heyitsjoealongi.com.

--

--