Distribution: Layers vs. Tiers
Even though there’s so much written on this topic and I really don’t like to discuss the discussed, the motivation here was observing general ambiguity regarding the difference between Layering and Tiering among interns. So here without going into details we will just discuss the difference.
Though both ensure distribution, layers are logical while tiersĀ are physical ways of distribution. Usually Layers are for us while Tiers are for machines but not necessarily.
Layers
Layering is to create logical separation in your code during design and development, based on roles and responsibilities in order to increase clarity, reduce complexity, increase maintainability and organize relationships among code artifacts. Layering itself doesn’t imply any specific implementation that how many layers you should have or which layer should or shouldn’t communication with which layer. Following is an example of having layered code or multi layering:
Data Layer
Since almost applications use data, whether it’s a business application or a game, you need to persist and retrieve data You may have a separate set of modules or classes (or whatever code snippets) to handle saving and retrieving data from database, XML file, text file, web service or any data source.
Presentation Layer
Web pages or windows forms are the most common example of presentation layer, where you just focus on the presentation delegating domain logic, data retrieval, security or any other concern to other layers.
Tiers
Tiers are the physical distribution of application at infrastructure level at the time of deployment, like whether to have a single machine for database and web server or dedicate machines for both or even multiple servers for balancing the load or adding backup machines and processes for handling as failover. Again the term Multi Tier or N-Tier doesn’t restrict to any number of tiers instead it depends on the requirements and the platform.
leave a comment