Junior
Tell about two-tier client-server architecture (2-Tier).
sobes.tech AI
Answer from AI
In a two-tier architecture, there are two main components: client and server.
- Client (Presentation Tier): Responsible for user interaction and data presentation. This can be a desktop application, web browser, etc. All user interface logic and part of the business logic can reside on the client side.
- Server (Data Tier): Responsible for storing and managing data, usually using a database. The client sends requests directly to the server to retrieve, add, modify, or delete data.
Advantages:
- Simplicity of development and deployment for small applications.
- High performance with a small number of users, as there is no intermediate layer.
Disadvantages:
- Limited scalability: as the number of clients increases, performance may decrease due to the load on the database server.
- Duplication of business logic: some business logic may be implemented both on the client and server, complicating maintenance.
- Support complexity: changes in business logic or the database often require updating all clients.
- Security issues: direct requests from the client to the database can pose a threat.
Use cases:
- Simple desktop applications with a limited number of users.
- Intranet applications in small companies.
Example:
A simple desktop accounting application that directly accesses a file database (e.g., Access).
-- Example SQL query from client to server
SELECT * FROM Customers WHERE City = 'Moscow';