Architectural pattern is the way of designing a software. You should decide which pattern to use before starting a software project. It divides the project into smaller pieces and guides you for the development.
Other definitions for architectural patterns:
An architectural pattern is a general, reusable solution to a commonly occurring problem in software architecture within a given context. (Wikipedia)
An architectural pattern is a named collection of architectural design decisions that are applicable to a recurring design problem, parameterized to account for different software development contexts in which that problem appears. (Book: Software Architecture: Foundations, Theory, and Practice)
You might come across other names like “architectural style”, “software architecture”, “development model” so on and so forth. The idea behind the architectural patterns is that solving a problem and having a common language for all of the project team (leader, analysts, developers, testers etc.)
Types of patterns
There are two main types of the architectural patters:
- Multitier architecture
- MVC (Model–view–controller)
Type 1: Multitier architecture
Multitier architecture segregates the functionality into smaller parts. There are generally three parts in this architecture: Presentation, business and data.
- Presentation tier: It interacts with the user. Takes the input and displays the output. Includes UI (user interface) components.
- Business tier: It could be called as “Application tier” or “Middle layer”. It has the rules, calculations and the business logic.
- Gets the inputs from presentation tier, process them and send queries to the data tier.
- Gets appropriate data from the data tier, process them and send to presentation tier to be shown.
- Data tier: It consists of database servers and the storage.
Note 1: Multitier architecture might comprise of less or more than 3 tiers. If it has 3 or more than 3 tiers, it is called “N-Tier“.
Note 2: This architecture might be named as multi-layered. The difference between tier and layer is that tier refers physical separation. Each tier stands in a separate server. Layer refers logical separation. More than 1 layers could be in the same server.
Type 2: MVC (Model–view–controller)
MVC is the pattern which includes three parts: model, view and controller. View and controller interacts with the user. Model is responsible for business logic and data layer.
- Controller: Accepts inputs from the user and send commands to View and Model
- Model: Includes business logic, validations and data. It notifies Controller to change the commands and View to update the output
- View: Represents the output coming from Model to the user
Mix of types
It is possible to mix multitier and MVC architectures. View and Controller from MVC goes into Presentation tier. Model covers both Business and Data tiers.
Don’t let terms to confuse you
You might see some sources categorizing “Component-based”, “Event-driven”, “Service-oriented” etc. as architectural patterns. I prefer calling them “architectural styles“. They don’t focus on solving problems. They are used to organize and improve the software development.
Also there are some terms like “Object-oriented”, “Parallel computing”, “Imperative” etc. that are sometimes called “pattern” or “style”. These are “programming paradigms” which are fundamental parts of computer programming. Programming languages are based on one or more of them.