Category Archives: Software Design

Microservice-Based System

Motivation:

You want to use microservice architecture for your system but you are not sure whether your design does follow microservice style.

You need to explain your microservice-based design to your client or manager.

You need to evaluate a system against microservice architecture style.

Information:

A microservice-based system contains 2 main parts: a user interface and a collection of APIs (or web services or just services).

[A diagram shall be added here.]

The user interface can be multiple web pages or single web page or mobile native application or Windows native application.

The user interface can be implemented using ASP.NET MVC or React or Angular or Android SDK or iOS SDK or even ASP.NET Web Forms or WordPress.

Each API must have its own database, must be deployed independently of other APIs, must support automation testing and automated deployment, must be able to be scaled horizontally, can be implemented using preferred technology stack, and should focus on a single business domain.

Each API database can be a relational database (MS SQL, Oracle, mySQL) or noSQL database (MongoDB, Cassandra).

These APIs can be implemented using .NET Framework 4.8 or .NET 6 or Spring Boot (Java) or Node.js or Golang or even WordPress.

These APIs often share an identity provider that in turn is often a specific API too.

These APIs often share several utilities (e.g. notification service, file service, payment service) that in turn are often specific APIs too.

These APIs can be grouped into API Gateways for easier authentication and authorization control. The API Gateways can be implemented using using .NET Framework 4.8 or .NET 6 or Spring Boot (Java) or Node.js or Golang or even WordPress.

These APIs can also share data with one another using a message broker (i.e. message queues). These message queues can be implemented using a relational database (MS SQL, Oracle, mySQL) or noSQL database (MongoDB) or a distributed event streaming platform (Kafka, RabbitMQ).

 

 

Why Select Microservice Architecture for Your System?

Motivation:

You need to decide whether to use microservice architecture for a new system or for modernizing a legacy system.

Suggestions:

A. Why select microservice architecture for your new system?

Reason 1: You want to have several independent development teams.

Reason 2: You want or your client wants to have a faster and modern UI (i.e. SPA) that is totally decoupled from the other parts of the system.

Reason 3: You want or your client wants that a part of your system (e.g. user store and authentication) can be shared among or reused by multiple different systems.

Reason 4: You want or your client wants your system to be able to scale out easily later.

Reason 5: You want or your client wants that some parts of your system can be revised or extended or replaced easily later.


B. Why migrate your legacy system to microservice architecture?

Reason 1: You want to have several independent development teams.

Reason 2: You want or your client wants to have a faster and modern UI (i.e. SPA) that is totally decoupled from the other parts of the system while the old technologies (like ASP.NET Web Forms or WordPress) cannot provide it.

Reason 3: You do or your client does have performance or scalability issue with the legacy system.

Reason 4: You find that is too difficult to add a new feature to the legacy system because it is too complicated.

Reason 5: You want or your client wants that some parts of your system (e.g. user store and authentication) can be shared among or reused by multiple different systems.

Reason 6: You want or your client wants your system to be able to scale out easily later.

Reason 7: You want or your client wants that a part of your system can be revised or extended or replaced easily later.


C. Here are my suggestions based on estimated development effort and a number of system users.

For a new small project (3-month effort, less than 1,000 users) I always recommend that we use any simple solution that works (e.g. WordPress, Magento, Salesforce LWC, ABP).

For a new medium or large project (2-year effort, more than 20,000 users) I recommend that we use a microservice-based and SPA solution.

For a legacy project I think that we do need a really “good” reason to migrate it to microservice architecture first.

Maybe your client wants to provide a modern SPA for their users.

Maybe the number of users grows to 1,000,000 and you do have a performance or scalability issue.

 

Topic 16 – Advanced Software Design

Why do I need to learn about advanced software design?

Your task now is not just to build a house, it is to build a city. Soon, you will be creating very complex software. You are responsible for designing a system containing around 10,000 classes or functions for 5,000 users to use over the next 15 years. The maximum allowable system downtime must be less than five minutes per year.

Imagine you have to create a system that serves millions of users simultaneously, like Facebook, YouTube, Amazon, Office 365, or Gmail. Are you confident in building one?

Now imagine you are tasked with creating a web framework for developers to extend, such as ASP.NET, Yii, or React. Are you confident you could create one?

If you are unsure how to accomplish these tasks, it is probably wise to study how others have built similar systems and adapt their approaches to your situation. Advanced software design equips you with the knowledge and tools needed to begin building your own complex software.

What can I do after finishing learning advanced software design?

You will learn how to design a complex software system that satisfies not only functional requirements but also security, modifiability, scalability, reusability, extensibility, and reliability requirements..

That sounds interesting! What should I do now?

Nowadays, software can be applied to many fields, each requiring specific advanced software design knowledge. In this topic, we focus only on enterprise software due to its popularity.

Before designing a complex system, you must thoroughly understand its sophisticated requirements. This is a critical step in building any large system.

First, please read this book to learn how to elicit, analyze and document requirements for an enterprise system: David C. Hay (2002). Requirements Analysis: From Business Views to Architecture. Prentice Hall PTR.

After that, please read this book to learn about transactional processing principles and techniques: Philip A. Bernstein and Eric Newcomer (2009). Principles of Transaction Processing. Second Edition. Morgan Kaufmann.

After that, please read the books below to learn how to leverage domain-driven design approach to reduce software complexity.

After that, please read the books below to learn how to design microservices:

After that, please read the books below to learn how to leverage event sourcing and stream processing to design scalable big data software systems:

Terminology Review:

  • Enterprise Applications
  • Enterprise Systems
  • Transaction Processing
  • Microservices
  • Domain-Driven Design
  • Entities
  • Value Objects
  • Aggregates
  • Domain Events
  • Factories
  • Repository Interfaces
  • Repository Implementations
  • Bound Contexts
  • Event Sourcing
  • Command Query Responsibility Segregation (CRQS)
  • Stream Processing
  • Lambda Architecture
  • Kappa Architecture
  • Event-Driven Architecture
  • Serverless

After finishing advanced software design, please click on Topic 17 – Calculus to continue.

 

Topic 13 – Introduction to Software Design

Why do I need to learn about software design?

What will you do if you are asked to build a house?
You will need to sketch its first and build the house based upon the sketch. Otherwise you may build a house that may collapse in a few weeks or cannot be decorated due to errors.

The situation is similar when you create software. You need to plan how you will build it first by deciding how many components and objects will be used for constructing to solve at least a core problem, what are their responsibility, how they work together, how data will be organized, how data will be flowed within these components, how users will interact with your application, how these components will be deployed.

Software design knowledge will guide you how to do these tasks.

What can I do after finishing learning software design?

You will know how to create a design for an application including static and dynamic structure, data organization, business processing workflows.

Is is really useful? I feel that you can write the code right after having requirements and I am able to refactor my code when needed.

That’s great if you can do it like that. You only need to learn about software design when

(i) you do not know how to write code for a feature or

(ii) you cannot refactor your code because only a small change breaks the whole application or

(iii) you need to write a software system together with 20 other developers and you do NOT know where to begin and how you will integrate results of all the developers into one solution or

(iv) you have a software system that could  serve 20 users simultaneously very well but it stops responding when serving 2,000 users simultaneously and you do not know how to fix it.

Alright! What should I do now?

Each application type, such as enterprise systems, games, or intelligent systems, requires specific design knowledge. In this topic, we focus only on the core concepts of software design related to enterprise systems.

First, please read the books below to learn the core concepts and activities of software design as illustrated using the UML language:

After that, please read this book to learn about object-oriented design patterns: Erich Gamma et al (1994). Design Patterns Elements Of Reusable Object Oriented Software. Addison-Wesley Professional. When reading this book, focus first on the Motivation section of each pattern, and feel free to skip any pattern if the problem presented in the Motivation section is not relevant to your situation or does not interest you.

After that, please read the books below to learn about classic design patterns and architectural patterns widely used in enterprise systems:

After that, please read the books below to learn about the core concepts and activities applicable to structured design (i.e., top-down decomposition):

After that, please read the books below to learn about the core concepts and activities applicable to object-oriented design (i.e., bottom-up composition):

After that, please read this book to learn how to design software systematically and how to evaluate a design: David Budgen (2020). Software Design. CRC Press.

After that, please read this book to learn how to create a clean, modular design for an enterprise system: Robert C. Martin (2017). Clean Architecture: A Craftsman’s Guide to Software Structure and Design. Pearson Education.

After that, please read this book to learn about the core concepts of software architecture: Len Bass, Paul Clements and Rick Kazman (2021). Software Architecture in Practice. Addison-Wesley.

After that, please read this book to learn how to document an architecture so that it can be used for communication, software construction and maintenance: Paul Clements et al. (2010). Documenting Software Architectures: Views and Beyond. Pearson.

After that, please read the books below to learn how to create an architecture systematically:

After that, please read this book to learn how to document an architecture for agile projects: Simon Brown (2019). Software Architecture for Developers – Volume 2. 2 – Visualise, Document and Explore Your Software Architecture. Leanpub.

Terminology Review:

  • Software Design.
  • Design Inputs and Outputs.
  • Design Notations.
  • User Interface Design.
  • Database Design.
  • Data Structure Design.
  • Algorithm Design.
  • Object-Oriented Design.
  • Architectures.
  • Architecture Design.
  • Architectural Styles.
  • Architectural Patterns.
  • Design Patterns.
  • Modeling vs. Designing.
  • Analysis Models vs. Design Models.
  • Design Phases.
  • Design Timing.
  • Design Methods.
  • “Good” Design: Modularity, Information Hiding, Data Encapsulation, Low Coupling, High Cohesion.
  • UML.
  • Use Case Diagrams.
  • Class Diagrams.
  • System Sequence Diagrams.
  • Sequence Diagrams.
  • Communication Diagrams.
  • Activity Diagrams.
  • State Diagrams.
  • Static Structure.
  • Dynamic Structure.
  • Design Principles.
  • SOLID Principles.
  • Cohesion.
  • Coupling.
  • Design Patterns.
  • Software Architecture.
  • Architecture Qualities.
  • Package Diagrams.
  • Component Diagrams.
  • Deployment Diagrams.
  • Architectural View.
  • Architectural Viewpoint.
  • The C4 Model.
  • Architecture Patterns.
  • Enterprise Patterns.
  • Row Data Gateway.
  • Active Record.
  • Data Mapper.
  • Table Data Gateway.
  • Table Module.
  • Transaction Script.
  • Domain Models.
  • Structured Design.

After finishing software design, please click on Topic 14 – Software Project Management to continue.