Reputation: 15
so I'm new to Architectural patterns and I've bumped into a problem recently: I have a server-side (and a client which is on Android); the server-side has Business Logic Layer, Data Layer(SQL) and Persistence Layer (Hibernate). I know that a layered architecture should contain a Presentation Layer also and until now I used to make the application with all the layers in one place (only one module, not server and client separated). If this is the case would the architecture of the server still be considered Layered Architecture? Given the fact that I can say the client has an MVC architecture, and the application as a whole has a client-server architecture, but I'm not sure if the server could be considered having a Layered Architecture. Thank you, and sorry if its a stupid question but searched and couldn't find anything related.
Upvotes: 0
Views: 339
Reputation: 10227
@Heyo's answer is correct, but I'll elaborate.
Layers can take various forms but will at least be logically separate; meaning that you can have UI / API code, which calls business logic code, which calls data access code i.e. never UI / API code calling data access code directly, or UI / API code, logic code and data access code mixed together (e.g. data access code embedded in the UI code).
So yes you can write all that code into a single code file (depending on your technology stack, I guess), but it wouldn't be pretty (easily maintainable).
A good test of your logical layering is if you can take the various code (classes, etc) and re-arrange the physical code structure. E.g. into different assemblies or packages, and have them still work.
Upvotes: 0
Reputation: 108
I would say yes. You would have the different layers for both the client and the server side of things. The client side would just have a presentation layer that the user can interact with like a GUI interface, and the server would have a presentation layer like a Rest interface, that the client would interact with. Same concept just different implementations. In any case it would still be layered without a presentation layer since there is still more than just one level.
Upvotes: 1