After all! What is this no-framework?

Most frameworks rely on the Hollywood principle: Don’t call us, we will call you! This is the root of all the problems. The classic MVC pattern is a great tool, but it is almost always implemented in conjunction with the Hollywood principle (Technically called IOC = Inversion of Control). This post explains a simple no-framework paradigm.

It’s a good idea to read this before reading further.

Most frameworks rely on the Hollywood principle: Don’t call us, we will call you! This is the root of all the problems. The classic MVC pattern is a great tool, but it is almost always implemented in conjunction with the Hollywood principle (Technically called IOC = Inversion of Control).  This post explains a simple no-framework paradigm.

Based on the theory above, here is what I mean by a no-framework:

  1. By all means, follow MVC pattern using either classes or simple file includes. Three different files for M, V and C. (Model, View and Controller) to separate the code into 3 logical parts for easy readability and maintainability (no more separation than this is really required).
  2. Include the necessary files in your view file as necessary and call the necessary functions at the top of the view file (this is slightly against MVC pattern because although small amount but some code from controller has crept in the view file) but never mind its simple to understand and teach (The MVC pattern is for us, we are not for the pattern). So it is good to modify a few concepts to fit the needs (Remember we are engineers with limited budgets and unlimited creativity and not scientists with unlimited budgets). Our target is to produce a usable product (forget about reusability – have you ever reused your view/models or controllers?) that is readable and maintainable (and also scalable).
  3. Use the “tile pattern” to implement the common parts of the web pages (header, footer, left, right, sidebar, etc.) Put them in separate files and include them where necessary. Most frameworks would not need you to include such things because they hide this from the developers but what is the point in hiding things that are going to ultimately be there? So a framework forces you to “see” what is not visible making it very difficult to understand for a new user. With our no-framework you will not need to imagine things – just keep simple principles in mind.
  4. Since there is no Hollywood overhead involved in our no-framework we have a scalable architecture because all we have is the overhead of PHP language itself – no more, no less.
  5. Now the advanced questions remain: What about Caching, Multilanguage support and other features that come free with the frameworks? The answer is simple: Learn those things (full stop). Implement them in your code (full stop). Learning these things is good for your health and also inevitable sometime in the future when your framework bites you (and when it is too late and difficult to dig through the framework to fix the weird issues). There is no escape, better face it from the beginning than shying away behind the complicated frameworks that promise great dreams in their feature list.

A few notes: The author is not against the frameworks which have worked great miracles in desktop and mobile applications arena because the interaction between objects is more complicated in those applications and the framework overhead is reasonably acceptable considering the great advantages offered. But this does not hold true in case of the web applications because of the very nature of the way HTTP protocol works. The protocol is simple and so the applications need not be complicated. Show me the most complicated page on the web (a webpage is always simple – it is either a form or a list of records or a simple combination of them). With one web request there is a simple cycle involved from request to the final HTML output delivered to the browser. KISS!

The best frameworks reside in the minds of the developer!

3 Comments

  1. Paul added these pithy words on January 3, 2010 | Permalink

    Reminds me of Rasmus’ post – http://toys.lerdorf.com/archives/38-The-no-framework-PHP-MVC-framework.html

    The main concern is that when you develop your own “no framework” you end up framework anyway, with code that you only understand. Hard to find developers for code that only you understand. Granted if you have the time and resources to properly document and standardize code, you can get around this… but most people can’t.

  2. Jayesh Kitukale added these pithy words on January 3, 2010 | Permalink

    @Paul
    Sorry I think I am not writing well enough. What I am trying to tell is that the main feature of any framework is the Callback mechanism which “hides” things. This is the main reason why frameworks are so tricky. If what I am doing is also called framework, then alright, I am just asking to make a “visible” framework where the framework does not hide anything. Everything is plain visible in just a few locations not several intricate web of folders and files. Most framework builders will not call such a framework, a framework at all because, according to them, the most important aspect that of hiding the common stuff will not be done in this no-framework.
    I hope I am clear enough now?

  3. Tim Lind added these pithy words on January 14, 2010 | Permalink

    Hey.

    I know exactly what you mean, in fact, I’ve spent a long time building a framework with the same desires, that it doesn’t do anything that you don’t actually see.

    You can have a “framework” that let’s you actually control and know every action that is taking place, instead of bundling actions together. This framework will provide you full control but still deal with all of the messy things so you only need to worry about the core concern.

    I have recently created a design that provides this and I’m really happy with it for my (usually very fussy) needs.

    I put up a quick preview of some of that “framework”, which ends up actually being more like an API, and I think that is the trick to achieving a powerful and easy to understand framework.

    http://timlind.posterous.com/greatest-little-database-framework

One Trackback

  1. abcphp.com on January 3, 2010

    After all! What is this no-framework?…

    Most frameworks rely on the Hollywood principle: Don’t call us, we will call you! This is the root of all the problems. The classic MVC pattern is a great tool, but it is almost always implemented in conjunction with the Hollywood principle (Technicall…

POST A COMMENT

Your email is never published nor shared. Required fields are marked *

*
*

HEADLINE

You could put something here. Edit this in bottom.php.

HEADLINE

You could put something here. Edit this in bottom.php.

TAG CLOUD