3-Tier System – Definition and Explanation

Architecturedomain-modeln-tier

People often claim that they are following a '3-tier (or n-tier) architecture', and sometimes they then claim to be switching to a Domain Model. But I really never have understood what this mythical '3-tier architecture' is. It seems to have no formal definition. Whereas there are numerous references and examples around that explain and demonstrate the Domain Model pattern, any reference to 3-tier simply suggests you should separate your code into UI, Business Logic and Data Access Layers. And that's all they seem to say.

What I find particularly strange is that to me, Domain Model is the perfect embodiment of this 3-tier paradigm. the ORM and mapping files are the Data Access Layer, the Domain is the Business Logic, and the UI is the, well, UI. So why do people talk as though it is something new and different, and something they should switch to?

Before I saw people implementing Domain Model, most applications were UIs accessing stored procedures with the logic split across the UI and the SPs. Sometimes there were a few assemblies called 'UI', 'BLL' and 'DLL' but usually these were just mediators between the UIs and SPs, leaving more places for the logic to be randomly spread across.

So what is this mythical '3-tier' architecture? Does it really even exist? and if so, where are some examples of it implemented well?

Best Answer

The definition of 3-tier architecture is a special case of the n-tier architecture. In an n-tier architecture, there are n components and each one only interacts with the component immediately "above" and "below" it. A three-tier architecture has three such components.

Typically, a three-tier architecture consists of a user interaction layer, the business rules layer, and data services (including databases) layer. The user interaction layer only issues requests to the business rules layer, which retrieves data from the various data services, processes it, and then returns it to the user through the user interaction layer.

The n-tier architecture is an example of an architectural pattern (or architectural style). It simply defines some constraints on the architecture of the system. By itself, it is not a complete view of the architecture of the system. Although I'm sure that there are systems that implement something like a three-tier architecture, it is just a pattern that's meant to set up a discussion for additional design and implementation of a system.

Related Topic