Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?

Re: Hacking with objects

by indigo (Scribe)
on Mar 23, 2001 at 03:34 UTC ( #66515=note: print w/replies, xml ) Need Help??

in reply to Hacking with objects

OO in your program is like mustard on a ham sandwich. You can get by without it, a little can make things a lot better, and too much gets you a mustard sandwich.

Unfortunately, OO has been such a buzzword over the years, there are a lot of mustard sandwiches out there. I've have spent more time in my career undesigning pointlessly complex object hierarchies than I have designing my own. There is something about OO that causes people to just go crazy and design these worthlessly ornate OO constructs. I think it is because while everyone knows the advantages of OO, but very few know its drawbacks. You have to understand both to know when to use OO, and how much is appropriate.

I counsel OO minimalism. Start with a small set of core objects, and add new OO trappings only when your code speaks to you with a voice unwavering.

Replies are listed 'Best First'.
Hacking with objects
by frankus (Priest) on Mar 23, 2001 at 15:30 UTC

    You have to understand both to know when to use OO, and how much is appropriate.

    This is my problem. If I were coding in Java or C++ I'd play it by the numbers, because the voices in my head don't tell me to make this code as terse (basically, at least for Java a well trained Labrador can understand the code, so where's the fun?).

    But for me, in my less sober moments, Perl is for being a wizard and bending the rules if not breaking them or taking 3 words from one rule and sticking them with half a dozen from another.

    So the desire to use Good OO principals is not always at the forefront of my mind. What I was commenting on was the desire to hack using OO.

    In the same way that on a certain day you might bung all the processing for a piece of code in a regular expression and know it is `baaad'; I'll say rather than have a for loop and an item before the for loop and an item after the for loop I'll make an object do the first thing in the constructor the for stuff in a method and the bit after the for loop in the destructor function, and believe me in this situation it is brevitous, feasable and reusable.

    When I'm feeling mischevous or bored or lazy why should I feel bad about misusing the tools of OO? Being in awe of OO stops the use of some cool features, why should I have to be an OO Designer?

    I like the food analogy, I like food :-).

    Brother Frankus.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://66515]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (1)
As of 2020-10-25 17:11 GMT
Find Nodes?
    Voting Booth?
    My favourite web site is:

    Results (249 votes). Check out past polls.