SitePoint Sponsor

User Tag List

Page 2 of 2 FirstFirst 12
Results 26 to 32 of 32
  1. #26
    SitePoint Addict
    Join Date
    May 2003
    Location
    Calgary, Alberta, Canada
    Posts
    275
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by beetle
    Brenden, I think you make a good point but base it around the wrong argument: that methods that return "something" should be evaluated for "smell". That, in and of itself, is terribly misleading.

    What you're really talking about is changing those methods when composition can be applied to your class structure.

    So, to that point, I would agree with the promotion of composition where applicable.
    I guess I havent communicated those points very well. What I actually have been doing is looking for return statements in code I just wrote and evaluating it to see if its a bad spot to return. Maybe thats not the best method but its something Ive been doing. What I would like to do, is to be able to make the right decision before hand and not have to refactor things like this, but Im working on it.
    Obviously none of this is new, but can be found in Refactoring by Martin Fowler. I think the biggest difference between procedural, Pseudo-OO and OO code is the amount of correct refactoring that has gone into it.

  2. #27
    SitePoint Wizard stereofrog's Avatar
    Join Date
    Apr 2004
    Location
    germany
    Posts
    4,324
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Brenden Vickery
    - methods that return anything (Shouldnt I tell this method to do something instead of asking it for something?)
    - if statements (Cant I use polymorphism here?)
    - switch statements (Cant I use polymorphism here?)
    - instance of / is_a (Cant I use polymorphism here?)
    - nested if statements (Make a new private method, this is easier to read.
    - loops (replace with iterators)

    Didn't we just invent smalltalk?

  3. #28
    SitePoint Zealot
    Join Date
    Mar 2005
    Posts
    116
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I use what I call 'Object Procedural' programming with PHP. I predominately use classes as namespaces, rather than as true objects.

    I think the PHP model is profoundly broken when it comes to OO, even in PHP 5. The actual page->request model used by PHP is the fundamental issue, it makes all OO programming essentially moot.

    In a truly Object Oriented langauge, such as Java, OO for web apps is possible, but I am yet to see a pure OO program written in PHP that doesn't actually make life more complex for developers. The number of times I have seen the Singleton pattern used, for example, is a joke. Given that you can actually have global variables in PHP, there is no reason to use this particualr pattern. In Java, it's required because of the way the VM works.

  4. #29
    ********* 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 dreamscape
    And what exactly smells bad about a collection of utilities? A string utility? or a number utility? or a math utility? or a validation utility?
    The sense of smell comes from experience of chucking up after eating rotten food.

    Util classes by definition lack cohesion, they do lot's of odds and ends. Better is to place them into a lot of small classes and then have them grow naturally. At least that way you don't have to include a lot of junk you don't need when you include the utils.

    That PEAR validation class sounds pretty low quality if it has no interface design.

    Quote Originally Posted by dreamscape
    Maybe your nose is the problem. Ever think of that.
    This is philosophically feeble. We would throw away all human judgement wouldn't we? If there are lot's of ways then there would be lot's of opinions from the older/experienced practitioners and nobody would ever be able to convince anyone else of anything. In fact expert knowledge tends to converge. I see the "utils class is bad" rule independently discovered all over the place. People don't go back to util classes once they have abandoned them.

    Quote Originally Posted by dreamscape
    Maybe it does to you, but then just plug your nose and walk away.
    I don't like smelly stuff piling up around me. I'd rather call the council and have the dustman remove it. It's unhealthy otherwise.

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

  5. #30
    SitePoint Wizard
    Join Date
    Aug 2004
    Location
    California
    Posts
    1,672
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by lastcraft
    In fact expert knowledge tends to converge.
    That line stood out to me, because it is the one thing that unexperienced programmers have the hardest time believing. Unless you believe that idea, then things like TDD, patterns, OOP, anything Agile, etc. just don't make sense because they are often counter-intuitive.
    Christopher

  6. #31
    Non-Member
    Join Date
    Jan 2003
    Posts
    5,748
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Isn't ignorance got something to play in that though? To be a better programmer you need to have an open mind, in that you want to learn more, learn something better, something smarter.

    Then again maybe it's not got anything to do with ignorance, nor the lack of experience either - but it's got everything to do with the lack of support from those above you. The attitude may be that they're not interested in individual personal development within the company, that they're only interested in getting the job done, quickest possible route taken.

    It takes a shockwave for instilled attitudes to change.

  7. #32
    SitePoint Addict
    Join Date
    Nov 2005
    Posts
    327
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Dr Livingston
    The attitude may be that they're not interested in individual personal development within the company, that they're only interested in getting the job done, quickest possible route taken.
    Or, in the case of freelancing, they may not want to pay what it's worth to write more than a crude hack.


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
  •