Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: Argument for Perl ( again and again )

by afoken (Chancellor)
on Oct 19, 2012 at 18:04 UTC ( [id://1000005]=note: print w/replies, xml ) Need Help??


in reply to Argument for Perl ( again and again )

I think the main question is: Does the language get the job done?

The last six months, I've reworked a 30 years old legacy system written in MUMPS to use some state-of-the-art hardware. Low-level drivers for the hardware were delivered as DLLs written in C, High-level drivers came wrapped as Java classes, using JNI and Python wrapped in Java. High-level communication uses hexdumps wrapped in XML. My first attempt was to use the low-level interface and a MUMPS-C-Interface, but that failed because the low-level interface is essentially unuseable. So I tried to embed Java inside the MUMPS process, that failed because of at least two different C runtimes fighting out who owns the processs and who can create threads. Instant crash. The final solution is a TCP server written in Java that communicates with the high-level drivers and translates XML and hexdumps into something that can easily be parsed by MUMPS. The MUMPS process communicates via TCP/IP with the Java TCP server.

Missing details: A custom C program loads the Java runtime. A big Makefile written for both dmake and GNU make builds everything. Perl to generate some code and the documentation for the MUMPS code, and to test both Java and MUMPS code. Perl also converts legacy data written out by MUMPS as CSV into a new format, generating executable MUMPS code to reconstruct the data in the new format. InnoSetup builds a nice setup.exe, using Pascal for scripting during the setup. And a second Java program, also started via a custom C program, that connects MUMPS to an an external SFTP (SSH) server.

So, what's the "best" language? I used to say (or even shout) "Perl, because of CPAN, and because it stays out of my way". That's still true for many problems, but in this case, Java was "better" because of the 3rd party high level drivers written in Java. Interfacing those drivers from anything else than Java would have added even more layers of wrappers, making the solution even more complex than it is now.

I've learned that it can be very helpful to have more than one tool in your toolbox. I use Perl, and I prefer it for many problems, but I have no problem to use C, Java, Javascript, Bash, Pascal, MUMPS, assembler or a Makefile if that solves the problem easier or cleaner than Perl. And when it comes to adapting things that were never designed to fit together, I combine my tools, as shown above.

Alexander

--
Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)
  • Comment on Re: Argument for Perl ( again and again )

Replies are listed 'Best First'.
Re^2: Argument for Perl ( again and again )
by afoken (Chancellor) on Oct 20, 2012 at 05:32 UTC

    thomas895++ implies something even more important in Re^3: Argument for Perl ( again and again ):

    You should know your tools, their strengths, and at least as important, their weaknesses. This is so natural to me (coming from a family that has a lot of qualified craftsmen) that I completely forgot to write it down explicitly. Only if you know your tools and your own skills and limits, you can make a reasonable choice. If not, things will end as explained in the current sig of roboticus: "When your only tool is a hammer, all problems look like your thumb."

    (I'm currently trying to add Lua to my set of tools, but too many problems still look like my thumb when I use Lua.)

    Alexander

    --
    Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1000005]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (5)
As of 2024-04-19 16:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found