php – Is there a canonical definition of SPA – or is SPA a broadly agreed-on architecture with fuzzy edges?

Question:

Is there a canonical definition of SPA which would exclude the software architecture model described below?


I’m working on an app with a new web-architecture model (new to me, at any rate) which has features which differentiate it from a Single Page Application (SPA) as the term is conventionally understood.

Since the model uses server-side and client-side variables which always automatically mirror each other, I would like, at least provisionally, to give the model a label something like Reflective SPA (or veSPA for short) but I’m concerned that due to its reliance on server-side processes, it may not qualify as an SPA at all and, as such, this name would be misleading and / or nonsensical.

Towards the end of the Wikipedia entry on Single Page Applications there is a statement:

A SPA is fully loaded in the initial page load and then page regions
are replaced or updated with new page fragments loaded from the server
on demand. To avoid excessive downloading of unused features, a SPA
will often progressively download more features as they become
required, either small fragments of the page, or complete screen
modules.

I’d strongly subscribe to this as a conventional definition of an SPA. This is absolutely what I think of when I read the acronym SPA.


What differentiates veSPA is that instead of:

page regions are replaced or updated with new page fragments loaded from the server on demand

veSPA repeatedly responds to user interactions by updating the queryString, either via:

1. Updating the URL (including the queryString), using:

  • window.history.pushState({}, document.title, 'https://example.com/' + queryString); (Javascript)

2. Reloading the URL (using a new queryString), using:

  • window.location.href = 'https://example.com/?' + queryString; (Javascript)

3. Redirecting the URL Request (using a new queryString) at server level, using:

  • header('Location: https://example.com/'.$Query_String); (PHP)

When the page is actually reloaded, various custom-data attributes in the root HTML element are populated from the queryString, using the super global variable $_GET in PHP.

When the URL queryString is updated, the same custom-data attributes in the root HTML element are populated from the queryString, using new URLSearchParams(window.location.search) in Javascript.

Either way – and this is the most important culmination of everything described above – the app-view is then rendered via CSS from the values in the custom-data attributes in the root HTML element.


Question:

Does this use of page-reloads and PHP (described above) mean this model is too differentiated from SPA (as conventionally understood) to have the term SPA meaningfully applied to it (or to use SPA in its name)?

Is there a canonical definition of SPA which would exclude the model described above?

API-based Architecture Pattern – Software Engineering Stack Exchange

After studying some basics about n-layer architecture, I face to a new proyect where my database is an ERP and the way to connect with it is via API calls. I can perform queries to obtain data but the only way to insert and update is using the API.

I have to write two applications, a website and a web service. Obviously I cannot just public my ERP API as webservice because a I need to make some restrictions. I’d like to share most of the code, so I have thought writting two presentation layers, using MVC pattern with their own model each one. Functionality might be different, but having shared procedures.

Since bussines logic is mainly done at ERP level, but I still need to implement very simple restrictions, and that persistance layer is based on an API and not directly to a database, what kind of architecture should I use?

Having a domain layer with that very simple business logic seems to overkill for me, and I dont know how if we should implement a data access layer since I don’t really have a typical database. All my thoughts are about creating just one layer for this business and data access, but I’d like to know if this is a common pattern I could read or study about.

P.S: I work in a very little team. I still want to separate concepts and make a clean use of layers, but I don’t want too much extra work for such a little team. We all will probably work at every layer.

procedural generation – How can we generate 3D architecture in a racing game’s background procedurally with respect/similar to the real world?

AFAIK they achieve this by

Parameterized Procedural Placement

They create a workflow where you create a handful assets in this case building floors and they procedurally tweak the parameters such as Floor count,size,tint and custom props such as air conditioning outside of the buildings.

I once a saw a video about ubisoft creating a procedural assasins creed city.They premade a bunch of houses and spread them randomly.

You should desing a workflow where you control how your building floors are stacked on each other and how each floor has its own specific unique props.

This is what i would do

  • I would decide what a building floor means to me.These would be my parameters: IsGroundFloor?, width and height of the floor, how many windows, a balcony?, general tint color of the floor material and unique set of models.(Such as vegatation, flowers, air conditioning or a satallite dish perhaps?).
  • I would decide how many floors should a building has.Define the minimum and the maximum
  • I would decide what will be the floor independent objects such as fire escape ladder which starts from ground to the top of the building, some garden? or fences?

with these parameters one can create wide range of different buildings considering you feed your procedural workflow with enough assets

models – How can we generate 3D architecture in the background procedurally with respect/similar to the real world?

AFAIK they achieve this by

Parameterized Procedural Placement

They create a workflow where you create a handful assets in this case building floors and they procedurally tweak the parameters such as Floor count,size,tint and custom props such as air conditioning outside of the buildings.

I once a saw a video about ubisoft creating a procedural assasins creed city.They premade a bunch of houses and spread them randomly.

You should desing a workflow where you control how your building floors are stacked on each other and how each floor has its own specific unique props.

This is what i would do

  • I would decide what a building floor means to me.These would be my parameters: IsGroundFloor?, width and height of the floor, how many windows, a balcony?, general tint color of the floor material and unique set of models.(Such as vegatation, flowers, air conditioning or a satallite dish perhaps?).
  • I would decide how many floors should a building has.Define the minimum and the maximum
  • I would decide what will be the floor independent objects such as fire escape ladder which starts from ground to the top of the building, some garden? or fences?

with these parameters one can create wide range of different buildings considering you feed your procedural workflow with enough assets

architecture – How to deal with data that needs to be accessed by all objects?

I have a World class that currently only has one instance. It has data and methods that need to be accessed by all other game objects. Right now I’m hardcoding a reference to the global variable world in all of my methods, and this doesn’t seem to be the right approach.

Another idea I tried was a dependency-injection-esque approach, where each object stores its own reference to the world object, but this clutters memory with unnecessary references, so I don’t think this is the right approach either.

Another approach I tried was passing world as an argument directly into the method call, but this led to repetitive code as I was constantly passing world into any function that needed it.

A bit of research hasn’t worked for me because it’s hard to summarise my problem into a few words that can return Google search results. It seems this isn’t a problem in the majority of applications, so I’m wondering if this is mainly a gamedev situation.

What is the best way to solve this problem?

design – Doing the same tasks from multiple places when using Clean Architecture and CQS?

I’m working on some tooling that will help speed up the process of setting up a new computer for new developers. I want the user to be able to execute many tasks either as one task or grouped together with other tasks. For example, setting up the server might consist of the tasks A, B, C and D. Let’s say that A is installing IIS as an optional windows feature and D is adding our Web Applications to an IIS site. I want the user to be able to perform D individually as well, we might add or remove an application and then we don’t want to force the user to go through A-C just to do D.

The tool is built using Clean Architecture. If we invoke the tool with

> my-tool D

the presentation layer will simply invoke DCommandHandler by passing DCommand to a mediator. DCommandHandler contains the code to perform task D.

Now to my problem, how do I orchestrate invoking task A-D?

> my-tool setup-everything

My first thought where to let CompositeCommandHandler do the work:

Handle()
{
    _mediator.Send(new ACommand);
    _mediator.Send(new BCommand);
    _mediator.Send(new CCommand);
    _mediator.Send(new DCommand);
}

This feels ok-ish for this use case but generally I don’t like the idea of invoking other handlers from a handler. I could move the code from CompositeCommandHandler to the presentation layer but the tasks must be invoked in order so I really think Application should own that logic.

I could move the logic for performing Task X into a separate class that can be invoked from multiple places:

ACommandHandler:
Handle()
{
    _taskA.Execute();
}

CompositeCommandHandler:
Handle()
{
    _taskA.Execute();
    _taskB.Execute();
    _taskC.Execute();
    _taskD.Execute();
}

However now all handlers will just invoke Task X and that starts to smell like lasagna code… I need task A-D to be invoked in the correct order so I can’t use events/notifications either. I’m not sure what would be the best way to solve this problem, any ideas?

computer architecture – Throughput increase/decrease by how much percent

I am learning computer architecture and organization. I am stuck in the following question. Can someone please help me?

The stage delays in a 5-stage pipeline are 300, 200, 100, 400 and 350 picoseconds. The second and third stages are merged into a single stage with delay 350 picoseconds. The throughput increase/decrease by ………… (percent).

This is what I tried:

Throughput of 1st case T1: 1/max delay =1/200
Throughput of 2nd case T2: 1/max delay= 1/350
%age increase/decrease in throughput: (T2-T1)/T1 * 100
= (1/350 – 1/200)/(1/200)*100
= -42.8
So the throughput decreases by 42.8%.
But the correct answer is given to be 0. I don’t understand why?

architecture – Is an ECS viable in garbage collected languages?

I’ve done some research on Entity Component System architectures. Right now I have a convoluted OOP implementation which I’m planning on rewriting, so I was considering switching to a different architecture. Since everything was already composed using components, the switch from OOP to ECS shouldn’t be too difficult. However, I’m doing my project in a language with GC, and a lot of the benefits of ECS are to do with memory management, processor cache, etc. so I was wondering whether there is any real performance advantage of ECS over OOP in a garbage collected language?

Also, I’m not too familiar with manual memory management and I haven’t really used C/C++ for anything big.

computer architecture – Difference between Multiprocessor and uniprocessor in terms of Run time system

In the book “Advanced Computer Architecture and parallel processing “, there is a question in the exercises of chapter 1 that needs the reader to compare between multiprocessor systems and uniprocessor systems in terms of many factors including run time system. I know how to compare between these two systems in terms of the other factors (ease of programming, need for synchronization, and performance evaluation) but I cant to compare between them in terms of run time system as I don’t know what is the exact meaning or run-time system?
Edit: The question is :

Compare uniprocessor systems with multiprocessor systems for the following
aspects:
(a) ease of programming;
(b) the need for synchronization;
(c) performance evaluation; and
(d) run time system.

architecture – Plugin system with AssemblyLoadContext and unloading

I’m building a game engine from scratch and trying to implement a basic plugin system within my engine.

Using AssemblyLoadContext to load the target dll dynamicly and unloading it with AssemblyLoadContext.Unload()

However it seems even if there is a one class instance created from this assembly hanging somewhere in the whole app domain AssemblyLoadContext.Unload() does not unload it until the all the instances are dereferenced.

This is where my problem begins.

There are infinite number of scenarios whether a class which belongs to the plugin can be instantiated and used across the whole appdomain right?.

So how do i keep track of the plugin instances across the whole AppDomain.

(How unity unloads the user scripts and cleans every last one of the instances i wonder)

My engine system is nearly identical to both unreal and unity.

I have entities and the components just like unity.

My current unload workflow is like this.

  1. Loop through every component via reflection and check if one the assembly classes instantiated then set that field/property null
  2. Loop through every assembly and check for static fields/properties which might contain some instance
  3. Now unload it.

However the approach above seems well idiotic and sluggish not to mention it should be slow as hell.

It seems i have a desing problem within my plugin system and i fear if i overcomplicated things.

Are there better way to cleanup assembly instances or am i missing something? (Please tell me im missing something obvious)