mixing MVC and MVVM in same project

asked 2014-04-25 15:11:08 +0800

elmetni gravatar image elmetni
145 7

hi i am working with a team on a project using ZK , hibernate and Spring . the thing is my whole team prefer to work with MVVM and it seems I can’t get into this architecture , i still comfortable working with MVC , so I was wondering , it will be a bad if we split the project in pages and I work with MVC and rest of team with MVVM ? And thank you

delete flag offensive retag edit

2 Answers

Sort by » oldest newest most voted

answered 2014-04-26 09:31:25 +0800

cyiannoulis gravatar image cyiannoulis
1191 10

It depends. Generally speaking there is nothing wrong using both techniques. But you have to consider the following points:

Communication between pages. Normaly, in MVVM you use the @GlobalCommand while in MVC you have to post events on you own. If communication between MVVM and MVC driven pages is a prerequisite, then you may realize some difficulties.

Maintenance. In general, maintaining two different models is something that may give you hard time in the long run.

Have in mind though that you may use the MVVM just like the MVC using the Selectors utility:

public void doAfterCompose(@ContextParam(ContextType.VIEW) Component view){
  Selectors.wireComponents(view, this, false);
  Selectors.wireEventListeners(view, this);

Doing this you will be able to wire components and listen events just like you would do with a SelectorComposer:

@Listen("onClick = #mainWindow > button")
public void buttonClicked() {
  System.out.println("a button was clicked!");

Be cautious though if you follow this appoach you must not update models/componets using the BindComposer. The data binder is not aware of the changes you are making dynamically to the wired components.

Hope that helps.


link publish delete flag offensive edit

answered 2014-04-27 10:44:38 +0800

nmpallas gravatar image nmpallas
115 4

To add on top of what Costas is saying, following the MVVM pattern imposes more the separation of concerns on who is developing what. My only objection is that even in the MVVM / MVC tutorial is stated that mixing them is not blocked, but is not recommended.

regards \n\m

link publish delete flag offensive edit
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

1 follower



Asked: 2014-04-25 15:11:08 +0800

Seen: 51 times

Last updated: Apr 27 '14

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More