Re: Perl is one of the best known scripting languages in the world
Date: Mon, 16 Sep 2013 20:45:19 +0200
Message-ID: <b9p1u7FpqrU1_at_mid.individual.net>
On 15.09.2013 20:10, Mladen Gogala wrote:
> On Sun, 15 Sep 2013 12:03:29 +0200, Robert Klemme wrote:
>
>> And it lacks a clear syntax as well as object orientation - in Perl 5 at
>> least (even Larry said so IIRC).
>
> Be that as it may, OO is not high on my priority list. I'm a DBA, most of
> my tasks are procedural in nature: load this, convert that or produce a
> report. Hardly a case for OO.
I guess long ago I would have said the same. But even parsing CSV benefits from Ruby's object orientation. Maybe it's just familiarization but for me it feels so much more natural to use objects and classes. Maybe it's that it is so easy to write a full fledged class in Ruby that you can even have it in one line:
# class def
DBA = Struct.new :name, :login, :skills
# one instance
mladen = DBA.new "Mladen", "I made this up", [:oracle, :mysql]
# output
puts "#{mladen.name}'s skills include #{mladen.skills.join ', '}."
-> Mladen's skills include oracle, mysql.
But I get carried away. ;-)
> Also, I believe that the development
> community should give the OO paradigm another, rather critical look. OO
> was supposed to make programming easier but has produced an untold number
> of poorly documented class libraries, which only increase the complexity
> of programming, not make it easier.
Yes, that observation is right. OO creates at least one more dimension of complexity.
> Going through somebody's spaghetti
> code is about as appealing as going through somebody's class libraries,
> especially when classes appear to be written under the influence of
> controlled substances. I've had several such cases.
That is never a nice experience.
> Of course, it all depends on perspective. For a DBA, Perl is the right
> choice. For a software developer, it's probably not the right choice.
I think Perl's major fault is that they overdid it in some areas: including Perl code inside a regexp is just insane IMO; also, there are often so many special cases that do some magic that it is hard to read the code as a casual Perl coder. For me maintainability is important.
> I've never programmed in Ruby, but the apparent advantage of Perl is the
> fact that it is everywhere: Windows, HP-UX, AIX or Solaris, among others,
> not just Linux. Chance is that you will be able to write a Perl script on
> AIX, without installing any additional software, while there will be a
> need to install software if you attempt to do the same thing in Ruby or
> Python.
Yes, I have to grudgingly agree that's a big plus for Perl.
> Also, for the 3rd party tools like Rlib or Sphinx, there are always Perl
> bindings. There are often no Ruby bindings (Sphinx does have them, RLIB
> does not).
And Perl's CPAN is another excellent reason to use Perl. Sigh.
Cheers
robert
-- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/Received on Mon Sep 16 2013 - 20:45:19 CEST