Multi-Tier Architecture
Podcast: Play in new window | Download (46.2MB) | Embed
Subscribe: Apple Podcasts | Spotify | Email | RSS | More
The single tier design comes from the time of the “mainframe” computers. Everything is done on a single computer with all resources attached to that computer. It is accessed through terminals without much logic or processing individually.
Dual tier has the advantage of being less expensive than the mainframe of a single tier. However the connections to the database server can be expensive with limitations on how many users can be connected.
Three tier architecture separates the functional process logic from data storage and user interface. These are developed and maintained independently on separate platforms.
Episode Breakdown
18:20 Presentation Tier
The user interface is stored in the client or browser. This gives the user access to the application and presents data to the user. It can permit manipulation of that data or entry of new data.
The interface can be traditional such as native apps on desktop or mobile or web-based applications. The client-side stores and presents data in tables, graphs, and charts.
It interacts only with the application tier where it sends requests and receives responses. This keeps the user interface separate from the logic of the application and the data storage.
22:59 Application Tier
The application tier is also known as mid tier, logic, or business tier. It exists on the server and assists in resource sharing between the user interface and the data source.
The functionality of the app exists in the application tier and consists of business and data rules such as business algorithms, legal regulations, and consistency of data structures. It is used to solve critical business problems and is written in one of the “typical” programming languages such as C#, C++, Ruby, Python, etc.
It interacts with both the presentation tier and the data tier serving as a buffer between client and database. The application tier receives requests from the presentation tier and sends responses back. It also sends requests to the data tier and receives responses.
30:04 Data Tier
The database servers store permanent data. They are used for information storage and retrieval. Most are written in SQL.
The data tier serves to keep data separate from the application and business logic. It receives requests from the application tier and returns responses.
40:25 Rules of Three Tier Architecture
This section of the episode was paraphrased from Tony Marston’s material.
The code for each layer must be contained with separate files which can be maintained separately. Each layer may only contain code which belongs in that layer.
The Presentation layer can only receive requests from, and return responses to, an outside agent. The Presentation layer can only send requests to, and receive responses from, the Business layer. The Business layer can only receive requests from, and return responses to, the Presentation layer. The Business layer can only send requests to, and receive responses from, the Data Access layer. The Data Access layer can only receive requests from, and return responses to, the Business layer.
Each layer should be totally unaware of the inner workings of the other layers. The Business layer must be database-agnostic and not know or care about the inner workings of the Data Access object. The presentation layer may take the data and construct an HTML document, a PDF document, a CSV file, or process it in some other way, but that should be totally irrelevant to the Business layer.
50:13 Benefits and Drawbacks
The advantages of using a three tier approach include reusability or the ablity to share and reuse components distributing them as necessary. Also the flexibility to deploy and redeploy components, keep up with changes, and grow the application. It allows for scalability by dividing large projects into simpler ones so the workload may be distributed among developers. Finally the mid tier ensures that only valid data is allowed providing better security and no direct access to the database.
The disadvantages include an increased complexity with more points of communication requiring a larger team. The physical separation of the three tiers may affect performance. Finally the system can be difficult to build and maintain.
IoTease: Project
Velo Bling-Bling
This project created by Peter Schmid builds LED lights for bicycle wheels that can display images or text with a Bluetooth or USB interface. It uses 32 RGB LEDs that are controlled in real time. This is a fun project requiring some advanced skills. It has a built in cyclometer with pressure altimeter and can be configured with bluetooth low energy via a smartphone. There’s also about 50 custom pictures already created that can be added.
Hardware
- 32 RGB LED
- Low-Power Accelerometer
- Altitude/Pressure Sensor
- BLE Module
- Kinetis K2x USB MCU
- Kall Effect Sensor
- Microchip
- Freedom Board
Tricks of the Trade
Gall’s law states that complex systems evolve from simpler systems. You will see this in the architecture of any application that you build. The abstractions we use to understand programming and architecture overall can be applied to each level. These abstractions are there so that you can reason about things they are not things.