Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine

(jeffa) 3Re: OO-style modifiers for 'sub' ?

by jeffa (Bishop)
on Jan 25, 2003 at 15:00 UTC ( #229850=note: print w/replies, xml ) Need Help??

in reply to Re: Re: OO-style modifiers for 'sub' ?
in thread OO-style modifiers for 'sub' ?

I am with the camp of "this is a waste of my time." Why? Because this is Perl, not Java. If i want someone to use my API correctly, i give them proper documentation. Yes, i suppose that nice friendly error messages would be nice ... but, the more Perl you program, the better you get at debugging.

"as soon as your code works, the whole checking becomes quite useless..."

That's right. The same goes for when you decide to change your design. Now you have extra baggage that you have to take care of to make sure that your 'bondage and discipline' code still works. No thanks. I'll gladly just make sure that my documentation is up to date.

So, are you wasting your time by doing this? Of course not ... i am glad to you see trying to further your own knowledge of application design and OO in general. What i am saying is that i have been programming OO Perl for 2 years now (Java for 2 before that) and my applications do not suffer from any symptoms that you think might arrise from using my API wrong. It's really quite simple, if it is a circle, don't put a square in it - put a circle in it. If i really really really wanted something else, i'd be spending my days programming Java. This is Perl after all ...

One more thing: (bold type added by me)

"The only thing that might not, would be 'borrowing' methods from other modules/classes without using inheritancy. But I can't help feeling that doing something like that indicates a design flaw anyway..."

Keep in mind that some think that using only inheritance is a design flaw ... OO newbies are always in a rush to solve every problem with inheritance and forget to consider aggregation.

So, in closing - you asked "why would you not to be able to do this?" My answer - it's a waste of my time. It's (as dragonchild says) "borrowing trouble." But, please continue -- don't stop just because i think it is silly. After all, someone wrote Attribute::Handlers and Hook::WrapSub, so you aren't alone on this one. ;)


(the triplet paradiddle with high-hat)
  • Comment on (jeffa) 3Re: OO-style modifiers for 'sub' ?

Replies are listed 'Best First'.
Re^4: OO-style modifiers for 'sub' ?
by Aristotle (Chancellor) on Jan 25, 2003 at 21:55 UTC

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://229850]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (6)
As of 2018-06-21 10:54 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (118 votes). Check out past polls.