Port Scanning Shootout 

Port Scanning Shootout

I have been trying to decide what new programming language to learn. The choice for me is mainly based on three criteria.
1. Nice, clean and useful
2. Decent community. In the sense of a good few libraries and people willing to help out.
3. Different, I want to get my noodle around something new so a Java, Perl, C, C++ knock off does not really interest me.

So the chooses seemed to be LISP, Ruby, Haskell or some such functional language.
There is all sorts of program language shoot outs. One problem with these is your comparing leet users with other leet users. An assembly program might end up being quicker but other then lines of code they do not really factor how difficult this program is to write, most importantly how difficult it is to get up to the level where you can write like this. The second problem is these benchmarks are necessarily contrived and so as soon as they are known can be gamed by language creators, i.e. introduce a language function “Fibonacci” or something more subtle.

Instead of going by these benchmarks I decided to set my own. Find the source code on the web to a port scanner written in a load of languages and make a comparison. This arbitrary unfair comparison is designed to test how well used and friendly a language is, how a program looks and be an actual example rather then an already gamed. This test is entirely unfair given that it is on a random topic that may be of interest to no one else and that it is based on my subjective judgements of what looks like nice code. If you can think of a program you’d rather write search for “PROGRAM” and various languages.
Yes you can write this program in you favourite language, probably better then the examples below, but this is looking at how it has been done.

Ruby About 40 lines clear enough but the regular expression stuff is a Perl like explosion in a punctuation factory.

Java example is not bad once you strip away the GUI stuff it seems to be about 20 lines of understandable (not crap.MoreCrap.ActionListener.ShoutingCrap()) code. Just to realign the universe there is an overly complicated version.

Erlang, Ocaml, Dylan- no sample could be found

Perl about 40 lines of very clean code or shorter one that makes me feel like I’m about to pitch a fit. There are nearly as many Perl scanners out there as C ones which does indicate a thriving Perl community in this area.

Php about 10 lines of incredible simple code. Strangely this makes me think not that PHP is good but that the test is stupid…

VB: Thank God these were awful I was beginning to doubt the whole premise. If I had to use this language I.would.kill= kill.everyone. Looking at this code reminds me of the scene in wrath of Khan where the guy gets his brains eaten by the beetle.

C, C++ are clearly hot molten evil. Well not really check out codeproject and codeguru there is loads of examples of how these would be written.

Haskell 50 lines of indentation balancing monadic grappling goodness. Considering I started this quest after seeing this code and thinking it was good in retrospect it seems very big and not very clever, or at least so clever as to be stupid.

Code seems nice enough but for some reason the weird mixture of (o^+ in the rexexp parts make me feel like dancing the robot Genki Sudo style
Also redefining the syntax of loops does seem like showing off.

So what have we learned? Very little actually. I am still trying to decide between LISP, Ruby, Haskell.

Return to Main Page


Comment Out of the three you mention, my vote goes for Haskell (depending on what we're looking for). It is concurrent (unlike the ruby one) and it seems clearer than the Scheme one, plus it is completely typesafe, which is a plus.

Thu Jun 15, 2006 3:19 pm MST by Anonymous

Add Comment

Search This Site

Syndicate this blog site

Powered by BlogEasy

Free Blog Hosting