SitePoint Sponsor

User Tag List

Results 1 to 15 of 15
  1. #1
    SitePoint Enthusiast
    Join Date
    Aug 2004
    Location
    michigan
    Posts
    26
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    a learning proposal for us oop newbies

    i've lurked here several months, and have avoided posting, but the "how do you guys know it so well" post has prompted me to action...

    i am another one where the oop light has not clicked on yet. i understand that all bicycles have handlebars, etc, but still applying the concept to my real-world application eludes me. php coding is not my day job (i'd starve), so it's been easy to muster along with what i have.

    anyway, to my proposal. i maintain the records for my golf league at www.calvinmitcham.com/golf/. the php scripts there do get the job done for the 32 golfers, but in you folks' eyes, it is going to sound horrible...

    hard-coded to postgres;
    no objects except for the awesome jpgraph graphing library;
    ZERO error handling;
    tight, tight integration of logic and presentation (heck, i can go in and out of php four times in one line);

    ok, so i still haven't proposed anything... the proposal is that we rebuild the system on space i have at www.dotgeek.org. we start simple, and we don't continue till you real php coders approve, and i understand it. i guareentee that when i understand it, all us newbies will understand it.

    anyone interested?

    calvin.

  2. #2
    Non-Member
    Join Date
    Jan 2004
    Location
    Planet Earth
    Posts
    1,764
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Like the idea, though 2 points,

    1) Personally, I have little time,
    2) Something like this has been attempted before on these forums, and though it was a success to a certain point, I feel that it never really reached the finish line as the thread in question hasn't had any new discussions for a while

    Even though I can't actually help you, I'm sure a few folks will be willing to look more at your ideas though

    Good luck btw

  3. #3
    ********* 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 cmitcham
    anyone interested?
    Yes, but are you willing to battle on to the bitter end?

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

  4. #4
    SitePoint Zealot
    Join Date
    Jul 2003
    Location
    Los Angeles
    Posts
    199
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by cmitcham
    i've lurked here several months, and have avoided posting, but the "how do you guys know it so well" post has prompted me to action...

    i am another one where the oop light has not clicked on yet. i understand that all bicycles have handlebars, etc, but still applying the concept to my real-world application eludes me. php coding is not my day job (i'd starve), so it's been easy to muster along with what i have.

    anyway, to my proposal. i maintain the records for my golf league at www.calvinmitcham.com/golf/. the php scripts there do get the job done for the 32 golfers, but in you folks' eyes, it is going to sound horrible...

    hard-coded to postgres;
    no objects except for the awesome jpgraph graphing library;
    ZERO error handling;
    tight, tight integration of logic and presentation (heck, i can go in and out of php four times in one line);

    ok, so i still haven't proposed anything... the proposal is that we rebuild the system on space i have at www.dotgeek.org. we start simple, and we don't continue till you real php coders approve, and i understand it. i guareentee that when i understand it, all us newbies will understand it.

    anyone interested?

    calvin.
    I would just convert in small steps rather than doing it all at once. Some things you could do:

    1. Nothing really wrong with native postgres calls if you have small code base and are happy with Postgres. For more portability you can always switch to a database abstraction layer like PEAR DB, ADODB, etc.

    2. No objects no problem There's plenty of excellent procedural code out there. Look at the popular bulletinboard phpbb, they use some objects but most of the code is still procedural. It may be repulsive to the OOP purists but it's still well written and easy to read.

    3. Zero error handling. Well ok that's a bit scary but it wouldn't take much to just check the results of the most important functions and print out some error messages.

    4. You could either use the HDOC syntax to help clean things up a bit or use a templating system like smarty, patTemplate, etc.

  5. #5
    SitePoint Enthusiast Refresh's Avatar
    Join Date
    Jul 2004
    Location
    Lausanne, Switzerland
    Posts
    46
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by cmitcham
    i've lurked here several months, and have avoided posting, but the "how do you guys know it so well" post has prompted me to action...

    i am another one where the oop light has not clicked on yet. i understand that all bicycles have handlebars, etc, but still applying the concept to my real-world application eludes me. php coding is not my day job (i'd starve), so it's been easy to muster along with what i have.

    anyway, to my proposal. i maintain the records for my golf league at www.calvinmitcham.com/golf/. the php scripts there do get the job done for the 32 golfers, but in you folks' eyes, it is going to sound horrible...

    hard-coded to postgres;
    no objects except for the awesome jpgraph graphing library;
    ZERO error handling;
    tight, tight integration of logic and presentation (heck, i can go in and out of php four times in one line);

    ok, so i still haven't proposed anything... the proposal is that we rebuild the system on space i have at www.dotgeek.org. we start simple, and we don't continue till you real php coders approve, and i understand it. i guareentee that when i understand it, all us newbies will understand it.

    anyone interested?

    calvin.

    Ok, I had a very quick look at your app. I'm really no OOP guru, but I think it's a good opportunity to have my "homework" checked by some of them

    So, let's start with the objects ("entities"?).

    What I am sure:
    We need a Golfer object; it's responsible for storing all the data related to a golfer (name, age, hcp, ...)
    In this particular application, we will also need a Team object, which will consist of 2 Player objects (but you could also have an optional Party object, when 4 people play together).
    We need a Course object, which consists of a collection of Hole objects; Hole objects consist of a number, par, distance, "difficulty rank", etc... The Course can also have characteristics like town name, zip, phone number, facilities, ...
    We also need a Competition object, which is the "common denominator" of all the chacarteristics of the competitions that will take place (date, course, ...). We will then need to extend the Competition class to match the types of competitions (stroke play, ...)

    What I am not sure:
    Do we need a Score object, to keep track of all the competitions that took place? Or how will we implement that?

    The next step will be to find the actions that each object can perform, but that'll be after we get validation for this post

  6. #6
    Non-Member
    Join Date
    Jan 2004
    Location
    Planet Earth
    Posts
    1,764
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The collection of Course Holes would be an array of objects I feel, with each object holding the Hole data.

    The Course can also have characteristics like town name, zip, phone number, facilities, ...
    This I feel should be a seperate entity as well, as not all Course Holes require this data ?

    It's a damn shame I do not know enough about UML, as I think this would help clarify a lot more

    Sorry I cannot be more help just now.

  7. #7
    SitePoint Enthusiast Refresh's Avatar
    Join Date
    Jul 2004
    Location
    Lausanne, Switzerland
    Posts
    46
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Widow Maker
    The collection of Course Holes would be an array of objects I feel, with each object holding the Hole data.



    This I feel should be a seperate entity as well, as not all Course Holes require this data ?

    It's a damn shame I do not know enough about UML, as I think this would help clarify a lot more

    Sorry I cannot be more help just now.
    hehe, ok I was a bit confusing I must admit. The Course should maybe be renamed as Club or whatever. The fact is that one Course has a one town, one zip, but several Holes... Not inheritance, but composition.

    in code:
    PHP Code:
    class Course
    {
    var 
    $town;
    var 
    $zip;
    }

    class 
    Hole
    {
    var 
    $number;
    var 
    $par;


  8. #8
    SitePoint Enthusiast Refresh's Avatar
    Join Date
    Jul 2004
    Location
    Lausanne, Switzerland
    Posts
    46
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Refresh
    Ok, I had a very quick look at your app. I'm really no OOP guru, but I think it's a good opportunity to have my "homework" checked by some of them

    So, let's start with the objects ("entities"?).

    What I am sure:
    We need a Golfer object; it's responsible for storing all the data related to a golfer (name, age, hcp, ...)
    In this particular application, we will also need a Team object, which will consist of 2 Player objects (but you could also have an optional Party object, when 4 people play together).
    We need a Course object, which consists of a collection of Hole objects; Hole objects consist of a number, par, distance, "difficulty rank", etc... The Course can also have characteristics like town name, zip, phone number, facilities, ...
    We also need a Competition object, which is the "common denominator" of all the chacarteristics of the competitions that will take place (date, course, ...). We will then need to extend the Competition class to match the types of competitions (stroke play, ...)

    What I am not sure:
    Do we need a Score object, to keep track of all the competitions that took place? Or how will we implement that?

    The next step will be to find the actions that each object can perform, but that'll be after we get validation for this post
    Please UML gurus, correct my vocabulary, I don't want people to get confused about what I say if I don't say it correctly...

    Should we rather start with Use Cases? What do you guys usually begin with?
    In a Use Case, you have to define an Actor and tasks he can perform. For example an Actor can be one of your golfer members. He can enter scores, check his handicap, ...

    You have to work with the client to find these out; YOU shold give each task a relative weight (how much time you think you'll need to implement it), and HE should sort them by priority.

    With Use Cases you can define the area (or scope) of your application. As a developer, you get a better knowledge of how things are to be done, and you can also say "stop" to the client by showing him that all the use cases have been fulfilled.
    And then you can charge more for additional requirements, or whatever :-)

  9. #9
    simple tester McGruff's Avatar
    Join Date
    Sep 2003
    Location
    Glasgow
    Posts
    1,690
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    What about some "CRC cards"?

  10. #10
    SitePoint Guru
    Join Date
    May 2003
    Location
    virginia
    Posts
    988
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by lastcraft
    Hi...



    Yes, but are you willing to battle on to the bitter end?

    yours, Marcus
    I know I would be

    -m

  11. #11
    Google Engineer polvero's Avatar
    Join Date
    Oct 2003
    Location
    Mountain View
    Posts
    567
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I wouldn't be any help because I don't know anything about golf.
    Good Luck

  12. #12
    SitePoint Guru
    Join Date
    Dec 2003
    Location
    oz
    Posts
    819
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You don't need to know anything about golf. Calvin will explain the use cases for us (I assume), and we'll guide him along from there.

    However before starting, he'll need some db classes. Does anyone have those handy - or a link to one of the older posts on it? And any other basic library stuff also?

  13. #13
    Google Engineer polvero's Avatar
    Join Date
    Oct 2003
    Location
    Mountain View
    Posts
    567
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    i'd say just use PEAR's DB_DataObject, but I can't get that set up myself.
    but from the looks of the way it's used in the actual part of the script, it makes writing query's like baking a cake (that is if you're good a baking cakes )

  14. #14
    SitePoint Enthusiast
    Join Date
    Aug 2004
    Location
    michigan
    Posts
    26
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hi folks, and thanks for the interest...

    i'll just ramble on some more here...

    i am interested in learning better php programming, but as i mentioned it's not my day job. i will stick with it, but there is no deadline. i guess that's good and bad. on nice days, i'll be out fishing, not coding. ok, if they're not biting, i might be thinking about a class layout or something.

    in the initial post, i didn't want to offend anyone with talk of money or commercialism, but this application can make you some money. i use the prototype system (www.calvinmitcham.com/golf) with my league, and for my trouble i golf for free. that's worth about $500 right there. the course we golf at hosts leagues every weekday, as does every other course in the area, so there is a pretty large, very niche market. there are software products available, but not many web-based. league golfers are used to golfing, then maybe seeing the records updated by fax in 3-5 days. with the web-based application, i can usually have the day's results posted just a few hours after we golf. that appeals to a league. and typically, league golfers don't seem to be real web-savy, so although welcome to do so, most aren't going to just download our application and help themselves. they will welcome our registering them a domain name, getting the host space and setting up the system for them, even if we train them to enter the data themselves.

    so i read a little about wiki tonight, and looked briefly at sourceforge. a forum thread like this doesn't seem real efficient for collaboration. with only 11 replies, it's already hard to follow. does anyone know whether a wiki would work better, and/or is sourceforge a good place for this type of application development?

    you non-golfers are certainly welcome, or more accurately, needed. actually, for you real coders, it will be just like your real work... get requirements from the client, but you have to teach the client (me) everything you are doing along the way.

    so anyway, if anyone's still interested, and wants to see the prototype garbage we are starting with, e-mail me at calvin at calvinmitcham dot com, and i'll send you the scripts.

    thanks again,
    calvin.

  15. #15
    SitePoint Enthusiast
    Join Date
    Aug 2004
    Location
    michigan
    Posts
    26
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    we have a wiki page now, thanks refresh! join us at http://www.atomical.com/tavi/index.p...entApplication as we get started.

    as we learn things, the results will show up at http://cmitcham.dotgeek.org. (and wherever else you folk want to use it)

    everyone for whom the oop light hasn't clicked yet is welcome to join us, hopefully you masters will drop by and help out!

    calvin.


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
  •