Separation of Model in Design Pattern

Before talking about model, you can read about what is the "model" thing in MVC design pattern explanation. The simple explanation about model (my interpretation, don't use it in exams) is something which represent the structure of data, and possess the logic to get and/or modify the data.

Usually, model's logic can be integrated with the controller (or view model), and the structure itself can be represented using data sets (for database, or xml documents for xml). So in most cases, developers really can ignore model and integrated it with the controller itself. So why is it needed to separate the model?

If we said about small application, it will be okay to ignore model, and integrate it with the controller at all. But what if we talk about large applications? It will be hell if we use data sets or xml documents itself. A slight change with the data structure, and you must search for every controller which used that data. Yeah I already said every controller, and if the application has so many controller, it will be a pain.

Not only that, in additional model can hold some logic that bound to data, so every controller used the data can have same behavior of the logic. Let's say that a request has some mechanics like discounts or so. Instead of put the logic in controller or database, we can put it in model. So in summary, I will say that the model is quite a handy tool for data management.
Post a Comment