Nate the Noob
Nate the Noob

Reputation: 370

What are the advantages and disadvantages of Perl for OOP?

I was wondering how well Perl would perform for OOP based programming. What are the advantages and disadvantages of using Perl for OOP and if there are disadvantages, are there back-route ways of coding to code around them? Any information on what Perl is used for now — as well as how well a Perl Programmer could be paid in the future — would also be appreciated.

Upvotes: 8

Views: 14486

Answers (3)

DVK
DVK

Reputation: 129383

Nate - whether you learn Perl or not is only a very small factor as far as jobs.

The specific language is 10-20% of what you need - the rest is web development, database development, network programming, software engineering, data structures, algorithms, patterns and paradigms (e.g. OOP vs. functional vs. declarative etc...), communication, presentation skills, etc...

That said:

  • Perl is an excellent language to learn to introduce you to pretty much ALL of those concepts. As discussed on recent threads, it CAN teach you a lot more about OOP than Java (because Java only implements some facets of OOP), and Java can't teach you about functional programming at all (which you'll need to master JavaScript).

  • Knowing only Perl will probably make your job hunting harder. There aren't all that many jobs which require Perl and only Perl (there are still some, just not as many).

    On the other hand, there are MANY MANY fewer good Perl developers than, say, Java monkeys, so if you're really good at Perl, your ratio of jobs vs. available talent pool might actually be better than in other languages.

  • There are a LOT more jobs that require several languages. So you obviously need to learn both Perl and other languages (C# or Java seem like good bets as far as employment).

  • To repeat the above - the MAIN (80%) factor of how easy you can find a job and how much it pays has NOTHING to do with whether or not you chose to know Perl or any other language but on your knowing the other things I listed above AND your ability to learn both work-specific business knowledge and new languages.

Upvotes: 13

Sinan Ünür
Sinan Ünür

Reputation: 118118

OOP is not an end but a means to an end. Your question is so broad as to be practically meaningless.

If you write Perl programs that enable giant financial institutions to squeeze an extra few billion dollars of profits from their portfolios, you'll be paid handsomely.

If you write Perl programs that solve problems which are hard for other programmers to solve well, you'll be paid handsomely.

If you write Perl programs to process web based contact forms for simple web sites, you won't be paid as well.

If your programs implement encapsulation, polymorphism and composition well, they will be easier to understand, extend and fix than not. Which will give you an edge in getting things done better and faster, which will earn you a premium over programmers who throw things against a wall until something sticks.

Perl gives you freedom in how you create solutions. With freedom come risk and responsibility. Depending on your personality, that may be a good thing or a bad thing.

As for OOP:

  • Perl is succinct.
  • Perl does not require you to treat everything as an object.
  • Perl does not force you to use inheritance as the main mechanism for code reuse.
  • Perl makes using composition for code reuse very straightforward.
  • Perl's lexical scope and closures facilitate encapsulation.
  • Perl allows multiple inheritance.
  • Perl allows operator overloading.
  • With Perl, you are not restricted to using "the one true design principles" someone else decided a decade ago.
  • I am surely forgetting many many other pertinent bits.

As before, you are putting the cart before the horse. You should first thoroughly understand OOP without reference to any specific programming language.

For web applications, Perl gives you many many alternatives. Catalyst is a really nice framework. Dancer makes it easy to express your web application's functionality. Plack makes it easy to deploy it.

You decide how much of what OOP techniques to use with these frameworks.

I recently fell in love with the combination of Moose and Dancer.

Note: Given that you are just starting to learn, I would recommend (notwithstanding class assignments) that you not worry too much about language comparisons. Instead, open yourself to various languages. In this day and age, it is as easy as waiting for a few minute download to get started. When I first decided to learn how to program (slightly less than 30 years ago), paper and pencil was the only way I could write programs and I had to simulate the output of the program with paper. I know, I know, uphill both ways and all ;-)

So, experiment. Don't commit. You will understand the comparative advantages and disadvantages of languages by experimenting yourself. Try to write the same application with various different technologies. Make the task simple.

My first attempt at programming in Perl is still available online with warts and all. The reason I started with that was quite simple: I wanted to do something simple and something that would give me happiness.

Try something simple whose completion will give you satisfaction. Try the same thing with as many languages as you find interesting. Give Erlang a shot.

The job market will be different by the time you graduate from college. The best preparation for college is to have a broad understanding so you do not get bogged down in minutia but are able to complete assignments which others will choose for you.

Upvotes: 24

Curd
Curd

Reputation: 12417

You asked "how well a Perl Programmer could be paid in the future".

This reminds me of the this story of a guy who went to a fortune teller:

Guy: What will my future bring?
Fortune teller: Looking into my crystal ball I see many, many $'s
Guy: Oh, I am going to earn lots of dollars!?
Fortune teller: No, you going to be a perl programmer.

Upvotes: 14

Related Questions