Federico Cargnelutti

Simple is better than complex. Complex is better than complicated. | @fedecarg

Frameworks vs Libraries

with 4 comments

David Otton wrote:

Since the publication of Pragmatic’s Ruby on Rails book, the industry has fallen in love with frameworks. Because Rails wrapped up several perfectly sound techniques in one easy-to-use package, people who learnt it were, almost incidentally, learning a solid web development pattern. Add a dash of silver bullet marketing, and its no surprise many of them rushed to re-implement it in their native languages. PHP in particular has spawned a ridiculous number of variations on the theme.

Continue reading: Frameworks vs Libraries in PHP

Written by Federico

August 10, 2008 at 1:53 am

Posted in Frameworks, PHP

4 Responses

Subscribe to comments with RSS.

  1. If you’re looking for a framework that support most enterprise requirements like PAC a.s.o take a look at http://adventure-php-framework.org/Page/001-Home !
    The page is currently re-designed, so in a week or two it’ll be more user friendly (and more sexy ;).
    Of course, if a framework supports most features out-of-the box and comes with a PAC-like architecture it becomes automatically more complex and harder to deal with.
    But if you implement features where you need multiple designs for various languages or simply want to reuse your already implemented modules take a look at it.

    I sadly cannot comment on Davids blog post, so I did here – hope that’s no problem ;).

    Questions or suggestions?

    Alexander Schmidt

    August 10, 2008 at 10:44 am

  2. Thanks for the link. How is the module directory structured and how are the modules managed and coordinated?

    Federico

    August 10, 2008 at 12:29 pm

  3. apps/
    ..modules/ (Directory that contains the modules shipped with each release)
    ….comments/
    ….guestbook/
    ….kontakt4/
    ….pager/
    ….socialbookmark/

    The modules folder contains modules based on the core and tools components that are delivered with each release (e.g. guestbook, contact form) or that are implemented by any developer of your team to enrich your web page or application.

    The framework works basically with the DOM. if you want to include a module/template/whatever you have to announce for example a controller your template:

    <meta name=”DC.Date” content=”" />

    This will call the “website_v1_controller” which will look like this:

    class website_v1_controller extends baseController
    {
    function website_v1_controller(){
    }

    function transformContent(){
    // Set placeholder “Date”
    $this->setPlaceHolder(’Date’,date(’Y-m-d’));
    }
    }

    Note: PHP4-Code

    Now, to include an implemented module you simply import its “design” which is the root html/xml file of your module. For example:
    you want to include a “comment” module into your page:
    The only thing you have to do is add this markup to your existing html:

    The framework will now automatically create a new DOM-Node which contains your module.
    As you can see there is always a namespace attribute which results in a path.
    Every folder under the apps/ folder can be addressed like this.
    The comments module folder structure looks like this:

    modules/
    ..comments/
    ….biz/
    ….data/
    ….pres/
    ……documentcontroller/
    ……..templates/
    ……….comment.html

    This gives you freedom, you can store your module wherever you want, anyway you want. Isn’t this wonderful? :)

    Modules (or other DOM-Nodes) can “listen” to URL parameters, and/or can be controlled by parameters.

    I hope this is the answer to your question.

    The Page is also available in English.

    Alexander Schmidt

    August 11, 2008 at 9:58 am

  4. Very interesting, thanks Alexander.

    Federico

    August 11, 2008 at 10:54 pm


Leave a Reply