Related Entries

Quick Start: Git for personal use
SVN client over SSH to remote Unix server from Windows
Quick Start Grinder - Part V
Quick Start Grinder - Part IV
Quick Start Grinder - Part III

« Java links
» Server side python

A little too simplistic definition

How do you differentiate scripting from programming?

I was reading a DevX article titled Build a Reflection-based Interpreter in Java. It has an interesting sidebar, viz., Scripting vs. Programming

The author comes up with a rough conclusion that scripting languages follow quick and dirty programming style, whereas system programming languages follow a thought out programming style.

Give me a break! This prompts me to rant.

I'm pretty comfortable with C - though I've not programmed using C since 1999 and Java. These are supposedly considered to support thought out programming style. Since 2000, I gradually moved to using Python, a scripting language. One major reason I started liking Python is that it is hard to be dirty with it. Most of the times, writing elegant code is quicker than writing dirty code in Python.

In C or Java, the product of my thinking out prior to coding is usually pseudo-code. With Python, that is one less thing to do. Why? Because pseudo-code works! Ok, that is my favourite quote. In simple terms, real production quality Python code is not much different from pseudo-code.

Which means, it is the most efficient way to maintain code. All kinds of documentation is right within the code. There are tools to get the documentation into different formats. Javadoc can do the same thing? Sorry folks, no. Look at how Python is an engineer friendly language, by actually supporting a __doc__ attribute for every module, class and function. This is much better than fooling around with slash-star-star ... star-slash.

By the way, the article above is about Reflection. Compare with Python's Introspection

Here's another thing I love Python for. Lists and Dictionaries. Processing data structures couldn't be simpler. Or more intiuitive. Want a slice?

Anyway, as a programmer, my productivity, measured in lines of code required to make meaningful software is important to me. It is not only the total lines of code that matter.

That said, I like Java better than I like C. Still, I find it hard to call Java (or C#) a modern language. Simply by avoiding pointers or by requiring everything to be a class is not exactly ground breaking language design. (n)Ant and xUnit testing are probably the only things I find useful enough to enhance engineer productivity in these modern languages.

I had a similar rant last year too :-)

  1. I guess a lot of people believe that just because a piece of code written in Perl (or Python) looks simpler and is moer easy to implement, it should be a more higher level language and hence a less powerful language. I tend to agree with the less powerful thought, but the next jump of logic is wrong. Because the language is slightly higher, calling the programming style quick and dirty is not correct. Yes, it is language where thought-to-code time is lesser, but that does not mean that the style is any thing inferior.

    Because C is faster to code than assembly, would anyone call C programming less effecient than assembly?

    Posted by: Srijith on July 7, 2003 07:15 PM
  2. Frankly, I think the term 'scripting language' is wholly unhelpful at this time.

    Posted by: Simon on July 8, 2003 02:48 AM
  3. Speaking of help() functions and introspection - if you haven't played with the help(obj) functionality in the Python 2.2 and beyond interpreters - do so. It's wonderful.

    Posted by: J.Shell on July 8, 2003 10:36 AM
  4. I've always liked this definition by Clemens Szyperski, taken from his book "Component Software":

    "Unlike mainstream component programming, scripts usually do not introduce new components but simply "wire" existing ones. Scripts can be seen as introducing behavior but no new state. /.../ Of course, there is nothing to stop a "scripting" language from introducing persistent state — it then simply turns into a normal programming language"

    Posted by: Fredrik Lundh on July 8, 2003 11:38 AM
  5. #3 - yes. Discovering help() and dir() were pure A-HA moments :-) After seeing many surprised look on many non-python-programmers, I posted a weblog entry about those: http://vsbabu.org/mt/archives/2003/02/13/joy_of_python_dir_help_and_pprint.html

    Posted by: Babu on July 8, 2003 11:51 AM
  6. I guess many people associate "scripting language" with "script". Often, shell scripts (and batch files) are indeed quick & dirty... you hack on them until they work, and then you leave them alone, because they do their job.

    Apparently not everybody realizes that a so-called scripting language can be used for more than writing scripts. (And of course, one could argue about what a scripting language is exactly, and whether Python is one...)

    Posted by: Hans on July 8, 2003 01:12 PM
//-->