Crea sito

Model View Controller - MVC

This pattern can be consider the most popular and used pattern in all the programming world.

Model View Controller states for: I have some data (Model) that I want to visualize (View) in a specific way (Controller).

There are two ways to do this:

- mix all three layers: it's the worst choice that a good programmer should do. Code becomes confused and unreadable...... after two weeks if you have to change someone (etc: add a button to your view), you'll delete all your "code" and rewrite it from line 0.

- maintain separated all three layers: the abstraction level grows just a little and you keep every part isolated from others. This is the good solution to allow you to maintain your project easily and  with few modifications.

 

Example:

- android: layout.xml + sqlite/pref/... + activity