I'm doing a small research on design patterns in various platforms and I have prior experience in programming with Java.
While reading this and this, I had a question in mind: Why Java swing MVC can not be compared with Android development pattern? or Why we can't say that Android follows MVC? (in the context of overall "look and feel").
In one answer, someone clarified MVC as:
Model: What to render
View: How to render
Controller: Events, user input
well, now what I understand is:
Java Swing MVC:
In Java swing MVC,
component class is an abstract class for all
attributes in visual environment. There is a distinct keyword called
controls is used for some
components such as buttons, lists etc.
So, all controls and components are part of Model in MVC.
component. and there are several
LayoutManagers that defines layouts and place of
container. Also there are
Listenershave to be registered with
EventSources. So, they all are the View in MVC.
Class that implements
Listener methods in which we put our main
logic and there are some
EventClasses for each event. They all are
part of Controller in MVC.
putting all these examples together in an image; in swing MVC we have:
Android architecture (visualizing as MVC):
widgets are same as
controls here. Also, there are some
EventSources.They all act as a Model.
View package has
viewgroups (that also contains several kinds of
Listener interfaces. they all are the part of
View in MVC.
Same as swing MVC, we can say listener methods and also activities as the part of controller.
Ok. so, as per above comparison, I consider following similarities:
Container - same as
Layout managers - same as
Listeners - overall same in both architecture
controls - overall same as
Event delegation (registering appropriate listener with Event source and then implementing Listener's methods) - overall same in both architecture
I may be not right about all the things put above. I need your help in understanding whether they are right or wrong ..... Also can anyone explain which are the things that makes the Android development pattern different that Java swing MVC pattern?