SitePoint Sponsor

User Tag List

Page 2 of 2 FirstFirst 12
Results 26 to 34 of 34
  1. #26
    SitePoint Enthusiast
    Join Date
    Oct 2004
    Posts
    88
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by McGruff:

    Good candidates for a filter chain are items which do their own thing independently from anything else which is going on. In a perfect world the precise order in which they execute shouldn't matter (given only that some you might want to call before the client output and some after).
    So this could be the job of the system event handler:

    Front controller:

    PHP Code:

    ...........

    $B->MMOD_SYSTEM'SYS_PREPEND' ); 
    .............
    .............
    .............
    $B->MMOD_SYSTEM'SYS_APPEND' );

    ............. 
    Originally Posted by McGruff:

    There's actually a serious problem with the InterceptingFilter pattern - at least in my opinion. As commonly described, request-handling entities are often added here - ie things which make decisions about the logical flow. I think that's a bad design flaw which can lead to request-handling roles cropping up in more than one location. A good filter might be a magic quotes filter: check if magic quotes is on, remove if yes. A bad (request-handling) filter might be user-input validation. Detecting a bad request would lead to a 400 response whereas, with the magic quotes filter, it operates "silently" without affecting any other processing decisions.
    I see. It seems that this is rather a definition problem of what an intercepting filter is.

    Thanks for your reply. I must think about.

  2. #27
    simple tester McGruff's Avatar
    Join Date
    Sep 2003
    Location
    Glasgow
    Posts
    1,690
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Bear in mind that this is just my own take on InterceptingFilter, yet to be exposed to critical scrutiny. I've been meaning to post something for a while now, whenever I can grab some spare time to marshal my arguments.

    Still, although I've got a problem with InterceptingFilter as it is commonly described, I'd definitely want to keep some chains in there somewhere. Chain of Responsibility is very powerful in that you can drop items in and out without disturbing anything else. This can make future maintenance much easier.

    Quote Originally Posted by atu
    So this could be the job of the system event handler:

    Front controller:
    Yes: the FrontController would be the place to launch an InterceptingFilter. I've also seen people add the FC as one of the filters in the chain - see sticky MVC topic. That breaks the idea of moving request handling out of the filter chain, however (if you agree that's a good way to go).

    A good test to apply to a framework design is how easy is it to add and remove items such as input filters, authentication/authorisation, logging etc. Ideally you want to be able to add items common to all requests (or groups of requests) without having to copy-paste all over the place, as well as specifying custom "to do lists" for individual requests.

  3. #28
    SitePoint Enthusiast
    Join Date
    Oct 2004
    Posts
    88
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'm just at the beginning of learning mojavi but already asking me if it give sense to compare this framework with my own (smart). Or to say it in other words; Is it possible to compare smart with the mvc pattern? How to classify? I really have difficulties to detect the mvc pattern in smart. In mojavi, as far as i can understand, the view construct all the variables then push them to the template. In smart a template event pull the data from the action (model i think), which construct the variables. Some kind of reverse order. In mojavi one can pass in the url the focus on a module and action. In smart (the current version) a template can contain several events which can focus on different modules and actions.

  4. #29
    simple tester McGruff's Avatar
    Join Date
    Sep 2003
    Location
    Glasgow
    Posts
    1,690
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'm afraid I don't know anything about Mojavi.

    There's a lot of material on this forum about MVC - also something I don't really feel qualified to speak about.

  5. #30
    SitePoint Wizard silver trophy kyberfabrikken's Avatar
    Join Date
    Jun 2004
    Location
    Copenhagen, Denmark
    Posts
    6,157
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    you're right on the push vs. pull. the filosophy in mvc is that the view must be completely passive - hence you must push data to it, not pulling.

    i think you will find it difficult to compare on a 1:1 scale smart vs. mojavi. mojavi in it's nature is very focused on implementing the mvc-pattern. essential mojavi just manages the applications control-flow. it does other things too, but theese are sort of extra topping to the main course. smart isn't cut over the same lines, so some of the basic concepts just don't compare.
    however - that is not to say that this couldn't happen, but it would require some refactoring of your current system. it might do it good.

  6. #31
    SitePoint Enthusiast
    Join Date
    Oct 2004
    Posts
    88
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by kyberfabrikken

    ...... but it would require some refactoring of your current system. it might do it good.
    you are right. I'm working on the next version and will release it soon. I think this release has a more clear directory structure and may you can identify some mvc patterns. there are changes in the controllers and added prepend/append intercepting filter events.

  7. #32
    SitePoint Enthusiast
    Join Date
    Oct 2004
    Posts
    88
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by kyberfabrikken

    you're right on the push vs. pull. the filosophy in mvc is that the view must be completely passive - hence you must push data to it, not pulling.
    Are you shure? You should read the templateView doc at the wact site. Especially the wact pull mechanism in templates.

    http://wact.sourceforge.net/index.php/TemplateView

  8. #33
    SitePoint Wizard silver trophy kyberfabrikken's Avatar
    Join Date
    Jun 2004
    Location
    Copenhagen, Denmark
    Posts
    6,157
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    well yes, but wact uses declarative way of pulling data. the problem arises when using procedural code to do the same. your events could probably be seen as delarative btw. i'm not completely sure if i'm right on target with this one though ...

  9. #34
    SitePoint Enthusiast
    Join Date
    Oct 2004
    Posts
    88
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Smartframe 0.2.2a released

    The new Smart framework version is released. Still alpha, just for testing and criticize. You should take a look at the project web page.

    http://smart.open-publisher.net

    Whats new:

    - added filter event handlers, which run independent of the common event handlers
    - rebuild the directory structure
    - modify the front controller

    The public Front Controller

    PHP Code:
    <?php

        
    // Directed intercepting filter event (auto_prepend)
        
    $B->MMOD_SYSTEM'SYS_PREPEND' );

        
    // Broadcast init event to all registered event handlers
        
    $B->B'SYS_INIT' );

       
    // Directed authentication event to the module handler, 
       // which takes the authentication part
       
    $B->MSF_AUTH_MODULE'SYS_AUTHENTICATE' );

       
    // get the public view (template)
       
    include( $B->MMOD_SYSTEM'GET_PUBLIC_VIEW') ); 

       
    // Directed intercepting filter event (auto_append)
       
    $B->MMOD_SYSTEM'SYS_APPEND' );

       
    // Send the output buffer to the client
       
    ob_end_flush();

    ?>
    The prepend and the append filter events (add headers, detecting spam bots, trim with spaces, email obfuscating, ....) takes effect before and after the application logic.

    I hope this release clear up some confusions about the mvc pattern in Smart. Now the mvc experts can blow me away


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •