What design patterns are used in an ecommerce web apps? - oop

What design patterns are commonly used or used together in developing e-commerce with microservices or multi-tier layer architecture? Let's say we will write the code using object-oriented language such as Java or .NET 5 just for an example and we develop the client app using a JavaScript framework.
Would the design patterns suggestion change if I choose to implement a microservices architecture?

There is a pattern called "Pattern: Microservice Architecture:"
Define an architecture that structures the application as a set of
loosely coupled, collaborating services. This approach corresponds to
the Y-axis of the Scale Cube. Each service is:
Highly maintainable and testable - enables rapid and frequent
development and deployment
Loosely coupled with other services -
enables a team to work independently the majority of time on their
service(s) without being impacted by changes to other services and
without affecting other services
Independently deployable - enables a
team to deploy their service without having to coordinate with other
teams
Capable of being developed by a small team - essential for high
productivity by avoiding the high communication head of large teams
Services communicate using either synchronous protocols such as
HTTP/REST or asynchronous protocols such as AMQP. Services can be
developed and deployed independently of one another. Each service has
its own database in order to be decoupled from other services. Data
consistency between services is maintained using the Saga pattern
To learn more about the nature of a service, please read this article.
And e-commerce application is considered as an example to apply pattern: Microservice Architecture.
So it is possible to create multiple services divided by entities or business domains:
customers
inventory
shipping
Then it is necessary provide the way of communication among services. It can be event streaming platform Kafka.

Related

Project Structure

What is preferrable project internal structure for designing API based task.
1) Application will create API which will be acting as consumer and provider both 2) As a consumer it will integrate with multiple systems 3) Integration Systems can be SOAP based or SOA based
To answer the question which structure should the project have, you should define first:
if project is oriented on business requirements and they are being changed quite often, then it's SOA based architecture. The main difference between Service-Oriented (SOA) and Service-Based Architecture is that SOA had a "message-bus" layer, which translates business requirements to existing architecture. Service-Oriented architecture has similar topology to Microservice architecture, but services are more task/project oriented, not as small as in microservice;
if project has clear vision how API should look like and can define as a part of a tech specification, then first create an API, and then build other systems around;
second option you mentioned (As a consumer it will integrate with multiple systems) depends on project's needs, hard to say without knowing tech specifications.

Facade Pattern for distributed application?

We are in the process defining the architecture of a fairly large customer facing financial application where performance and scalability are the key requirements.
We proposed n-tier architecture which primary consists of Web Tier, Application Tier (Mid-Tier) and Data Tier WCF being the communication mechanism between web tier and app tier. Some of the stakeholders are concerned that WCF would cause performance overhead and want configurable architectural provision to support In-process calls and WCF. Their vision is to start with in-process calls and change it to WCF based communication if horizontal scalability is a concern.
We are considering the following approaches:
One architectural approach would be to introduce a client facade
layer which can act as a facade between web and application layers.
The façade layer would simply hide the complexity of the remote calls
and allows for easy swapping of the façade for another one that might
possibly implement a different remote call technology (ie. WCF)
Another approach is to simply use WCF and use different bindings for
different scenarios. For example, use IPC binding (Namedpipes) when
web and application components are deployed in the same machine or
use TCP binding when the application components are deployed in a
different service (Both the ends use .NET so interoperability is not
a concern )
We are looking for the right architectural approach for the above mentioned scenario.
Kindly advice.

Play! framework instance as view/controller layer and others for REST services layer

I'm about to create a new imposing web project using Play! framework (similar to Rails philosophy).
After reading some important parts of this famous book: Service-Oriented Design with Ruby and Rails for learning some tips on good design, I wish to avoid monolithic application by creating separated Play! applications as services layers (through REST).
Thus, I imagine the first Play! application would be responsible for routing clients' requests to remote services layers contained each one in other Play! applications.
I wonder both things with this solution:
Where to put Entities/Values Objects (data model)? May there be some kind of data-model.jar shared between view application and services applications? (Optional for view since DTO's or JSON object would be sufficient)
View application would end up with no model layer, since view application acts as a simple proxy for services applications. Doesn't it promote confusion or potential bad understanding for future developers (an application with view/controller but without model part)? Likewise, services applications wouldn't contain view layer...
In short, each of these applications using Play! would seem to follow this bad principle: YAGNI

"Services encapsulate business functionality" vs "Services can be composed into business processes"

Recently, I was reading 2 books and I came across with the following statements
Learning WCF from Michele Leroux:
Services encapsulate business functionality
Service orientented architecture in real world:
Services can be assembled (or ―composed‖) into business processes
­
Loosely-coupled
systems result in loosely-coupled business processes, [...]. Services and their
associated interfaces must remain stable, enabling them to be re-configured or re-aggregated to
meet the ever-changing needs of busines
Reading SOA in real world, I understood that I was suppose to make my independent (initially useless)services abstracted from a business context, and then compose and orchestrate then to do something useful, creating the business layer and meting the business needs.
Then, reading Learning WCF made me to think that I should make my business layer to met a specific need and then expose it as a service(of course in a non platform specific format)
Currently, I'm making my business layer and then exposing some of it's public methods via well defined interfaces, but I liked the idea of making more independent services and compose then to make the business layer.
I would like to hear from experienced SOA developers, what of those approaches would be ideal to get the benefits of SOA and why?
I'm confuse about this topic. Examples and open source projects will be of great help.
To me the idea of a service is to encapsulate business related functionality. However, this is not the same as a business process. Often separate pieces of business functionality will need to be composed into larger units to represent entire business processes. For example, making a sale will require taking payment, shipping product, calculating sales commission. All of these are discrete pieces of business functionality that could be modelled as services but they would have to be composed to represent the entire business process
However, business processes tend to be relatively long running (more than the network timeout of a single request) so somehow the state of the business process needs to be maintained - this is one of the things Workflow and Biztalk can bring to the party.
In Thomas Erl's books, he categorises Services into 'Entity Services', which are fine-grained, business process agnostic services that relate to one Entity and are often used in compositions/orchestrations, and 'Task Services' which are course-grained, usually involve more than one entity, contain more business logic, have some knowledge of the business process and are not candidates for reuse/composition.
So a business process can either be implemented in one big Task Service, or it can be implemented by combining several Entity Services into a composition.
'Task Services' sound like Michelle Leroux's vision of a service, whereas SOA in Real World has more of an 'Entity Service' vision.
In Erl's vision of SOA, both types of services can live side by side. Entity Services are the prefered goal - these can be reused and composed more easily and increase business agility. But in some circumstances this might not be appropriate, and task services would be a better solution - peformance demands and encapsulating legacy code are two examples.

What is a good WCF SOA strategy?

I've worked on enterprise level SOA applications that have a whole lot of very simple one-off WCF services.
The code for some of these services could easily be placed into one central service and accessed through different method calls.
What are the advantages or disadvantages of having many of these one-off services?
As you have recognised there is a tension between decomposing services into small, reusable, separately deployed building blocks and manageability of large numbers of services
Separate services
For: Flexibility of deployment, reuse and composition
Against: Manageability, overhead of invocation if the services needs to talk to eachother
One big service
For: Simplified deployment and management, in-memory invocation between "services"
Against: Reuse reuses entire service, added contention for unrelated functionality, potential scalability problems
As with most of these questions the best solutions comes somewhere in the middle - grouping similar services into single deployments while retaining the flexibility to scale out some groups of services with heavier usage