开发者

Servlets vs MVC frameworks [closed]

开发者 https://www.devze.com 2022-12-24 00:41 出处:网络
Closed. This question needs to be more focused. It is not currently accepting answers. 开发者_C百科
Closed. This question needs to be more focused. It is not currently accepting answers.
开发者_C百科

Want to improve this question? Update the question so it focuses on one problem only by editing this post.

Closed 7 years ago.

Improve this question

I very often come across this question of why we have got lots of web frameworks addressing the same or similar drawbacks.

When looking deeply, I also have given thought on why JSP / Servlets is not being used after the other web frameworks (like Struts, Spring MVC etc) have shown their existence?

Is it because, the latest web frameworks

  1. does most of the things on its own?
  2. provides extensive features that is not available with Servlet / JSP?
  3. or the Servlet / JSP is impotent to deliver what latest framework does?

Any help in the form of responses or resources is greatly appreciated.


I will share some of my thoughts on this.

  1. As said above these frameworks are developed on top of Servlet/JSP.
  2. They are meant to avoid duplication of code (DRY).
  3. Framework are based on Design Patterns - general reusable solution for a commonly occurring problems.
  4. They help communicate the things easily across the team and make them productive and focused on the enterprise level problem they are trying to solve than these common tasks.
  5. They help in speeding up the development by providing general solution to commonly well known problems. (e.g. form validation, REST, testing, dependency injection etc.)

When you are developing large scale enterprise app and have multiple developers working on it, you definitely needs some uniformity across the project/code/structure each developer is writing. The enforcements forced externally are not reliable, but when those are in built it helps to make the project to be easy to maintain, scale and easy for new people to be productive with it within short time.

I believe this rule applies not just for servlet-jsp but for JavaScript as well. Just native JavaScript or even low level JavaScript API/Libraries are not enough when building an enterprise scale UI. Either adopt the Best available Framework or abstract out common nature and make it a framework (not library).


Spring MVC still works with JSPs and in its core it provides nothing more than a simple dispatcher servlet that uses the mechanisms provided by the Spring MVC framework (where you register your controllers in etc.). I would say it is about convenience and making things a lot easier to write and maintain. Additionally you can react more easily to current developments (e.g. RESTful services... you would have to code all of it by hand in a servlet). In the end that is what frameworks are for.

0

精彩评论

暂无评论...
验证码 换一张
取 消