in reply to Perl applications

I think perl gets a bad rap because if you are not familiar with it the syntax is hard (bad I think) $_ and <> are confusing to those not used to them. I've used a lot of languages and the perl syntax still throws me sometimes.

Personlly I find perl code hard to read, there are worse, C++(STL) and scheme come to mind. I write mainly in C and ada and use perl/tk for testing. I used to do a lot of java. We also use perl instead of shell scripts because its more cross platform.

However using perl to program our applications is not an option, as quite frankly its not reliable enough and has too much non-deterministic behavour plus it doesn't have some of the constructs we need. Its not strongly typed makes it easier to write prorgrams, however this can make the software less reliable if not used very carefully. I think exception handling in perl might me somewhat lacking to but I'm not entirely sure of this.

I can see writing small to medium size applications comfortably in perl. I perfer to write anything with a gui using java/eclipse. I like java alot because I find the class libraries a quite good and cross platform. This is a Personal preference I'll freely admit.

I'm always an advocate of trying whats out there and using the right programming language for the job. Perl is great for a lot of things, but its not the be-all end-all programming language although cpan has alot of functionality.. No language is best at everything.... yet. Heck I didn't like ada at first, now I like it a lot..

Replies are listed 'Best First'.
Re: Re: Perl applications
by BUU (Prior) on Apr 08, 2004 at 03:16 UTC
    However using perl to program our applications is not an option, as quite frankly its not reliable enough
    What does "not reliable enough" mean, exactly? A piece of perl code randomly stops working one day?
    and has too much non-deterministic behavour
    Uhm. Like what?
    plus it doesn't have some of the constructs we need.
    Again: What constructs are you missing that you can't possibly implement (easily even) in perl?
    Its not strongly typed
    This is just wrong. Perl is strongly typed: scalars, lists, hashes. This is as opposed to languages like C and java which aren't strongly typed.
      I'm late answering, but I will. Sorry I was away.

      Reliable enough means can not stop. Or if it does stop games over. Without too much detail we disable interupts on some of our processors so we can get quasi real time performance for the lone process on the processor. They must stay running for a long long long time or die gracefully. If they crash we lose the cpu the process is running on till a reboot so that isn't an option.

      One of ada's really cool features is to allow you to rep-spec any record (struct in c). This allows you allign the data structure to match input messages from various bits of hardware (ie the status byte starts at byte 4, bit3 and is 8 bits long). This is harder in perl, although it probably could be done. .

      Stongly Typed. When we compile the compiler checks all the assignment to make sure they're legal and legit and won't cause problems. Its not an end all but it helps a lot. We also contrain types. For example an integer to between 10 and 20. If the variable ever gets out of this range during run time an exception is thrown and handled by other parts of our code. Its excessive but it has to be. especially when you sending data out that might turn a motor etc. That way external hardware is never getting data out of range.

      Ada coding is slow and the support is poor. We have to write some of our own libraries or bind to C. Perl has a much more robust user base and libraries. Perl is great for a lot of things and can be coded to be pretty reliable. For somethings there are better solutions.

        Stongly Typed. When we compile the compiler checks all the assignment to make sure they're legal and legit and won't cause problems. Its not an end all but it helps a lot. We also contrain types. For example an integer to between 10 and 20. If the variable ever gets out of this range during run time an exception is thrown and handled by other parts of our code.

        I suspect that you are right and that Perl is not the tool for the job you have to do. I'm not going to disagree with that at all. I'm a big fan of using the right tool for the job.

        But have you ever had look at Attribute::Types? It's what I'd use to achieve some of what you've specified above.

        Attribute::Types allow you to write code like the following:

        use Attribute::Types; my $count : INTEGER; # Can only store an integer my $restr : INTEGER(10..20) # Can only store an integer # between 10 and 20. my $some : Type(&somesub); # Can only store values for # which somesub() returns true.

        All of this checking is done at run-time which makes things a little bit harder than other strongly typed languages, but it does give you this functionality if you wish.

        Hope this helps,

        jarich

        Ah, I take your meaning now, and I think I agree with you. For the type of applications you describe, perl probably isn't the best choice.
        Your language isn't just strongly typed, it's hyper-typed. You've got the same strength that Oracle provides for you with CHECK constraints.

        Now, you can provide the same capabilities re: integers between 10 and 20, either with Attribute::Types (as sporty says) or with overload. There are ways. You can even write source filters, if you need to.

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

        Then there are Damian modules.... *sigh* ... that's not about being less-lazy -- that's about being on some really good drugs -- you know, there is no spoon. - flyingmoose

Re: Re: Perl applications
by rje (Deacon) on Apr 13, 2004 at 14:33 UTC
    Of course you're right. But I wonder if it's deeper than that. Maybe this is some kind of brain-boundary thing, where one wiring prefers one expression, and another to another.

    Programmers already know that learning a language is not trivial (if every language were like every other language, why learn a new one?). There will be unusual formations to any language (except perfectly regular ones, which are prone to being boring in my opinion).

    In Perl's case the unusual formations are the shorthand used to get things done quicker. Larry's Hypotenuses.

    And perhaps some programmers don't like shorthand (Java anyone? How about COBOL?).