Jenda Krynicky said:

> From: Rob Richardson <[EMAIL PROTECTED]>
>> My biggest complaint about Perl is the non-intuitive data structures.

>> In C++
>> and Visual Basic, both of which I am employed to write programs in,
>> this is very easy to write, and perhaps more important, it is very
>> easy for somebody else to come along and read and understand what I
>> did.  I have managed to build these structures in Perl, but it's hard
>> for anybody else to understand because the code is so aggressively
>> un-self-documenting.

> Maybe you should stop thinking in C++ when you are programming in
> Perl :-)

> The one thing you just have to get out of your mind is the fixed
> structs. There is (unles you use a module that will restrict you)
> nothing like that in Perl. You can add as many fields as you like at
> any time.

And with great power comes great responsibility.  Getting your data
structures right may well be your most important design decision.  In a
language like C++ this is done upfront and set in stone.  This is good in
that you can count on that data structure being as described, but you have
no run time flexibility.

In Perl there is no requirement to declare your data structures, so it is
important to document them and to discipline yourself to respect them. 
Provide an API if you want others to do the same.

I wouldn't say that Perl's data structures are non-intuitive, although the
ways in which some people use them probably are.  Perl's arrays and hashes
are so powerful that I very rarely have to create my own ADTs (by which I
mean more than just lists of hashes etc.)

And once you start adding subroutines and REs to the data, and allowing
for the option of loading the data at run time, you can end up with really
powerful data driven systems.

As Jenda says, you just need to start thinking in Perl.

-- 
Paul Johnson - [EMAIL PROTECTED]
http://www.pjcj.net


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to