News for hackers. Stuff that matters.
Re:Programming is hard, let's go scripting.. by stcredzero on Wednesday April 04, 2012 @03:34PM (#3799413)
Object oriented, functional, declarative you say it Perl has it. Its amazingly flexible, easy to learn and extensible.

My first programming job was in Perl back in the late 90's. Loved it, but I have to say that the OO facilities left something to be desired. I found them fatiguing. It took Java, then Smalltalk for me to really get OO. Perl requires too much mastery of mechanism just to do objects, so it's not the best environment for learning OO.

Re:Programming is hard, let's go scripting.. by jrockway on Wednesday April 04, 2012 @05:38PM (#3799986)
I agree with chromatic below; Java and C++ do not teach you OO. They teach you cut-n-paste without a text editor. (When Bar extends Foo, you're copying-and-pasting Foo's code into Bar, and then tweaking it. Or at least that's how class-based OO is used a good percentage of the time.)

A better way to program is with interfaces and composition via delegation, something that Java and C++ support but have no syntax for making it easy. Perl's Moose object system, on the other hand, has easy support for composition via roles and delegation via ... well, delegation :)

And, you have "extends"-style OO available if you think it's the right solution to a particular problem. So really, I think it's a fine way to learn OO. Doing things right is easier, if you decide to do them right.

(We do Java OO right at Google, but it sure involves a lot of typing and @hacky-attributes. And I've never seen good Java OO anywhere else.)

Re:Programming is hard, let's go scripting.. by stcredzero on Wednesday April 04, 2012 @06:11PM (#3800130)
As a Smalltalker with a decade of experience, I too find Java a bit lacking. That said, it was a better environment for OO than Perl at the time. I was able to get a feel for refactoring through Java, though. That primed me for Smalltalk and the joy of no primitive types.
Re:Programming is hard, let's go scripting.. by jrockway on Wednesday April 04, 2012 @06:20PM (#3800162)
At the time, yes, absolutely. Now, Perl is pretty nice, and you get a lot of nice libraries.

I have used Java and Python extensively now and I like Perl a lot more. All three are quite usable, however.

Re:Programming is hard, let's go scripting.. by prodigal_erik on Thursday April 05, 2012 @01:47AM (#3801481)
Really? I see inheritance as a good antidote for cut'n'paste. If you don't physically duplicate code, you'll never have to read both copies just to make sure they're still the same. I agree most devs do it wrong, but I think it's because they're purely pragmatic and haven't read or thought philosophically about the open/closed principle, programming-by-difference, Liskov-substitutability…

And I do want to remind readers that Moose is not the Perl object system, it's an object system added on top of the mess that a huge collection of legacy code presumes.

Re:Programming is hard, let's go scripting.. by chromatic on Wednesday April 04, 2012 @04:41PM (#3799731)
My history is the opposite. I failed to understand objects in C++, then learned Java, and then learned Perl. Playing with the mechanism helped me understand OO. (Exploring Smalltalk after that helped.)

After learning Moose a couple of years ago, I don't miss the Perl 5 mechanism at all.

Re:Programming is hard, let's go scripting.. by elb0w on Wednesday April 04, 2012 @11:00PM (#3801080)