Scripting or compiled?

I spent some of my weekend searching the web for C++ tutorials. It was an interesting exercise, because I now have the impression that people who write tutorials for compiled languages think rather differently to people who write about scripting languages.

Scripting tutorials seem to begin by defining an interesting task, then explaining how to do it. When I first wanted to use Perl to fetch and parse data from the web, I used an excellent tutorial entitled “Scoring a Web Page with Perl and LWP”, no longer online so far as I can tell. Similarly, the BioPerl tutorials get straight into the business of parsing and manipulating biological data files. This is my preferred approach – I think the best tutorials show you how to do something useful, interesting and real-world straight away.

On the other hand, many of the tutorials that I’ve read for C, C++ or Java seem to concentrate solely on the structure and syntax of the language. They begin with “Hello World” then take you through variables, loops, control structures, pointers and functions. At some stage they get to objects which are always explained using a variety of analogies (cars, animals, computer parts). And then – they stop. You can go through a 12 or 20-part tutorial, understand it fully and still be unable to code anything more useful than “Hello World” at the end of it.

I wonder why this is? Is it because to do anything useful with these languages, you need in-depth knowledge of their libraries, which is beyond a simple tutorial? Or are “scripting people” more practical and interested in getting the job done quickly? Or perhaps languages like C/C++ are traditionally more suited to mathematical operations, preferred by engineers and physical scientists, whereas biological scientists do more text processing and so prefer the “quick and dirty” script? Or is it just a feature of web tutorials – perhaps I need a book.

I’m interested in how other computational biologists learned their programming skills, what languages they use/prefer, how they came to choose those languages.

4 thoughts on “Scripting or compiled?

  1. Well , I come from biochemistry. My first computational tasks were setting up a web server for expression data and some comparative genomics analysis. For the first I tried javascript and for the second I learned perl. Latter on I also tried Java when, for a couple of months, I was interested in image analysis. I have to say that for most of the things I do (data integration/comparative genomics) I prefer Perl. I just think I can code faster with it but it is also probably because this is the one I am used to. In retrospect, probably it would have been better to stick with Java (or some other object oriented language) because of issues related to code re-usability. I have only one Perl package with a couple of functions that I programed and re-use. Most of the time I end up copy-pasting or re-writing things. The other question is run-time. Again for most things I do this is not an issue. I also have access to a cluster so if something takes a long time to process I find a way to break it into smaller parts and run it on a cluster.
    Coming from a biology background I have accepted that I don’t have what it takes to play a role in method/algorithm development so I try to focus on finding good biological questions to answer.

  2. At the university we were taught Pascal.
    During my first PhD, I needed a program to quickly find sub-cloning strategies using restriction enzymes. As this software didn’t exist I looked for a language it be by myself. This was in 1994. I didn’t remember why I choose ‘C’ but CloneIt was my first program (at this time I didn’t knew about make, gcc…) . I learned C with THE Kernighan.
    I then switched to C++ using the book from O’reilly Practical C++. Which was a good book but was missing everything about the STL. I then learned many things from the net and from the Stroustrup‘s book. Then a little bit of PHP. Then, I switched to Java, because nowadays, you need it to build a code running everywhere, to build those nice GUI interfaces and…. to find a job. Learning java from the web was easy with my experience of C++.

    The future: java J2EE and ruby.


  3. Yeah, I’m a big Ruby fan too, Pierre. It’s probably the closest to the way I think and has a syntax that doesn’t make you fight with it. I used Perl throughout grad school and was always annoyed that simple things like making arrays of arrays was such a pain.

    But going back even further, I learned programming on microcomputers in the 1980s — which meant BASIC. Later in undergrad, I used Pascal for a data structures course and learned some C as I started to play with Linux. In grad school it was C for things that needed to be fast, Perl otherwise. In my postdoc I had a colleague who was into Ruby and have been mostly using that for the past five years.

    As for Neil’s question about why compiled tutorials seem to be different from scripting, I think one reason is one is that the libraries in a compiled language aren’t really seen as part of the language (and may vary from implementation to implementation), whereas a scripting language is considered to include all built in functions/classes.

  4. I agree with Jonathan, I suspect that the reason is both historical and philosophical.

    I had exactly the same experience of trying to learn C after python. From the computer science standpoint, this is probably the reverse way of doing things. C was intended by design to be very low level, minimalist if you will, due to early resource limitations. Oddly it was also intended to be portable between platforms, however all those compiler and platform checks you see fly past you every time you do a ./configure, show you that portability has never been the case. This is, as far as I can tell, is due to platform specific implementations of various APIs/libraries.

    So I think what this means is there is no such thing as a consistent C/C++ developer experience other than the core of the language ? Which is why all the tutorials and beginners books only present the core language. The other reason is that developing solutions to parsing problems in C is non-trivial. The kind of tasks that you routinely accomplish in Perl, would fill chapters of a book on C or C++, that is if you didn’t use libraries. Since libraries are very platform specific (Win32/Linux/Mac) then you have to read a book on C++ development for that platform. It is likely that those books will cover all the fun stuff…

Comments are closed.