OOP2 Lecture Week 13 (Fall2023 24)
OOP2 Lecture Week 13 (Fall2023 24)
Project
Course Code: CSC 2210 Course Title: Object Oriented Programming 2
The terms tier and layer are often used interchangeably. This isn’t wrong when the
context is correct, but it is important to make and understand the distinction that they
are not the same in software architecture. A tier refers to the physical location that
your code base runs. A common case would be a client-server application that has two
tiers, the physical client, and physical server. Tiers are distinguished by they fact that
they are separated by physical boundaries.
Layered Architecture
Layers
Layers on the other hand, are logical separations of concerns in your application
architecture. You might design your architecture to run a layer of the software on a
specific tier, or share a layer across tiers. These decisions usually account for
requirements such as security, performance, or management of the infrastructure. The
most common and accepted layers of software are listed below:
Data Layer (also combination of Entity Layer)
Business Layer
Service Layer
Application Layer
Layered Diagram
Layered Diagram
Layered Architecture
Data Layer
The data layer is also referred to as the DAL, or data abstraction layer.
This particular area of the software is responsible for encapsulating all access to
application data.
Application data will be stored in a database like SQL Server or MySQL, but the DAL can
also encapsulate data stored in other formats, such as xml.
Sometimes this layer also incorporates ‘Entity layer’ which often considered as
separate layer.
Entity layer includes the classes which maps the DB table with the system.
Layered Architecture
Business Layer
The right architecture largely depends on the application you will build. Designer have
to ask some question which are:
How many tiers will your architecture have?
Is your application heavily data driven?
Do you have complex domain requirements or business rules?
Small applications might not require a layered architecture at all.
The important part is you architect a solution that fits your needs.
Layered Architecture
Advantages
Improve productivity via Reuse (The entire Data Access Layer module is reusable).
Improve Productivity via Team Segment.
Improve Maintainability.
If a change is made with Database it will only effect only DAL. If change is BL it will only
effect BL.
Looser coupling.
More physical deployment. Adding this feature can affect the performance.
Layered Architecture
Disadvantages
Adding additional servers to our application to increase its performance and scalability.
But in reality is that the fastest an application can perform is when all its processes is
in-process in a single machine.
More complex designs.
Complex and good amount of skills and experience required for the team.
More complex deployment.
Loose coupling allow connected modules to change independently of one another.
Layered Architecture
Monolithic Application
The Data Access Layer Project Contains the entities classes and objects to
communicate with the database.
Service layer contains properties and helper classes to communicate with all.
It also acts as a mode of communication among the layers.
Presentation Layer needs no direct interact with the database.
Add a reference of the Business Logic Layer to Presentation Layer and Data Access
Layer to the Business Logic Layer and Service Layer to all other layers.
Project
Discussion
Project Proposal Form
Thank You
Books
• C# 4.0 The Complete Reference; Herbert Schildt; McGraw-Hill Osborne Media; 2010
• Head First C# by Andrew Stellman
• Fundamentals of Computer Programming with CSharp – Nakov v2013
References
• https://www.c-sharpcorner.com/UploadFile/1492b1/understanding-multilayered-
architecture-in-net/
• https://medium.com/@hidayatarg/n-tier-layer-architecture-in-c-15b8fe97283c
• http://danderson.io/layered-architecture/
• https://github.com/topics/layered-architecture?l=c%23