Software Architecture
Architecture And Design Patterns
Architecture And Design Patterns
3 Day(s)
🎯 LEARNING OBJECTIVES
Understand the difference between architectural patterns and design patterns.
Identify common patterns, including layered architecture, microservices, Factory, Strategy, and Observer.
Select suitable patterns based on system requirements, constraints, and quality attributes.
Evaluate the benefits, limitations, and trade-offs of applying patterns in real-world systems
🧠 PREREQUISITES
Basic understanding of software architecture and object-oriented programming.
Familiarity with classes, interfaces, dependencies, and common software design principles.
📖 Topics / Lesson
Architecture & Design Patterns
Pattern vs anti-pattern approaches
The pattern is a solution for a specific problwm within a context.
We have a lot of patterns/standards/approaches regarding:
1.Layered architecture: to for the connectivity between solution building blocks, like tiers, how many tiers should we have, and why.
2.Components types: like com objects, portable components, SOA, Micro services architecture
3. Communication between components ( queueing, callbacks or event driven)
4.Solution design patterns to resolve specific problems
5. Database design, relational and non relational
With all of the above mentioned patterns, supported by researches, and scientific reviews, we have anti-patterns approach that stick to find the solution his way.
This is a great debate, but we should respect considering the following conditions:
1. You should be aware of what you are againest
2. Understand/appreciate That patterns is the contribution of researchers to support the community
3. Proof your new provided solution to yourself and then to the market.
4. It's not enough to make things work, you should go deeper after details in order to meet/exceed pattern oriented approach.
Benefits Of EDA?
Reduce coupling, because it does not know the consumer of the solution
When you do notify others by your significant changes
When you need to listen for external components changes
Why Components do not ask itself?
-Because it’s my responsibility to notify others by internal changes
-Decrease coupling
-Simplify solution
-Real time notification, not batch execution
How Can We Organize Objects/Components
We can define the layered architecture as the arrangement of solution building blocks in levels, and each level is only responsible about receiving data from the previous layer, and send data to the next one.
But: Challenging point was raised, about the optimum number of layers.
It's according to the complexity of the solution.
What is Event?
Significant change in state, for example: Car is marked for Sold, if we sold it the status will be Sold and not available.
How EDA works?
Component interact with others throw invoking events.
Other system components can register to the component as interest of receiving events, that what we call "implicitly".
It provides reuse components, since it decreases the coupling between components.
EDA Elements?
•You have the following elements in the model:
•Publisher
•Event bus
•Event
•Subscriber
•Event response
How Components communicate?
Event-driven architecture, is one of the best architecture models, that focus on decoupling the relation between components.
We have 2 approaches to notify the object changes:
First: periodically check the change of the object, which consume resources, and increase coupling that decrease maintainability and decrease SOLID compatibility.
Second: The changed model/object will send notification to whom interested to know these changes.
All buttons events are considered EDA, as when button click, the component respond by the code behind.
Complexity Was added to the model when moving to SOA, and micro-services architecture, that the network layers require mapped technologies to the old one:
Event publisher: Source service
Event Subscriber: Micro-services
Communication Channel: Event-Bus, Like KAFKA, RabbitMQ, and Azure Message Queue.
The Workflow:
Initially, Identify the messaging kit, like RabbitMQ, KAFKA, and Azure Message Queue
Define Events producers and related events that should be raised to listeners
Define Events consumers, that should listen to events in order to take suitable response
Building component on the web.
Granularity and domain are the main focus of microservices implementation.
Moving forward to host all business logic on the cloud functions.
Needs a different level of maturity
Design patterns is solution for specific problem within working domain.
It has been recorded from the worldwide practitioners practices to solve these problems.
We have three types of patterns:
Creational design patterns focus on how objects are created, making object creation more flexible, controlled, and independent of specific implementation details. They help manage complex initialization logic and reduce coupling between clients and concrete classes. Common examples include Singleton, Factory Method, Abstract Factory, Builder, and Prototype.
Structural design patterns focus on how classes and objects are organized and connected to form larger, maintainable software structures. They simplify relationships between components, support reuse, and help integrate incompatible interfaces without unnecessarily changing existing code. Common examples include Adapter, Bridge, Composite, Decorator, Facade, Flyweight, and Proxy.
Behavioral design patterns focus on how objects communicate, collaborate, and distribute responsibilities to implement application behavior. They help reduce dependencies between interacting components, encapsulate algorithms, and make behavior easier to extend or change. Common examples include Strategy, Observer, Command, State, Iterator, Mediator, Chain of Responsibility, and Template Method.
These design patterns are modern ones to meet modern application development and cloud migration.
It has different types as following:
Availability Patterns
Data Management Patterns
Design and Implementation Patterns
Management and Monitoring Patterns
Messaging Patterns
Security Patterns
Performance and Scalability Patterns
Resiliency Patterns
For more details, please check Microservices Design Patterns.
The ways we load data into our solution during the implementation journey and business workflow.
We have 2 strategies:
Lazy loading means loading data on demand, Automatic
Eager loading means upfront data loading , Automatic
Lazy loading: Lazy loading means loading data on demand
Eager loading means upfront data loading
Eager Loading: Reduce round-trips and avoid repeated queries
1.Enhance UX by enhancing performance
2.Cost reduction by optimal resource management
Eager loading
Lookup Data
Dashboard (KPIs)
Lazy loading
One to many
Reporting/analytics
Admin panel
Image-heavy UI
Historical Data