Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: OO Perl is making my brain hurt

by mothra (Hermit)
on Apr 06, 2001 at 17:08 UTC ( [id://70451]=note: print w/replies, xml ) Need Help??


in reply to OO Perl is making my brain hurt

There's no magic to it: programming is hard (except when it's easy). If you've not done OO much it'll seem even more difficult. If OO is turning "seemingly simple, procedurally-based scripts in mazes of 'where is this function getting called?' and 'why isn't that function in a more evident place?' and 'why call three methods in class A to feed class B an array when functions like push exist?'", it's not OO's fault. It's either based on your lack of experience/familiarity with that paradigm, or the guy who wrote it not doing a good job, or both. :)

Every language has its own way of treating OO, and Perl is certainly no exception to having "its own way".

As you may or may not know, my day job pays me to write Powerbuilder code. Powerbuilder's "way" is the PFC, which is a service-based architecture. Because of that, the project I'm involved in has resulted in us creating a lot of objects whose only purpose is to do things for other objects (ie. a "sort service"'s purpose is to provide sorting capabilities for datawindows. A "time filter service" was created to provide information to any object that wants to know about time search criteria. etc, etc)

However, the project I'm working on is quite large (somewhere between 15,000-20,000 lines, 200+ stored procs, 20-25 table database, about 15-20 different windows, well over 100 classes we've written, etc). OO scales nicely though, and despite the fact that there is definitely a steep learning curve (steep in learning the PFC too), OO has taught what to me is a very natural way of thinking about The Way Things Work.

What am I getting at?

The point I'm trying to make is that you will probably find that with some patience and practice/experience, OO will scale well. Familiarize yourself with the way Perl does OO and try to think like it does (much like we're doing with PB and the PFC, which have lead us to think in terms of creating a service-based architecture). To this point, I haven't written my own OO code in Perl (I've used other's modules in "an OO way" though), but I still find that much of the way I think about OO in Powerbuilder is very applicable to Perl, certainly in terms of the way I can design classes and methods in a way that minimizes coupling and maximizes cohesion.

Give it a chance and you could very well find that this new way (for you) of thinking about things could open up a whole new way of solving problems. You might even like it. :)

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (8)
As of 2024-04-18 08:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found