As you probably are aware by now, MVC on its own tends to make me want to scream at developers that there is more to life than butchering models….
So I’ve come up with a fundamentally better way of developing. You CAN keep your components decoupled and still use MVC… Crazy I know. But I’ve had a brilliant idea in which this could in fact work and be far more appropriate for the scale that projects get now.
In the past, websites were really rather small. It was quite rare they had much more to do than process some forms go talk to a database for some dynamic data occasionally. There were some monsters of course such as ebay, amazon, search engines etc.. but generally speaking most companies’ online presence was rather small scale compared to today.
Today, web applications have grown exponentially due to the power of web languages and the fact they work with more standalone technologies and languages so well. In PHP this has led to a boom in MVC architectures so provide a pattern that allowed a scalable model led development. Object oriented development also enabled good programming practises to be used and therefore give web the scope it needed to grow. However, I think web applications have again outgrown their current trends…
Component based architectures are becoming more popular in PHP development, quite right too! MVC makes for a bit of a higgledy piggledy mess really when you think about it in most cases. Also you have to be really really strict with your OO practices as lots of people don’t seem to worry too much about models doing a lot of stuff they shouldn’t…..
Wouldn’t it be nice however, if your models were in fact representational of components instead of database tables?
CRAZY I hear you saying! However, what if you had an interface on your component with all your get, set, insert, update, delete, findBy etc instead of the DB adapter direct. So all your functionality is abstracted away from the MVC framework, using perhaps a pattern that is much more suitable for the purpose. Also, your component will serve all your platforms such as web, wap, api etc…. through one interface.
I’ll be building GA’s core with this architecture so updates soon…. Sorry for the completely brief post, this is a work in progress 🙂