So, I’m writing a very simple demo of public key cryptography. Mostly for my own learnings, as something to do that’s interesting and not related to work.
So, I first wrote a simple demo in Java, then another in Perl that does the same thing. The goal is to create a simple crypto message passing system using UNIX pipes.
The thing that got to me though after writing the Perl example was just how much simpler and even enjoyable writing the Perl example was. Granted, it was also easier due to not having to figure everything out for the first time, but still…
In the Java example, it feels like half of the code is there to just convert one type of array to another and other as opposed to actually doing what it’s supposed to.
Also, the way that Perl handles Big Integers puts Java to shame. In Java I had to do this screwed up thing where I’m initializing a BigInteger by concatenating a regular integer to an empty string? Why wouldn’t they just make it possible to initialise the BigInteger with a regular Int?
Also, with Java, realising that you need to use BigInteger, you then need to figure out where to use which type and how to cast/wrangle the number into the type. What does Perl do? One statement at the top of the file to import a library which automatically converts all integers to their “big” equivalent. That’s it.