Jump to content

Jenk

Members
  • Posts

    778
  • Joined

  • Last visited

    Never

Posts posted by Jenk

  1. you are loading alot of unnecessary data whenever someone goes to the page.

     

    the only way I can see that this would benefit you, is if your page is controlled with AJAX

     

    Otherwise, I would put everything in their own modules and include them, that way you only display what you need when you need it.

    AJAX has absolutely nothing to do with this topic.
  2. i am, that's my point, no need for a registry pattern.

    So what happens if you need to change your database class? Oops! You've got lots of finding/replacing to do!

     

    and on platforms that are stateful (i.e. not PHP) the registry is also much more usefull than a singleton, because it can be maintained within the session, and as it's nature is to maintain single instances of objects, it allows you to create instances unique to each session, but maintain the same "singleton" effect.

  3. If these settings aren't user specific there is no point storing them in the $_SESSION array. Sessions are specifically designed to store data relating to a particular user.

    Almost, they are specific to the currently active session. Users change within the same session.
  4. Singletons are restrictive, and can (but don't neccessarily do) lead to problems later in application life. Just be more disciplined and only instantiate the object once if you want to maintain only once instance.

     

    As for the variable/object name argument (which has already been addressed I see,) you are mistaken. An example:

     

    <?php
    
    $foo = new db();
    
    function foobar ($bar) {
      $bar->connect();
    }
    
    foobar($foo);
    ?>

  5. You either use MVC, or you don't. You don't have to use anything. MVC is a design pattern, a guide for a commonly occuring situation or scenario. If you are setting out to design an application with MVC, you have already caused yourself problems as you do not yet know if MVC is right for your situation.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.