SitePoint Sponsor

User Tag List

Page 2 of 2 FirstFirst 12
Results 26 to 39 of 39
  1. #26
    SitePoint Enthusiast
    Join Date
    Jul 2004
    Location
    In front of my computer
    Posts
    96
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well my answer was maybe a little overpessimistic. pawelik, I didn't wanted to mean your work is no good ! It's just that the efforts are disparate. It seems like some of the SitePoint gurus are interested, you started the Pico port, I just did a try-hack-example.

    What are the things left to do ? Relationship caching, lazy dependencies and lots of example to show how to use pico ?

    If I understand well, you're the only who's working on this project. Would you like me to setup a webspace so that other people can join the development and newcomers get the status of the project ?

    Gogogo !
    participate to the best Php Wiki
    my blog ...

  2. #27
    SitePoint Enthusiast
    Join Date
    Jan 2005
    Location
    Warsaw, Poland
    Posts
    27
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by zimba
    It's just that the efforts are disparate. It seems like some of the SitePoint gurus are interested, you started the Pico port, I just did a try-hack-example.
    Yes, You are right, our efforts are too disparate.

    Quote Originally Posted by zimba
    What are the things left to do ? Relationship caching, lazy dependencies and lots of example to show how to use pico ?
    From my point of view, the roadmap is like:

    - lazy including
    - API Doc
    - User Doc

    That's all. I'm done with SetterInjection. Just need some time to clear up tests and commit it.

    But the most important is to try include Pico in real, open source project (like WACT) to seatle the disign. I think it's to early to declare DI as a general programmin technique for PHP. Let's check how it could work inside framwork. I'll post sth longer about it leater on.

    Quote Originally Posted by zimba
    If I understand well, you're the only who's working on this project. Would you like me to setup a webspace so that other people can join the development and newcomers get the status of the project ?
    Basicaly, I'm the only one working on this project. But, this all wouldn't be possible without great feedback from sweatje and the whole SP forum community.

    Talking about webspace: I would like to have project hosted on codehouse, while I think it's OK to have all the ports in one place (user documentation!). But it would be great to have WIKI for sketching user doc. Could You set-up this?

    Cheers,
    pawelik

  3. #28
    SitePoint Enthusiast
    Join Date
    Jul 2004
    Location
    In front of my computer
    Posts
    96
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by pawelik
    From my point of view, the roadmap is like:

    - lazy including
    - API Doc
    - User Doc
    Well, for performance I think it's really important to have dependency caching. It would replace the actual eval("new Object(params...)"); part with a generated-php-file that can be included.

    Quote Originally Posted by pawelik
    But the most important is to try include Pico in real, open source project (like WACT) to seatle the disign. I think it's to early to declare DI as a general programmin technique for PHP. Let's check how it could work inside framwork. I'll post sth longer about it leater on.
    Yeah, I still have to do my Mojavi implementation

    Quote Originally Posted by pawelik
    Talking about webspace: I would like to have project hosted on codehouse, while I think it's OK to have all the ports in one place (user documentation!). But it would be great to have WIKI for sketching user doc. Could You set-up this?
    Ok, I have two domains : oree.ch and g-hosting.ch . I'll get my sharedhost this weekend or early next week. Do you have any preferences for a sub-domain ?
    participate to the best Php Wiki
    my blog ...

  4. #29
    SitePoint Enthusiast
    Join Date
    Jan 2005
    Location
    Warsaw, Poland
    Posts
    27
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,

    Once again, thnx for the time Youíve spend playing with Pico and Your remarks.

    Quote Originally Posted by sweatje

    Started with a "Model" class which needs an ADOdbConnection object passed to it in the constructor. I had a function acting as a parameterized factory for these connections, so it seemed I needed a proxy class which would take my function parameter as a constructor argument, create the connection and proxy calls to it.
    Yes, there is a need for a proxy class, as we are moving toward more OO design. What I have in my framework is the DBConnection class, witch wraps ADODBconnection, not exposing directly any of itís original methods. The point here is not to tight Your app to the ADODB forever. With the additional layer from the DBConnection class I can think of switching to Creole or even PDO, without effecting others parts of my application. I can post this class if anyone is interested.

    Quote Originally Posted by sweatje

    Next, we need to have our "Model" class automatically accept this connection from the PicoContainer.
    After a short look at Your model class and the ĎgetPlantsí method I can figure out, that You are doing 2 things here: getting actual result set and (eventually) caching it. If You have, letís say, hundred of data-getting methods (not a so big number for a sophisticated app) , You have to add caching support for every method-call. I think it would be better to move caching features into another class that decorated original model class. With Pico You can have regular model classes (without caching) and turn-on caching on per-model class basics, without writing a single line of code! It all becomes a matter of components registration.
    I donít know Your code so Iím not perfectly sure if it works for You. Let me know, what do You think about this. I could post code examples if You are interested in.

    Quote Originally Posted by sweatje
    Also, so far so go. Next step was to integrate with WACT views and controllers. We have to have a way to have a WACT controller do lazy initialization but know enough about the pico container to ask for it to initalize the view.
    I was trying to get my head around WACT during the weekend, but unfortunately - couldnít grasp all the concepts. Looking at Your code it seems that there should be an easier way to write controller / view part of the code. Pico should be less intrusive, that is Ė donít require as to write the whole bunch of proxies. Please, give me couple of days to get familiar with WACT. Iíll try to come back with a solution for Pico / WACT integration.

    Quote Originally Posted by sweatje
    It seems like it would be nice to have a component adapter which could include the source file if the class was not defined, similar to the WACT Handle class.

    It looks like Pico could play a role of Handler class, providing lazy inclusion mechanism. I had a look at Handler class and ResolveHandle function and I canít figure out why we have both with the similar code? Is it the part of the system which should be refactored?

    Anyway, Iím almost done with a LazyIncludingCA. I need a week or so to put it all together (now Iím refactoring unit tests and writing API doc) , then I let You know when the new version is available in the CVS repository. Meantime Iíll try to dig into WACTís details.

    Thank You for all the bug reports / comments / patches. Iíll certainty apply all the modifications You suggested.

    Cheers,
    pawelik

  5. #30
    eschew sesquipedalians silver trophy sweatje's Avatar
    Join Date
    Jun 2003
    Location
    Iowa, USA
    Posts
    3,749
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by pawelik
    Anyway, Iím almost done with a LazyIncludingCA. I need a week or so to put it all together (now Iím refactoring unit tests and writing API doc) , then I let You know when the new version is available in the CVS repository. Meantime Iíll try to dig into WACTís details.
    One problem I rant into with Pico was it looped over all the adapters and raised reflection exceptions if the classes were not present. I did not have time to dig back through to figure out the whys of this, but the net result was I had to include all of my action classes on every run through, even if they were not going to be used

    Hopefully you will come up with a better method and show me where I went wrong

  6. #31
    eschew sesquipedalians silver trophy sweatje's Avatar
    Join Date
    Jun 2003
    Location
    Iowa, USA
    Posts
    3,749
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Say you have an interface
    PHP Code:
    interface iRequestHash {
      public 
    hasKey($key);
      public 
    get($key);

    which you want to require for
    PHP Code:
    class Action1 {
      public function 
    __construct(iRequestHash $post) {}
    }
    class 
    Action2 {
      public function 
    __construct(iRequestHash $get) {}

    How do you tell Pico that most of the time you want to pass the component registered as "Post", but for Action2, you want to have the component registered as "Get" instead?

  7. #32
    SitePoint Enthusiast
    Join Date
    Jan 2005
    Location
    Warsaw, Poland
    Posts
    27
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by zimba
    Well, for performance I think it's really important to have dependency caching. It would replace the actual eval("new Object(params...)"); part with a generated-php-file that can be included.
    In the current design itís not necessary to cache dependencies. Why? Because most components will live in a CachingComponentAdapter, it means it will be created only once and itís dependencies will be evaluated only once. Iíll try to profile the code ASAP but I wouldnít bother with the too much performance at the moment. You know: ďPremature optimization is the root of all evilĒ. You donít know which part needs tuning, before You use a profiler.

    Quote Originally Posted by zimba

    Ok, I have two domains : oree.ch and g-hosting.ch . I'll get my sharedhost this weekend or early next week. Do you have any preferences for a sub-domain ?
    pico ? ;-)

    Cheers,
    pawelik

  8. #33
    SitePoint Enthusiast
    Join Date
    Jan 2005
    Location
    Warsaw, Poland
    Posts
    27
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by sweatje
    One problem I rant into with Pico was it looped over all the adapters and raised reflection exceptions if the classes were not present. I did not have time to dig back through to figure out the whys of this, but the net result was I had to include all of my action classes on every run through, even if they were not going to be used

    Hopefully you will come up with a better method and show me where I went wrong
    Yeeep, this is an ďexpectedĒ behavior. Pico is trying to dynamically wire-up all the necessary components, based on Reflection meta-info. So, here we get to the dynamic nature of PHP and itís differences from Java. We need LazyIncludingCA for this.

    Yesterday I finished it! Itís working now, can do everything Handle class from WACT could and itís much more flexible. Let me clear up the code over the weekend, so I could commit it in Monday.

    Cheers,
    pawelik

  9. #34
    SitePoint Enthusiast
    Join Date
    Jan 2005
    Location
    Warsaw, Poland
    Posts
    27
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by sweatje
    How do you tell Pico that most of the time you want to pass the component registered as "Post", but for Action2, you want to have the component registered as "Get" instead?

    Register default component with itís class name, alternative component with the other name, and provide hint (parameter) for the alternative implementation. Please, have look at the following test:

    PHP Code:
    function testsweatjeQ1()
        {
            
    $pico = new DefaultPicoContainer();
            
    $pico->registerComponentImplementation('Touchable','SimpleTouchable');
            
    $pico->registerComponentImplementation('AlternativeTouchable');
            
    $pico->registerComponentImplementation('SeveralDependanciesWithInterfaces','SeveralDependanciesWithInterfaces',array('alternativeTouchable' => new BasicComponentParameter('AlternativeTouchable')));
            
            
    $ci $pico->getComponentInstance('SeveralDependanciesWithInterfaces');           
            
    $this->assertNotNull($ci);    
            
        } 
    Cheers,
    pawelik

  10. #35
    SitePoint Enthusiast
    Join Date
    Jan 2005
    Location
    Warsaw, Poland
    Posts
    27
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,

    Iíve just committed couple of files, including LazyIncludingComponentAdapter. Itís similar to WACTís Handler class, but can take full advantage of DI.

    LazyIncluding is a kind of DecoratingCA, so You can wrap any other CA to achieve lazy including effect. Iíve also modified MutablePicoContainer interface, adding new method:

    PHP Code:
    public function registerComponentImplementationWithIncFileName($includeFileName$componentKey$componentImplementation ''$componentParams = array()); 
    So now You have 2 ways of registering LA component:

    PHP Code:
    $pico->registerComponent(new LazyIncludingComponentAdapter(new ConstructorInjectionComponentAdapter('LazyIncludeModel'),'lazyincludemodel.inc.php')); 
    or simply

    PHP Code:
    $pico = new DefaultPicoContainer();
            
    $pico->registerComponentImplementationWithIncFileName('any.filename.inc.php','AnyNonIncludedClass'); 
    In the second case Pico will automatically create LICA and will wrap CA obtained from factory.

    Sweatje, Iíve also committed all the changes You have suggested. Still struggling with WACTÖ

    Cheers,
    pawelik

  11. #36
    eschew sesquipedalians silver trophy sweatje's Avatar
    Join Date
    Jun 2003
    Location
    Iowa, USA
    Posts
    3,749
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks Pawelik, I will look it over soon.

    One thing I worry about on the lazy include is what I mentioned in post#30 above: if you are going to have to have it included in order to use reflection on it, what do you gain by having the lazy inclusion? My purpose for using lazy inclusion is that some passes through the script will never access the object, and therefore never need to include the file. The design of Pico seems to require touching each object configured in the container, and therefore you are only "lazy including" a few lines later in the script, not "lazy including" perhaps never.

    Do you follow my concern? Am I thinking correctly here with regards to Pico?

    Regards,
    Jason

  12. #37
    SitePoint Enthusiast
    Join Date
    Jan 2005
    Location
    Warsaw, Poland
    Posts
    27
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by sweatje

    Do you follow my concern? Am I thinking correctly here with regards to Pico?
    Hi,

    Yes, I know what You mean, but donít worry. Problem from the first release has been removed. Now, Pico will use reflection only if there is class definition included. So, if there is no definition, Pico will look up dependent objects by checking:

    1) If there is parameter supplied,
    2) If there is component registered under dependent class name

    Actual include is delayed to the moment of component creation (calling getComponentInstance method). Itís also true for all the depended components. We can imagine registering all the components as LA and this way we should manually include only Pico classes! Please, download the latest version from CVS. Problem described in post #30 should vanish :-)

    Cheers,
    pawelik

  13. #38
    SitePoint Enthusiast
    Join Date
    Jul 2004
    Location
    In front of my computer
    Posts
    96
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by pawelik
    But it would be great to have WIKI for sketching user doc. Could You set-up this?
    Here it is :

    http://pico.g-hosting.ch/pmwiki.php

    I've just installed it and still have some things to do :
    * Install an anti-spam tool
    * Adapt the design to codehouse ?
    * Add a redirect from / => /pmwiki.php

    But you can already go ahead and start typing. Nothing will be erased.

    Cheers,
    ... zimba
    participate to the best Php Wiki
    my blog ...

  14. #39
    ********* Victim lastcraft's Avatar
    Join Date
    Apr 2003
    Location
    London
    Posts
    2,423
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Hi.

    Just wanted to ask how the project is progressing.

    yours, Marcus
    Marcus Baker
    Testing: SimpleTest, Cgreen, Fakemail
    Other: Phemto dependency injector
    Books: PHP in Action, 97 things


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
  •