views:

332

answers:

3

What are the advantages and disadvantages in MVC patterns when it's using in Java?

+4  A: 

Advantages and Disadvantages of any design pattern do not depend on any language!

Megadix
I slightly disagree. Some design pattern are harder/clunkier to implement in some languages and simply unnecessary in others (Examples: 1. Strategy pattern can become unwieldly in Java, due to the verbose nature of anonymous classes. 2. Visitor pattern is not necessary in languages that support multiple dispatch (LISP)).
Joachim Sauer
I agree with you, for *some* pattern language does matter, but I think they are just a minority
Megadix
+2  A: 

I think the answer is independent of the language and even the first line of Wikipedia answers it quite well: "The pattern isolates business logic from input and presentation, permitting independent development, testing and maintenance of each." Wikipedia: Model-view-controller

sfussenegger
A: 

MVC Pattern is widely used in Java. Most of the java web frameworks are built on MVC architecture. As stated in a previous reply "Advantages and Disadvantages of any design pattern do not depend on any language". This is 90% percent true.

JSP is well fitted for MVC Pattern. The JSP architecture has a lot of features and concepts that makes MVC easily implementable in Java, and a few classes suitable for MVC: ServletController to be used in the controller layer, JSP files to be used in presentation layer; controller can delegate the calls to other controllers, of to jsp pages.

However, JSP is just an java "extension", does not represent java core. Writing a new MVC framework from scratch is possible, and there are many java JSP alternatives out there, many based on MVC(Struts2/WebWorks for example).

Writing a new MVC framework from scratch in java is (almost) as easy/hard as writing it in another language.

php html