SitePoint Sponsor

User Tag List

Page 1 of 2 12 LastLast
Results 1 to 25 of 38

Thread: Sample Project

  1. #1
    SitePoint Evangelist
    Join Date
    Jul 2001
    Location
    Michigan, USA
    Posts
    414
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Sample Project

    Just thought I'd throw an idea out there for all you advanced programmers. Feel free to ignore it

    I'm currently working at advancing my coding in general. I've started reading through famous Design Patterns. I'm definitely agreeing with the "You probably won't understand this book on the first reading. We didn't understand it when we first wrote it." At any rate, I'm continuing to read through it despite this just to see what I can get on the first run through.

    At any rate, I forgot where I was going with that, so I'll just move on to the point.

    I was curious if any of you vets out there would be willing to put some sort of well commented sample program with an explaination of what's going on that would be used to power some sort of small sized website. I haven't stumbled across any thorough examples; just a lot of text readings and mini code samples.

    Just throwing an idea out there. I'd be willing to help in any way that I could, though my OO deisgn knowledge is more or less non existant.

    Anyway, thanks for reading at least.

  2. #2
    Non-Member
    Join Date
    Jan 2003
    Posts
    5,748
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Umm... That is a good idea though for most members script snippets is all we can give as the script is propieriety ?

    Beside some of us [not me personally] do not want to give away our ''trade secrets'' which keep us in employment as I see it ?

    Anyways; It's a good idea, though one that I was thinking about was that have a member [Harry ?] give a plain english explamation about each Design Pattern there is with some workable PHP OOP ?

    Maybe an article on Site Point it's self eh ?

  3. #3
    Ribbit... Eric.Coleman's Avatar
    Join Date
    Jun 2001
    Location
    In your basement
    Posts
    1,268
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Dr Livingston
    Anyways; It's a good idea, though one that I was thinking about was that have a member [Harry ?] give a plain english explamation about each Design Pattern there is with some workable PHP OOP ?

    Maybe an article on Site Point it's self eh ?

    Isn't that what PHPPatterns is for?
    Eric Coleman
    We're consentratin' on fallin' apart
    We were contenders, now throwin' the fight
    I just wanna believe, I just wanna believe in us

  4. #4
    Non-Member
    Join Date
    Jan 2003
    Posts
    5,748
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well; Yes in fact that is although wouldn't it be better also if there were another source here at Site Point ?

    Harry does a great job with PHP Patterns and it's a valuable resource but there is all this discussion here in the Advanced PHP Forums though little debate or discussion about Design Patterns themselves either at PHP Patterns nor here at Site Point ?

    To me Design Patterns [and refactoring] is just as important as MVC yes ?

  5. #5
    Ribbit... Eric.Coleman's Avatar
    Join Date
    Jun 2001
    Location
    In your basement
    Posts
    1,268
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Very true...

    Maybe SitePoint should start a Design Patterns / Advanced Programming category...

    Maybe Harry would even share/syndicate his current articles with SitePoint?

    Would be cool, imho... and I agree, his site is lacking a discussion.. the commenting system doesn't do the articles justice at all
    Eric Coleman
    We're consentratin' on fallin' apart
    We were contenders, now throwin' the fight
    I just wanna believe, I just wanna believe in us

  6. #6
    Non-Member
    Join Date
    Jan 2003
    Posts
    5,748
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    current articles with SitePoint?
    Something like that would be great

    Either that or maybe Site Point could think about getting some input and contribution from some Design Pattern/Refactoring author's who've had popular books published ?

    In regards to solely PHP which I think would be a great introduction to these topics for many PHP folks...

    PHP5 is on the horizon folks and we do need something to increase the knowledge base on PHP in regards to more advanced development practices if PHP5 is to generate any real interest from big business IMO.

    As it stands at the moment; we're all sitting on our butts basically

  7. #7
    Ribbit... Eric.Coleman's Avatar
    Join Date
    Jun 2001
    Location
    In your basement
    Posts
    1,268
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I wish there were some type of 'PHP Standards'

    I know about that new thing Sebastian is working on, but I honestly don't like the idea..
    Eric Coleman
    We're consentratin' on fallin' apart
    We were contenders, now throwin' the fight
    I just wanna believe, I just wanna believe in us

  8. #8
    Non-Member
    Join Date
    Jan 2003
    Posts
    5,748
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ... And what would that new thing be ?

    But standards ain't going to help anyone if there is very few who could actually understand and develop the under lying technologies ?

    ie Design Pattern...

  9. #9
    Ribbit... Eric.Coleman's Avatar
    Join Date
    Jun 2001
    Location
    In your basement
    Posts
    1,268
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    http://www.sebastian-bergmann.de/PCOM/

    Looks a little confusing to me already.. not really sure how it works and what not...

    I really should start posting links in my posts when I talk about something :/
    Eric Coleman
    We're consentratin' on fallin' apart
    We were contenders, now throwin' the fight
    I just wanna believe, I just wanna believe in us

  10. #10
    Currently Occupied; Till Sunda Andrew-J2000's Avatar
    Join Date
    Aug 2001
    Location
    London
    Posts
    2,475
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    A good overview of design patterns can be found at: -
    These should get you started [img]images/smilies/smile.gif[/img]

    Edit:

    Quote Originally Posted by Tomaka
    Just throwing an idea out there. I'd be willing to help in any way that I could, though my OO deisgn knowledge is more or less non existant.
    Just Helping Tomaka; not you Zaire

    Last edited by Andrew-J2000; Oct 2, 2003 at 21:02.

  11. #11
    Ribbit... Eric.Coleman's Avatar
    Join Date
    Jun 2001
    Location
    In your basement
    Posts
    1,268
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You referring to me? I wasn't exactly talking about not understanding design patterns.. i was refering to PHPCOM
    Eric Coleman
    We're consentratin' on fallin' apart
    We were contenders, now throwin' the fight
    I just wanna believe, I just wanna believe in us

  12. #12
    Non-Member
    Join Date
    Jan 2003
    Posts
    5,748
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks AndrewJ 2000; Though the problem isn't so much about lack of resources as such but more of a lack of PHP specific resources yes ?

    I know of a few sites myself on Design Patterns but alas they're geared for Java development

    --EDIT--

    Your second link does have PHP Design Patterns... That's a start I suppose

  13. #13
    Ribbit... Eric.Coleman's Avatar
    Join Date
    Jun 2001
    Location
    In your basement
    Posts
    1,268
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Did you see my link for the PHPCOM Dr. L?
    Eric Coleman
    We're consentratin' on fallin' apart
    We were contenders, now throwin' the fight
    I just wanna believe, I just wanna believe in us

  14. #14
    SitePoint Zealot sleepeasy's Avatar
    Join Date
    Sep 2003
    Location
    Bristol, UK
    Posts
    145
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Zaire
    http://www.sebastian-bergmann.de/PCOM/

    Looks a little confusing to me already.. not really sure how it works and what not...

    I really should start posting links in my posts when I talk about something :/
    After a very brief look, this looks similar to something I've implemented for my current project. I've called it IOC - Inter-Object Communication. I use it so that different object can respond to events in completely seperate objects.

    ($ioc is a global instance of IOC class)

    This registers an action with IOC.
    PHP Code:
    $ioc->notifyListeners($action$parameters); 
    Objects that want to respond to the action simply call
    PHP Code:
    $ioc->listenFor($action$this); 
    and implement one function: iocNotification($action, param = NULL)

    When the action is registered all listening objects are notified by calling their iocNotification method, and they can take appropriate action.
    Always open to question or ridicule

  15. #15
    Non-Member
    Join Date
    Jan 2003
    Posts
    5,748
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Did you see my link for the PHPCOM Dr. L?
    Thanks Zaire... Still reading

  16. #16
    Non-Member
    Join Date
    Jan 2003
    Posts
    5,748
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    PHPCOM:

    Looks interesting though I'm trying to think why I'd be needing to implement this sort of thing ?

    Maybe between yourself and Sleepeasy you can give me a clue ?

    Some examples maybe ?

    On this point I am thinking that I need a class that would kind of act as a go - between for the Controller and View Layers [MVC] ? I have some variables generated from an action file from the Controller yes ?

    Well, the View needs access to these, such as page title, a table heading, etc etc. At the moment I have the Controller 'Push' these variables to the View...

    PHP Code:
    $view $action['PAGE_ACTION'].'View'
                
    $this -> view = & new $view;
                
    $this -> view -> Push(& $action['MODULES'], 'modules');
                
    $this -> view -> Push(& $action['PAGE_TITLE'], 'title');
                
    $this -> view -> Push(& $action['PAGE_ACTIVE'], 'active');
                
    $this -> view -> Push(& $action['PAGE_ACTION'], 'action');
                
    $this -> view -> Push(& $action['PAGE_HEADING'], 'heading'); 
    Which is messy as the variables to Push vary between Controllers, so maybe if I set up another class, a Container [?] which would then Pull the required variables which are then only dependent on what the View requires...

    ... The View Layer would dictate to the Container what to Pull from the object $action yes ?

    As apposed to the Controller Pushing all of the $action's variables.

    If you follow me ?

  17. #17
    Ribbit... Eric.Coleman's Avatar
    Join Date
    Jun 2001
    Location
    In your basement
    Posts
    1,268
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I don't really uderstand the PHPCOM thing atm...

    Honestly.. the way me and Mike do things is through planning and a set of standards for ourselves.
    Eric Coleman
    We're consentratin' on fallin' apart
    We were contenders, now throwin' the fight
    I just wanna believe, I just wanna believe in us

  18. #18
    SitePoint Evangelist
    Join Date
    Jul 2001
    Location
    Michigan, USA
    Posts
    414
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Dr Livingston
    Thanks AndrewJ 2000; Though the problem isn't so much about lack of resources as such but more of a lack of PHP specific resources yes ?
    Yeah, the Doc is right here. I mean, design patterns for other languages are plentiful, and yes, even though they apply to PHP, I just a start to getting it conceptualized, which is why I was hoping we could get some sort of a project going here. Heck, nothing complex really. A simple news posting script done with some proper OOP and plenty of commenting would do completely.

    I will definitely be reading this links, especially the second one. Thanks for the info guys!

  19. #19
    SitePoint Member jcesar's Avatar
    Join Date
    Sep 2003
    Location
    Colombia
    Posts
    21
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by sleepeasy
    After a very brief look, this looks similar to something I've implemented for my current project. I've called it IOC - Inter-Object Communication. I use it so that different object can respond to events in completely seperate objects.
    PCOM is for registering componets to IDEs and Code Editors. It's more like the RegisterComponent interface in Delphi or the Extension API of Dreamweaver.

    Currently PHPEdit and ActiveState's IDE (Don't remember it's name) use diferent/incompatible interfaces, the effort is to standarize this API so we can write one component that works for multiple editors.

    I would like to know more about your IOC library. It's ment to deliver notifications from open Sockets or so?

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

    Quote Originally Posted by jcesar
    ActiveState's IDE (Don't remember it's name)
    Komodo .

    As for PHP patterns I think the correct home is http://www.phppatterns.com/ rather than sitepoint.

    For getting patterns articles actually written, well it's all up to us. If you take the GOF book (23 patterns), the Fowler book (51 patterns), his upcoming one (60ish) and the Data Access Patterns (40+) book that's a total of 174+. They take time so there is no way that Harry can do it alone.

    Although so far I have contributed the princely sum of one so I hardly have a right to complain .

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

  21. #21
    Non-Member
    Join Date
    Jan 2003
    Posts
    5,748
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    They take time so there is no way that Harry can do it alone.
    No one expected Harry to do the job himself;

    PHP Patterns does help and yes, we do need this site but I'm thinking that if Site Point could get involved then that would be a bonus wouldn't it ?

    On this point I'm not so much talking about this Forum but more from the point of view of articles yes ?

    Umm... ??

  22. #22
    SitePoint Zealot sleepeasy's Avatar
    Join Date
    Sep 2003
    Location
    Bristol, UK
    Posts
    145
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by jcesar
    PCOM is for registering componets to IDEs and Code Editors. It's more like the RegisterComponent interface in Delphi or the Extension API of Dreamweaver.

    Currently PHPEdit and ActiveState's IDE (Don't remember it's name) use diferent/incompatible interfaces, the effort is to standarize this API so we can write one component that works for multiple editors.

    I would like to know more about your IOC library. It's ment to deliver notifications from open Sockets or so?
    First, just to avoid any confusion/mis-understandings I should mention that I am not developing an IDE or anything and I did not develop IOC for IDE components. In my earlier post when I said:
    After a very brief look, this looks similar to something I've implemented for my current project.
    I was referring to the event handling. I should have made this clearer, Sorry.

    About what you said about sockets: It could be used for something like that, yes, although I haven't tested it - I've only used it for trivial things so far.

    If you want to know more about my IOC, the following is a short description.

    I'm developing what can best be described as an Application Workflow Engine - I hope this is an appropriate description because it sounds pretty cool, and has a cool abbreviation - AWE . Anyway...

    I use IOC so that the different Objects (applications) being controlled by the AWE can trigger events, and any other obects that are interested in the event can respond to it. Each Object has no idea what other objects are running or are about to start, so IOC is just a way for an Object to say "Hey, I just did this, tell anyone who's intetested" and other objects can say "Tell me when x happens or if x has happened already, because I have to do this when it does".

    A very trivial example that could probably be done without IOC:
    • The AWE starts each application...
    • Menu application starts, asks IOC to notify it when it receives an USER_LOGGED_IN message.
    • Menu application carries on executing and creates its menu items [edit: suitable for a user that is not logged in]
    • Login_Processor application starts, uses IOC to register the USER_LOGGED_IN event because a user succesfuly logs in.
    • IOC notifies the Menu application that the USER_LOGGED_IN event has occured.
    • Menu application changes its menu items by removing the 'Login' and 'Register' items and adding a 'Logout' item [edit: making the menu suitable for a user that is logged in]
    • UsersOnlineCounter application starts, asks IOC to notify it when it receives an USER_LOGGED_IN message.
    • IOC notifies the UsersOnlineCounter application that the USER_LOGGED_IN event has occured.
    • UsersOnlineCounter application gets it's data from a cached XML file on disk but also updates the figures increasing the number of members that are online and decreasing the number of guests.
    • AWE retieves each application's output and renders the page.


    When the project I'm working on matures I'll be able to put IOC to better use. I'm also working on a variant of IOC called pIOC that will allow application objects to communicate between page requests - but this is at a very early stage.

    Anyway, that's that... any comments, questions, crtiscisms welcomed.
    Last edited by sleepeasy; Oct 4, 2003 at 21:10.
    Always open to question or ridicule

  23. #23
    Non-Member
    Join Date
    Jan 2003
    Posts
    5,748
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hello SleepEasy, some interesting idea's there

    ...so that the different Objects (applications) being controlled by the AWE can trigger events...
    Particularly this one

    From what your describing basically allows then all the objects to be able to talk to each other, is what your saying ?

    Would be worthwhile to looking into this idea some more as I see it... Given me some idea's of my own actually

    When I've thought some more I'll get back to this thread okay ?

  24. #24
    SitePoint Zealot sleepeasy's Avatar
    Join Date
    Sep 2003
    Location
    Bristol, UK
    Posts
    145
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Dr Livingston
    From what your describing basically allows then all the objects to be able to talk to each other, is what your saying ?
    Yeah, exactly that. It's a rather simplistic conversation though... i mean... right now all my IOC's are "one way conversations". But it is quite possible for objectA to send a message, objectB would then receive notification of this message take appropriate action and then send another message, which would (coincidentally) notify the first objectB and so on...

    I'm having a hard time describing exactly how it works... I hope you get the jist of it tho.

    I think I need some sleep
    Quote Originally Posted by Dr Livingston
    Would be worthwhile to looking into this idea some more as I see it... Given me some idea's of my own actually
    Cool. If you need some more information just ask.
    Quote Originally Posted by Dr Livingston
    When I've thought some more I'll get back to this thread okay ?
    No... hehe just kidding

    I look forward to hearing any ideas you have.
    Always open to question or ridicule

  25. #25
    Non-Member
    Join Date
    Jan 2003
    Posts
    5,748
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    No... hehe just kidding
    That's understandable I suppose... Complex algorithms and incomplete thoughts and idea's are abound in this thread from me;

    It's just some more brain cells


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
  •