2011-05-02

perl(practical extraction & report lang)

4.19: adda/perl/regular expressions:
. if Perl's syntax seems too cryptic
keep in mind the built-in regular expressions .
--
. that degree of terseness should be optional;
adda should have a tool that lets you
write the expression in normal logic;
if you do know perl regex coding,
it should offer to expand that into adda logic
to confirm what was written,
and it should also convert back to regex
for those who want to keep code compact .
illustrations:
-- the comments could also provide
short and long examples of target strings .
. that would be an intuitive but compact reminder
of what the regex code meant .

4.19: adda/lang"perl/compared:

hammerprinciple.com:
Ranked highly in:
# text processing
# good library distribution mechanism.
# too easy to write code in this language
that looks like it does one thing
but actually does something else;
# tends to be terse .
# annoying syntax,
# many features which feel "tacked on".
# for casual scripting of very small projects
eg, write a command-line app
. very flexible .
Ranked low in
# very readable
# built on a small core of orthogonal features
# has a strong static type system
# code is easy to maintain.
# language is minimal
# good for teaching children to write software
# tends to be verbose

guidance from stackoverflow.com:
Coming from C, Perl's syntax is easy;
Perl offers more freedom to
do the "wrong" thing,
It's also prone to ugly code
and "stupid programmer tricks".
also "There's more than one way to
muck it up" .
As for the syntax, Larry Wall (Perl's creator)
has described it as "diagonal"
(in contrast to "orthogonal" languages).
The syntax is designed to mirror the
flexibility and expressiveness of natural language.
. code like (next unless /foo/)
can be slightly jarring at first
but you quickly realize
it flows much more smoothly.
What looks like obscure Perl syntax
is actually a regex pattern
without the (programmer) overhead of
wrapping it in a method call.

But with discipline and coding standards,
you can go far.
(see Perl::critic on CPAN)
. read Conway's "Perl Best Practices"
and Perl Testing
(the Perl community has a VERY strong testing culture).
and check your code with
perl::tidy .
This will help to keep everyone
writing in a similar fashion.
. run a smoke test with Critic on committed code;
Test::Perl::Critic goes in your t/ directory
with all your other tests .

. see the PerlMonks site,
your local Perl user group
and The Perl Review magazine.

. see the great tools & code on CPAN
-- CPAN is the most comprehensive
open source code repository of any language;
most of the code you need to write
has already been written and is available,
searchable and easy to install, from CPAN,
-- you will like how productive
this lang makes you --
Perl is an amazingly good choice when
you are writing a lot of "glue"
that has to talk to a bunch of
disparate systems or work with text.
In many ways,
my favorite platform is CPAN.
Perl just happens to be the language you have to use
to pull together the modules in CPAN.
The ability to just 'get stuff done' is dramatic
when you compare it to even
trying to figure out the API
for an equivalent chunk of code
in a more traditional high level language like Java.
A large part of that power comes from
Perl's initially-strange-seeming
'do what i mean' semantics.
. Perl is the most valuable tool
in any programmer's toolbox.

. "state of the art" modules:
# Moose - a meta object protocol for Perl
it means much of Perl6 OO is available now .
# DBIx::Class

* learning Perl5 now prepares you for Perl6.
- designed to become the lingua franca
of computer languages
Larry Wall has synthesised the best features of
all other programming paradigms
(functional, OO, logic, static, dynamic, concurrency etc)
into one language.
I predict in the next couple of years
Parrot (the Perl6 virtual machine)
and other Perl6 implementations will be released -

. a real Perl programmer has an
understandable, well-documented code base
that is easy to maintain.
. use of Perl as the main development language
has always been a successful business decision
due to the extremely high productivity of a Perl expert
compared to that of a C/C++/Java/C#/Etc expert.

There are IDEs available for Perl.
For Eclipse there is the EPIC plugin.
ActiveState has Komodo.
-- most Perl programmers seem to use
vi or emacs [they are showing their age ?]

No comments:

Post a Comment