 Next up in our list of Architectural styles is the layered architecture and as the name suggests We have a number of layers that are on top of each other This is how we structure our system and Typical layers we might have is for example the user interface We might have an authentication layer authorization We might have a business logic. So the actual functions that do something And we might for example have the operating system or the database or other things that come in here and The way the layered architecture works is that the upper layers only ever talk to the layer right Below it. So you're not allowed to jump over that And The lower layers never call up. They just reply So if I for example from the UI send an authentication request to the second layer this layer Answers that but the layer will never by itself call the UI and say please do something It's only reacting to input coming from above So the way this works is simply that the requests are trickled down Until the lowest layer for example if the UI needs something from the database It will first go through the authentication then into the business logic then to the database and back So this is how the layered architecture works This is a common way to for example structure teams that you have the UI team Do you have the authentication or some kind of security team? You have the business logic team and database team you might have multiple of those of course So depending on how large your system is you might have a number of teams here that do work But this is a very common way of structuring your organization now advantages of the layered architecture of for example security So it's rather easy to add security features at multiple levels So you can in here for example insert a new layer That has some kind of protection on the database or I don't know a firewall Whatever you need, but you have these possibilities to do that at several levels and well, this is a Typical way of inserting things in general because the interface is fixed On a more general level not just looking at security. It's very easy to insert something new without having to change the system As long as that layer that I insert in the middle is kind of using the same way to communicate The other two should not care about this So it should be in theory very easy to extend or to build on top of an existing system So that's why it's a very popular style to use There are however a Number of issues here and one of them is for example that it's quite difficult to get a nice performance Because the requests have to go all the way through they're not allowed to jump over So this can easily take time if you have a lot of layers or if one of these layers is not very efficiently implemented so performance is often a concern in these and In practice It is actually difficult To avoid these jumping over calls So it's difficult to design this in a good way that you have a pure layered style where you only call Top-down and you don't jump over layers. So in practice, it's not that easy One thing I forgot to mention. It's not only easy to build on top or add security layers in between It's also easy again in theory to replace things So if you figure out that the authentication is for example outdated It should be fairly straightforward to implement a new one and just put it in here Without having to change the remaining system So that's another good feature that you can simply take this out put something else in and it should work so that's known as the layered architecture or layered system and That's all I want to say for this style. Let's continue to the next one