Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • You're wrong.

    Using specific container classes helps you to document behaviour. It should help you put appropriate behaviour in the right place and move shared behaviour into superclasses.

    Ask James Duncan about the trials of dealing with a mature application that is mostly OO but with a largish datastructure that was initially implemented with anonymous hashes and arrays. The up front laziness cost them time and time again as they came to extend the system and they all sorts of fun trying to replace it wit
    • pdcawley does echo my thoughts on this. In large systems often you don't want to just be push'ing on or pop'ing from an array. You want to be doing things like validation of values that are being push'ed and pop'd.

      If you want to be doing validation then you want to ensure that you Don't Repeat Yourself. You also want to make sure that the behaviour is close to the data. In short, you want a class.

      For sure, with Perl, you could tie the Array or Hash, but, there is a problem with that. First, Tie'ing
  • The popular statically typed languages often have difficulty with containers because they have to fit into the static typing scheme. (Of course, if you're using a weakly typed language such as Java or C, you can just cast to the appropriate void and cast back, if you aren't bothered by such things as good taste.)

    Thankfully, Perl avoids that route, caring only about the container type, as references fit into scalars.

    • I think Dominus covers this well in a talk he did for a Perl Conference [plover.com].

      Pay special attention to 4 [plover.com], 5 [plover.com] and 6 [plover.com].

      ObFanBoyStatement: Dominus is so cool. Who else has the courage to point out that those who parade around in Design Patterns for Software are naked?

      • Lots of people. Doesn't make 'em any more right though. Just because the Gang of Four book is not a good patterns book doesn't mean that patterns have no value. Take a look at Kent Beck's Smalltalk Best Practice Patterns for a superb example of a pattern language. Martin Fowler's Refactoring is also a great patterns book.

        The GoF book isn't a pattern language, it's just a collection of 'words'.