http://qs321.pair.com?node_id=301036


in reply to Re: Multi tiered web applications in Perl
in thread Multi tiered web applications in Perl

90% of every Perl application has already been written, tested, and deployed.
That sounds really appealing, but I certainly haven't found it to be the case. Possibly if you are writing things such as CGI scripts that do mailforms, but I'm curious. Do other folks who write serious Perl applications for their day jobs agree with this statement?

-- dug
  • Comment on Re: Re: Multi tiered web applications in Perl

Replies are listed 'Best First'.
Re: Re: Re: Multi tiered web applications in Perl
by perrin (Chancellor) on Oct 21, 2003 at 20:39 UTC
    In the application I'm working on now, there is much more CPAN code (Class::DBI, HTML::Template, CGI::Application, DBI, Data::FormValidator, SOAP::Lite, XML::Parser, etc.) than code written by me. The code written by me is the actual logic of the application, i.e. the part that couldn't possibly come from another source since it is specific to this project.
Re3: Multi tiered web applications in Perl
by dragonchild (Archbishop) on Oct 21, 2003 at 20:43 UTC
    I do write serious Perl applications for my day job. A few examples of apps I've heard about:
    • An application that will take inputs in nearly every format known to man (including screen scrapes of vt100 terminals), munge the input according to arbitrarily-defined rules, then output it in any number of outputs, defined at run-time?
    • An application that securely handles over M$100 in seed orders yearly.
    • E-Toys, the most-hit website behind E-bay and Amazon.

    Would those qualify as serious web apps?

    ------
    We are the carpenters and bricklayers of the Information Age.

    The idea is a little like C++ templates, except not quite so brain-meltingly complicated. -- TheDamian, Exegesis 6

    ... strings and arrays will suffice. As they are easily available as native data types in any sane language, ... - blokhead, speaking on evolutionary algorithms

    Please remember that I'm crufty and crochety. All opinions are purely mine and all code is untested, unless otherwise specified.

      I'm not questioning the seriousness of your projects. I was questioning the language that you used when you said, "90% of every Perl application has already been written, tested, and deployed."

      Maybe it is a silly thing to harp on, but it is patently false.

      -- dug
Re: Re: Re: Multi tiered web applications in Perl
by ctilmes (Vicar) on Oct 21, 2003 at 19:59 UTC
    The code I produce in Perl could easily be 10% of what I would produce doing everything in C without access to a huge library like CPAN.
      What libraries have you found yourself missing when programming in C?

      Don't get me wrong, the CPAN is certainly one of my favorite things about Perl. I have just never had a job programming something substantial in any language that was already 90% complete. I would certainly never say that "90% of every" application in *any* language "has already been written, tested, and deployed". Some of them, sure. But not all of them.

      -- dug
        Let's say I want to write a basic application. It reads in an XML file, does some stuff to it, then writes it out to a CSV. Quite a common thing to do, actually. It might look something like:
        use strict; use warnings; use XML::Parser; use Text::CSV; # Do my parsing here ... maybe 100 lines # Do my munging here ... maybe 100 lines # Do my writing here ... maybe 25 lines.

        A total of no more than 225 lines of code I wrote. Now, let's see how much code was provided for me. Not counting the amount of time I save because Perl natively does for me the following:

        • Memory management
        • Hashes as first class variables
        • Lists as first class variables
        • Datatype conversion
        • A lot more than that

        Already, I've saved about 25% over most other languages, just from choosing Perl!

        But, that's not what you care about. XML::Parser was a huge portion of this application. Parsing XML is one of the harder things you can do. Let's say that takes about 1500 lines to do. (It's actually much more than that, but who's counting?)

        Now, writing to a CSV sounds easy. But, it's actually really complicated. There're a lot of exceptions that have to be handled just right or you get screwed up. Let's say that's another 500 lines of code. (Again, it's more than that, but who's counting?)

        So, we have at most 225 lines we wrote and at least 2000 lines we didn't have to. My math may be off, but that seems to be about 90% I didn't have to write, test, maintain, or do anything with ... except blithely use.

        Those numbers hold pretty close, in nearly every application I've ever worked with. You want to deal with XSLT? No problem! Excel? Done. Databases? Nearly every one is supported out of the box. OO getting you down? Pick your poison.

        Personally, most of my large apps are down in the 80-85% range, because I like to write large object hierarchies. But, that's just me. A lot of people (especially sysadmins) are in the 95-97%(!) range, leveraging huge amounts of code.

        Update: I forgot to even mention the time savings, which are often in the 98-99.9% range. I once had a scripty-doo up and running that correlated information between an Oracle database, a MS-SQL database, and an XML document, outputting the results in Excel ... in less than 15 hours, from scratch. That is impossible in any other language. Period.

        ------
        We are the carpenters and bricklayers of the Information Age.

        The idea is a little like C++ templates, except not quite so brain-meltingly complicated. -- TheDamian, Exegesis 6

        ... strings and arrays will suffice. As they are easily available as native data types in any sane language, ... - blokhead, speaking on evolutionary algorithms

        Please remember that I'm crufty and crochety. All opinions are purely mine and all code is untested, unless otherwise specified.