TIP: Use Markdown or, <pre> for multi line code blocks / <code> for inline code.
These forums are read-only and for archival purposes only!
Please join our new forums at discourse.kohanaframework.org
Thick apps / thin modules vs. thin apps / thick modules
  • While asking something similar in another topic and to show someone is still developing Hanami, i'm looking for some input about:

    thick apps / thin modules vs. thin apps / thick modules

    Scenario 1:

    thick apps / thin modules


    apps/
    frontend/
    controllers/
    blog.php
    ...
    backend/
    controllers/
    blog.php
    ...
    modules/
    blog/
    controllers/
    blog_demo.php
    models/
    blog_articles.php
    blog_comments.php
    ...


    Modules provide the basic working, models, maybe views. This is the way Kohana defines it's modules. This ensures that this module can shared through different Kohana apps. But as a Hanami module, it's required that the developer creates the front- and backend controller as well. While acting like the Kohana device "convention over configuration" a definition of a Hanami module is a Kohana module serving functionality, front- and backend controllers for the specific app and third dependencies.

    Scenario 2:

    thick apps / thin modules


    apps/
    frontend/
    controllers/
    blog.php // exentds Blog_Frontend_Controller
    ...
    backend/
    controllers/
    blog.php // exends Blog_Backend_Controller
    ...
    modules/
    blog/
    controllers/
    blog_demo.php
    blog_frontend.php
    blog_backend.php
    models/
    blog_articles.php
    blog_comments.php
    ...


    A blog module contains all stuff that belongs to a blog module. It can easily replaced for new versions or something, but its very Hanami specific while the module uses Hanami specific controllers/models/libs...

    In most cases the open source apps build with Kohana, i have seen, uses the first one. Is this the more DRY way?
  • I try to develop thin apps / thick modules by moving as much as possible into external modules that can be shared across different installations and applications. My application folder generally only contains the files which override the external module files.

    I find that subversion is particularly helpful in this as you can specify the "svn:externals" property to specify which modules to pull in from external svn repositories. I have a "core" module used by all my applications and various other modules that contain different features depending on what type of site I am building into my application which then has overrides for any thing that differs from the "standard" way they work. The www structure I use is:


    htdocs/application_name
    include/kohana/ (stable kohana src branch)
    include/kohana/kohana-modules (kohana-modules project stable modules branch)
    include/kohana/fail (my stable modules branch)
    include/other (other kohana modules not hosted in the other included repositories above)


    my index.php sets up constants to refer to the above paths in my config.php/$config['modules'] section

    possibly you could pull in hanami in a similar way

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion