Flutterby™! : Top or Bottom Programming Languages

Next unread comment / Catchup all unread comments User Account Info | Logout | XML/Pilot/etc versions | Long version (with comments) | Weblog archives | Site Map | | Browse Topics

Top or Bottom Programming Languages

2011-03-04 18:45:04.491437+00 by ebradway 8 comments

Sean Leather linked to a blog post where different C compilers and the standards were compared based on a nasty piece of C code:

int foo (char x) { char y = x; return ++x > y; }

I'm not going to rehash the discussion but I commented to Sean that the real problem here is just plain bad code - bad style. The C language was originally designed to stay out of the way of the programmer. Give her enough rope to shoot herself in the foot. That the programmer needs to write better code.

Sean's reply was that maybe you should use a language that doesn't let you write bad code. Which really got me thinking...

Some people, I'm guessing like Sean, prefer languages that impose discipline on the programmer. Others prefer languages where the programmer has to be the discipliner. Gives a new meaning to Top-down vs. Bottom-up programming.

[ related topics: Books Weblogs Invention and Design Software Engineering Community Archival ]

comments in descending chronological order (reverse):

#Comment Re: made: 2011-03-05 16:06:08.167434+00 by: DaveP

Muckula-3. Oy! I'd nearly forgotten that, Dan. One of my first experiences in the printing world was a peek into a PostScript interpreter written in a weekend in Muckula-3. I'm convinced it did lasting damage.

#Comment Re: made: 2011-03-05 12:01:02.804959+00 by: meuon

Despite being a much simpler programmer (accounting/billing is easy stuff), I'm pretty good at manipulating browsers via html/css/js via PHP by hand, and break lots of convention, if not rules. I want it to work "my way", My lady language tries her best to do what I tell her, and only groans badly when she actually can't. Despite often using "doubles", we do use protection, and check for penny rounding errors. So far, none have escaped.

Perhaps that's why I don't like Java, you -have- to do it her way and she is very fragile, She uses the safeword "exception" a lot.

#Comment Sexy made: 2011-03-04 23:14:18.212594+00 by: spl

Nice analogy, Eric. I contend, however, that while I may be sub in some ways, my lady language does more for me than C does for you. In other words, our expressiveness goes far beyond the kama sutra in just a few lines. You may say: But wait, my Python gets me there, too. My response: My Haskell knows how to use protection. No STDs or unwanted children here.

#Comment Re: made: 2011-03-04 21:52:41.167273+00 by: other_todd

Yeah, Perl is where I really started to realize that just because you can't see the machinery is no reason not to bring safety equipment. For the most part I love Perl's magic scalars that you hate, because

  1. Otherwise I would be slinging back and forth between char and int so much that I'd never get anything else done and
  2. I have needed to work with numbers that have a decimal portion about twice in the last ten years.

BUT - that doesn't mean you can't be aware of what magic you're letting it do for you behind the scenes, because otherwise one day it WILL turn around and bite you (usually in true/false eval because while an empty string is sometimes the same as a zero, it is sometimes most definitely not, especially when going back and forth to Oracle like I do all day, where true/false and null/not null are entirely different tests).

#Comment Re: made: 2011-03-04 21:35:21.714933+00 by: Dan Lyke

Anyone remember Modula-3? If I remember right, you couldn't subscript your arrays with cardinal numbers. I don't remember if you started to see silliness like "array[cardinalvalue_val - (cardinal)0]" pardon my pseudo-C-ness) casting rather than trying to go back and fix the types throughout the modules that used them, but I'm sure that in any substantial code base it happened a lot.

I've gotten bit by C's promotion rules occasionally, but for the most part I'd rather have that than some of the gnarliness that happens when the language becomes too constraining and people start fighting the language to do what they know is syntactically possible but semantically constrained.

And I still shudder every time I get near numbers in Perl where I'm not sure if I'm getting doubles or ints, and doubles should do everything I want without dropping precision but there's always that first time...

#Comment Re: made: 2011-03-04 21:34:29.305001+00 by: other_todd

My initial response to that fascinating article was, "well, this is really interesting, but it's sort of a hair-splitting exercise, because that's code that should never happen in the real world," which I suppose is your answer rephrased.

I thought that I didn't have a position on dom vs sub coding, but then it occurred to me that I was thinking in terms of "if the programmer isn't bothering to do his own overflow testing, then he's doing something wrong." So I guess that makes me a dom programmer, after a fashion. I want the freedom to take the risks and Do It My Way Dammit, but I also figure that if you're not smart enough to know how to use the equipment safely, then you shouldn't be in the dungeon at all. (Pardon my stretching that metaphor beyond comfort.)

#Comment Re: made: 2011-03-04 19:56:30.743743+00 by: ebradway

I was thinking a little broader - do you want to be sub to your language? Or do you want to be top?

#Comment Re: made: 2011-03-04 19:51:43.762401+00 by: mvandewettering

The problem that I would claim is that while languages which make it difficult or impossible to do something bad also tend to catch some of the good stuff in their net. For instance, C provides you with many unsafe items (most related to unsafe pointers, but a few other thorny bits as well), but in general does a much better job at allowing the programmer to access the full capabilities of the machine (only after huge investments of time and effort in compiler technology has Java even begun to approach C).