
Episode 10 · Season 16
Model-View-Controller : A Pattern Based on Functional Area
About this episode
The Model-View-Controller pattern is one that is common and often seen in frameworks. It provides us with a nice place to "hang" our code.
The Model-View-Controller Pattern Defined
We have another pattern that contains three parts. In this case, we have the model, the view, and the controller. These each has an area of functionality they contain and are intended to act without regard to the other areas. The effect is not unlike other patterns that divide and delegate functionality. The MVC pattern divides by interaction with a user. We have the View that displays information to the user. Then, we have the Controller that handles input. Finally, we have the Model that addresses the core functionality and data.
Clearly Defined Boundaries
The power of this pattern is that we can focus on the work at hand. We trust that the other areas will be properly designed and implemented. This approach is useful in many cases. However, it becomes almost invaluable in modern software solutions where there are numerous specialists involved in a given solution and as many technologies. We also get to detach application logic from the interactions. That allows us to have multiple delivery devices for our application and focus on each. This pattern is perfect for the solutions where you need a web interface, and a mobile device, and a watch. We also are free to add devices in the future without having to touch the core functionality. Not only is this valuable for saving implementation time, it allows us to provide major updates without risk of breaking the core code. We also reduce the regression test load for our changes and can focus those on the updated areas.Challenges
The model-view-controller pattern suffers from many of the weaknesses we see in other delegation patterns. The design and implementation must be done with the intention of placing code in the correct area. It is not uncommon to see core logic in the view or the controller. Likewise, the code to generate the view needs to be completely separate from the controller. Overlap of code across the layers can break the entire pattern and render it useless for our purposes.More from Develpreneur: Become a Better Developer and Entrepreneur
A handful of people love your MVP. Their suggestions keep coming, and AI helps you turn those requests into working features quickly. The product is growing. Whether it is growing in the right directi…
Your team can generate an interface faster than ever. Meanwhile, customers are still staring at confusing error messages, waiting for pages to load, and trying to figure out what happens after they cl…
After a year of deadlines, long hours, and projects that seemed determined to last forever, Thanksgiving offers a chance to pause and enjoy what all that effort has made possible. In this Thanksgiving…
The holiday is almost here, but your brain is still at work. There is something to finish, something to check, and probably something you could squeeze in before everyone arrives. Closing the laptop s…
Building a successful business requires more than developing a great product. As companies grow, they face new challenges involving customer expectations, operational efficiency, financial decisions,…