A monolithic architecture. Can also be considered tiered architecture. Layered architectures consist of a number of tiers / layers that perform a specific task in the system.
Each layer is independant from the rest of the system and interacts with the rest of the system through a well-defined interface, e.g. REST. It exposes its own functionality through a similar, abstract API.
Fig. 2.1, DS, van Steen & Tanenbaum: A diagram showing 3 different styles of layered architecture
In the above image, you can see layers making downcalls along with upcalls between layers.
A call can usually be met with a response associated with the call. However, upcalls should be generally avoided.
OSI Layered Model
7 Layers:
Physical
Data Link
Network
Transport
Session
Presentation
Application
Each layer is appended to a packet before being sent to the next
An OSI network packet
Examples of Layered Architecture
Network Model
Web Architecture Model
Advantages of Layered Architecture
Allows open systems to communicate
Well defined communication protocols allow a new service to be implemented with little additional work
Object-Based & Service Oriented
Each object refers to a component in a system. The components are connected through procedure calls. Works similar to a regular programming language:
class A {voidDoSomething(B b){ b.DoSomethingElse();}}
Object-Based Architecture
The interface is placed on the client, with the object placed on another machine. In this case, the object is a distributed object / remote object.
The client binds to the distributed object, copying the implementation of the object’s interface into a proxy loaded into the client.
class Client { Proxy proxy;publicvoidBind(DistributedObject obj){// Get a copy of the interface's implementation proxy = obj.GetProxy();}publicvoidRun(){Bind(); proxy.CallSomeMethod(params);}}
A proxy’s job is to marshall method invocation, and unmarshall their results. On the other end, a skeleton unmarshalls the data back into a method invocation with the same interface.
An example of a client side proxy
Service Oriented Architecture
An extension of Object-Based Architecture. An object is completely independent of everything else, and just acts to provide to a client.
Advantages of Object-Based Architecture
Has a natural way of encapsulating data or object state.
Interfaces conceal implementation details.
Objects can be considered independent of their environment.
A new object with the same interface should be able to replace an old one.
Disadvantages of Object-Based Architecture
While the interface is distributed, the state is not. Only one machine holds the state of an individual object. Solved by using many small objects that communicate in a less dependent manner.
Resource-Centered
Resources are identified through a single naming scheme.
All services offer the same interface, consisting of at most four operations.
Messages sent to or from a service are fully self-described.
After executing an operation at a service, that component forgets everything about the caller.
Glossary
Downcall: A call that goes down to the next layer in a layered architecture
Upcall: A call that goes up to the previous layer in a layered architecture