in reply to Coding styles: OOP vs. Subs
Do you have coding standards documents in place? If not, it might be a bit like closing the barn door after the horses have escaped. If you do, they would hopefully clearly define acceptable coding standards - which would ideally include heuristics on when to use OOP and when to use procedural.
On my work team, I was the original perl programmer. Since then, I've brought on board two contractors (in serial - both their contracts have ended) and currently have one full-timer working for me. The contractors were brought on board with varying degrees of experience, but were largely the "hack-it-and-forget-it" style of programming. By the time they left, they both had a fair dose of OO-style in them, but not likely nearly enough for them to design anything with OO. The full-timer had nearly no experience either way - he could get perl to do things, but there was nearly no depth.
In each case, I could show them the benefits of OO for our particular project and they were suitably convinced. They just needed to get used to thinking in terms of objects (which actually quite amazes me - because, in my mind, we deal with objects every day outside the context of programming, so why is it such a tough sell inside programming?). In the case of the contractors, they both knew they were merely hired guns, and knew to take orders, so there was little clash. Sometimes I'd tell them how to design something, and they'd go off and not do it right, but largely there was little struggle.
The full-timer, however, was another beast. As someone the company would keep for a while (most likely - he has almost as much time at the company as I do, and at least a decade of experience before that where I was hired right from university so this is my only full-time job since I graduated), he had a bit of an ego. (As do I - an ego is not necessarily a problem to me.) He thought that he was actually quite proficient in perl. Then again, I think the same about me. We had some serious clashes near the beginning of working together there. Very heated arguments. Eventually, through code reviews and the like where I could show him many WTDI, and rattle off the pros and cons of each, he gradually came around to see my way of doing things and why the design we had was actually taking into account more things than his new design was. It's not that we have a perfect design - just better than the known alternatives. Nor do we do everything in 100% pure OO. In fact, one of the new modules he wrote just in the last 8 months or so was OO where I didn't think it was warranted. We had a bit of a discussion on that, and he eventually saw a demarcation point. What I don't want is "cargo cult" programming where he does everything OO just because "that's the way it's done here." Some critical thinking is required, and disagreements are expected. At the same time, teamwork is a requirement, and an ability to live with and work within team decisions is a must.
If he doesn't want to waste time in "stupid competitions", perhaps he can explain why he wants to waste time in forking the project into multiple styles. It will raise the bar for maintenance, guaranteed. Trying to read a mix of multiple styles is far more difficult, and thus error-prone, than reading a single style.
It also sounds like your colleague is suffering from a case of premature optimisation. Trying to solve speed problems that probably don't even exist. Finally, if speed is his concern, why is he wasting time in perl rather than assembler? The benefits of OO vs procedural in large projects is the same as the benefits of perl over C or C over assembly: abstraction. Allows you to do more with less, which invariably speeds up development as well as reducing errors and speeding up bug-fixing.
Heck, if you really want speed, don't use apache - write your own webserver. All that overhead of apache calling system() has to just make him completely nervous. Or maybe you use mod_perl - but switching contexts and languages must have a speed penalty in there somewhere.
If he's not concerned about all these other speed penalties, why the heck is he worried about the relatively minor overhead of OO?
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Coding styles: OOP vs. Subs
by jonadab (Parson) on Nov 16, 2005 at 13:39 UTC | |
by TimToady (Parson) on Nov 16, 2005 at 17:05 UTC | |
by john_oshea (Priest) on Nov 16, 2005 at 22:14 UTC |