views:

66

answers:

3

Hi,

What the following line is saying about model component in MVC pattern:

If the model adheres to a strict contract (interface). then these components can be reused in other application areas such as GUIs or J2ME.

Does the above line mean, if the model components implement any interface based on any GUI and J2ME application, then these application can use it. Am I correct?

+2  A: 

You must not mix "interface" as in "user interface" and "programming language interface". If your MVC model objects have well-defined "programming language interfaces" you can later create applications for J2ME and similar that re-uses these objects - or so the theory goes.

krosenvold
A: 

No. You can use a Java interface to define how a view or a controller can handle the model. YOU define your model, not the GUI framework.

lbp
+4  A: 

In the MVC pattern, the model should have no knowledge of what type of application or user interface is using it. It should only provide methods to access the data, and should not care what type of application is calling it. The quote you have means that if your model has a well-defined, non-application-specific interface, it can be used in any type of presentation (e.g. a GUI or J2ME mobile app, etc.)

Andy White