Read this knowledge nugget if you want to learn what a layer is in Software Architecture, how you can use it, how the concept works and why you would want to use it.
Based on [QinXingZheng2008] was Edsger Dijkstra one of the first discussing how to use layers in the construction of large scale systems. Layers are often used in the construction and description of software systems. Think of
- the famous OSI Model as an abstraction of the network protocol stack,
- the layering we typically build into software applications, such as web layer, business layer, persistence layer, etc.
A layer is a logical grouping of functions with similar concerns, independent of where it is physically going to be implemented.
It is important that layers have a clear purpose and a clear interface to each other. If you build software based on a layered model it is important that layers do not randomly access functions in another layer, but only make calls to the layer next to it through a defined interface.
This is to decrease coupling, increase maintainability, and provides encapsulation and modularity on architectural level.
Figure 1 shows an example of a typical layering of a web-based application and illustrates how layered models work:
- Client Layer – A web browser, or an other client. It is the originator of a request.
- Static HTTP Layer – The static HTML content of an application.
- Dynamic HTTP Layer – Sometimes called the web presentation layer. It implements the dynamic portion of a web-application.
- Business Logic Layer – This is where all the business logic – except for the user interface (UI) specific logic – is implemented.
- Persistence Layer – This is where all the data access logic is located (create, read, update, delete).
- Data Layer – This represents the database.
The way it works is that the request is coming from the left – the Client Layer. The layer on the left must pass it on to the layer on the right, for example the Client Layer must pass its request on to the Static HTTP Layer. The layer on the right either responds to the request itself and passes the result back to the calling layer, or processes it as far as it is concerned (partially or not at all) and passes it on to the next layer on the right.
[pra2006] pranshujain. 2006, “Layers and Tiers”, Software Architecture and Content Management [online] available at http://pranshujain.wordpress.com/2006/09/15/layers-and-tiers/
[QinXingZheng2008] Qin, Z., Xing, J., Zheng, X. 2008, Software Architecture, Zhejiang University Press, Hangzhou
[TanSte2002] Tanenbaum, A.S., van Steen, M. 2002, Distributed Systems, Principles and Paradigms, Prentice-Hall, Upper Saddle River
[Wikipedia2010] Wikipedia. 2010, “OSI model”, Wikipedia [online] available at http://en.wikipedia.org/wiki/OSI_model
Copyright © 2010 Michael Pichler