• Post Reply Bookmark Topic Watch Topic
  • New Topic

web application layers  RSS feed

 
bob du
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When building web applications, I know about the three layers (presentation layer, business layer, and the data layer). How I understand is, the presentation layer talks to the business layer, and the business layer talks to the data layer. My question is, is it always in this order? or can the presentation layer talk directly to the data layer as well?
 
Yogesh Gnanapraksam
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It depends on the implementation. If you use the Model -View -Controller architecture then it is not possible for the view layer to directly talk to the database . Also it is not a good practice for the presentation layer to talk to the database layer.
 
Junilu Lacar
Sheriff
Posts: 11486
180
Android Debian Eclipse IDE IntelliJ IDE Java Linux Mac Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Technically, any layer can talk to any other layer, if you choose to program it that way. The question is, "How should it be programmed?"

Layering an application is just another way to provide abstraction and separation of concerns. Abstraction helps to hide implementation details from things that don't need to know about them. For example, a View/Presentation component doesn't need to know about the database queries that retrieve information that is shown to the user. In fact, the View/Presentation doesn't need to know that there's a database involved at all. If you can provide sufficient abstraction such that changes to the implementation in one layer do not ripple out to cause changes in other layers, then your design is fine. If not, then you probably shouldn't program it that way. Based on that, it really depends on much how abstraction and isolation from changes to the implementation you can achieve but it's usually not a good idea to have the View/Presentation layer components access Data layer components directly.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!