You Got Your View in My Controller

My number one complaint about every MVC framework I have seen so far: The controller is dependent on or otherwise directly tied to the View. While consistency for the sake of being consistent my be a worthy cause, being loosely coupled is more important. Your view mechanism may not fit every situation. If you have a hard dependency your upgrade path is all or nothing, break everything or break nothing. This becomes the foundation for clever unsupportable code.

A ideal controller would simply handle routing requests and responses and coordinate the use of the proper view with it’s model. (@todo) Who cares if you are using Smarty, a __toString() method or hand jamming inline PHP. What if you want to integrate a different model? What if your application develops and you cultivate a better method of MV combination with your business logic? Why nail your feet to the floor for the sake of forcing yourself to be consistent. If you cant be consistent, you should concentrate on that fundamental flaw in your habits and fix it, because you will be constantly tripping over it regardless of what your framework does for ou.

Advertisements
You Got Your View in My Controller

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s