?

Log in

No account? Create an account

Previous Entry | Next Entry

Programming For Klingons

The Spanish for "business" is negocios, which I like.  The French seem to use the rather straight translation le business or the more formal affaires.  Do the Spanish tend to see a business deal as primarily about the negotiations?  I don't think so - I'm no big fan of the Sapir-Whorf Hypothesis (something I first heard of as the "Whorfian Heresy", which might give you a clue as to the opinion of the linguist who I was talking to).

I think there's another Whorfian Hypothesis, that Klingons would have a different approach to programming; in their version of Python, del would become obliterate, remove would become abduct-and-return-for-questioning and there would be no co-operatively multi-tasking systems; everything would compete aggressively for resources.  There's a whole blog entry in there, about the co-operative environment within computers but the Darwinistic competition outside... though not today.

But enough of such babblings; the Sapir-Whorf Hypothesis does apply, I think, in the area of programming languages.  Most programmers I know tend to think via a particular programming idiom[0]; that is, they tend to address a problem in the ways that their main languages allow.  It goes further than languages too; as a Unix-esque person I'll tend to think of networks of processes piping stuff to each other.  A Windows developer might tend to see everything in terms of COM objects.  And so it goes.

I'm not arguing that a programmer is blinkered by her choice of language; that would be extreme and I don't believe it to be true.  What I do think is that different languages afford different ways of doing things (and I mean afford in the Heideggerean sense[1]; they make various possible ways to solve a problem either easier or harder.  For example, any C programmer who's knocked around a bit will have dealt with a fair number of C strings and the complex and tedious code that often attends them.  Therefore solving a problem in a string-oriented manner might not be the first approach they'd take.  Conversely, someone whose world revolves around Perl (or Python) would consider complex string operation as easy.  One of the biggest differences is probably in the nature of the data structures that a language supports.  I find myself constructing far more complex arrangements in Python than I'd ever have considered in C, simply because the language makes it easy and safe to do so; the potential for error is vastly reduced.

As someone whose predominant language is Python these days, I use mapping objects and lists far more than I ever would have in my C days.  I was a good C programmer; no corner of the language was a mystery to me and I could generate or parse obfuscated examples with the best of them.  But far too much of my time was spent in (a) being clever for the sake of it and (b) writing the same code over and over to address the same mismatch between the essential high-level-assembler-ness of C and the abstractions that the project at hand actually required.  One day, deep in a debugger, I realised that pointer errors just weren't fun anymore; probably the start of my long and all-too-slow growing up from wild hacker to something that might one day be called "software engineer".

But let's take one particular language vs. language debate familiar to most Pythonistas; that of C++ vs Python.  For me, the single biggest difference between the two is not their abilities in the abstruse and specialised areas like metaclasses, nor the particular semantics of their class and object mechanisms, but the low-level and almost invisible (to a Python developer) issue of garbage collection and object disposal.  It's this, I think, that has at least the potential to make Python such a productive system; the removal of the C/C++ need to continually concern oneself with the question of who is to free allocated memory[2]; that whole notion of memory "ownership" that the programmers have to track themselves through comments and documentation[3].  Sure, if I'm going to think carefully about the nature of my data structures I may need to choose to use weak references at time, or use del as appropriate, but even at its worst there's nothing like the weight that's imposed on someone thinking in the medium of C++.

[0] That is, they think in terms of what a language can do rather than in the specific details of its syntax.  I'm not aware of any Python distributions that can be cranially installed (yet).
[1] Readiness-to-hand or utility of tools and objects, to be a little more specific.
[2] See the section "Automatic Transmissions Win The Day".
[3] Before a flood of C++ enthusiasts bombard me with links to articles like this (which argues that explicit memory management a feature, not a defect) or this (which proposes solutions to the issue, written in more C++), let me say that (a) it's only a blog entry and you're free to disagree and that (b) the wealth of results that a Google search for "C++ memory management" returns is an illustration of how big an issue this is. :)

Comments

( 4 comments — Leave a comment )
(Anonymous)
Jun. 24th, 2004 05:26 am (UTC)
Your etimology at the beginning of the article is rather wrong. 'negocios' derives from Latin 'negotium', which is the negation of 'otium' (idleness). So it means the same thing as 'business': doing useful things as opposed to doing nothing.
Maybe you are confused by the manifold derived meanings and words that remain in modern English, where of course 'business' has prevailed over the Latin counterpart.
benlast
Jun. 24th, 2004 06:30 am (UTC)
This may be so, but the Spanish for "to negotiate" is (according to my lil' dictionary) negociar, so I guessed there's at least a link there in the Spanish-speaking brain :)

'Course, if any native Spanish-speakers care to enlighten...
regards
ben
(Anonymous)
Jun. 24th, 2004 06:30 am (UTC)
that is the core reason people still use lisp 40 years after it was invented. It lets you model the language after your thoughts, instead of letting you think in terms of the language
benlast
Jun. 24th, 2004 06:41 am (UTC)
Interesting... but surely all languages impose some constraints on the way one approaches a problem? Personally, I find the syntax of Lisp sufficiently annoying to form a barrier to achieving one-ness with the development environment, but that's just me :)
regards
ben
( 4 comments — Leave a comment )

Latest Month

June 2014
S M T W T F S
1234567
891011121314
15161718192021
22232425262728
2930     

Page Summary

Powered by LiveJournal.com
Designed by Lilia Ahner