A Scripter at Heart

web applications are … are sketches, continually being redrawn in response to new data.

Some are. I hope Paypal is not.

The difference between programming and scripting is not the language but the mindset. If you approach your program as a one-off, throwaway kind of solution, you’re scripting. If you don’t handle errors in your program because you expect to be watching it every time it’s run, you’re scripting. If you approach your program as a thing that might be around for years and better work right even when you’re not there, you’re programming. If you’re writing software that somebody else should be able to use without intervention from you, you’re programming.

Neither scripting nor programming is wrong. They are only wrong in context. The most common, most dangerous mistake is when a script gets promoted to the status of a program. How many times has an Excel spreadsheet, created as a one-off, been turned into a core business artifact? How many times has that spreadsheet had a serious, silent bug in it?

It took me a long, long time to learn C. Five years, really, to be comfortable with the basics. And I still don’t know it as well as I should.

As a child, I didn’t like it for the same reasons you didn’t: confusing compiler errors, having to think like a machine, putting time into fixing the mechanism rather than fixing the problem. No instant gratification. BASIC was much more fun.

But C is incredibly rewarding. Like anything that requires a lot of effort, there is a pay-off, and the pay-off is: when you write a line of C you have a pretty good idea of exactly what the machine is going to do. Not a completely clear idea, thanks to modern optimising compilers. But a pretty good idea.

And you’d be right to imply that knowing exactly what the machine is doing is completely irrelevant for most modern programmers. But there are niches:* systems programming (my niche), graphics (though this will eventually change), and – of course – someone’s got to write the interpreters.

Ultimately it doesn’t matter what the purpose is, because, for me, being a programmer is about being curious. Learn a few programming languages in the same way that you might learn Spanish, and for the same reasons: it may not help you out immediately, but it opens up your world a little more.

  • I don’t know if I agree with Joel’s argument, that it helps you understand the performance implications of higher-level code, simply because the abstraction is too great. Sure, it’s nice to know that repeated string concatenation in Python is slower than building a list and ‘’.join()-ing it, but the manual tells you that, and when you really need the knowledge (will re.find() be too slow over this data set?) knowing that the re module was written in C won’t help.

Quote What happened next was the eight unhappiest hours of my computing life.

How about passing from GwBasic user manual reference as the first programmer book into Advanced Assembly Language on the IBM PC as your second?

Beat that as a new meaning of unhappy hours :wink:

Love your blog.
Chiming in re: Perl 6: No one seems to get what it is all about.

Yes, it’s a complete re-write of the Perl internals (which takes a ridiculously longer amount of development time than a mere version release, not to mention that Perl 6 has higher standards than say, the first released version of PHP, which was Pure Hot Poo-poo), but it’s more than that: the project’s resources are inextricably bound to the Parrot Virtual Machine, which not only runs an implementation of Perl 6, but also Tcl, Javascript, Ruby, Lua, Scheme, PHP, Python, Perl 6, APL, LOLCODE, .NET, etc… See http://www.parrot.org/

So to fully understand the scope of what’s happening, here’s an analogy: it’s like the community is writing the Java language for the first time, only the language is much more complex and intricate than that Java language. Java also has its own virtual machine, so the community is inventing a virtual machine. Not only does this virtual machine run the language it was developed for, but other languages as well. And it’s not just for running other languages, other languages will be able to share modules (like, a Python script can use a Perl module) because of the virtual machine implementation. This is a big, huge deal. It’s not portrayed by the community as such, because they realize it’s going to take a long time, and don’t want people to become overzealous over something that will be released next Christmas as they say. They’ve received funding by Mozilla Foundation and other great offers, but to continue the Java analogy, it’s not like they have Sun sitting behind them. This is an amazing open source project, mind-boggling, really, so if people can start clearing up the P.R. on this project (Perl people aren’t generally good at P.R.: they just care about writing beautiful, jedi-master code), then that’s a step in the right direction.

Your javascript worked on my XP machine but not on my Vista machine. Moral of the story: Vista is GOOD. XP is EVIL.

I have a very similar background. I wasn’t a real programmer until I learned C and somehow passed algorithms.

Interesting, these days, using Python feels a lot more like programming than Java… In Java all I seem to do is set up a bunch of config stuff for spring, os workflow, hibernate, kodo, etc…

EXACTLY

What happened next was the eight unhappiest hours of my computing life.

Ever wonder what might have happened if you had taken her up on it and gone downstairs? Probably the same thing only a day later I guess, but you never know.

This language took what I had known as programming and contorted it beyond recognition, into something stark and cruel.

what you needed for a first compiled language was Turbo Pascal.

As a college student I usually think that learning C is important, but not fundamental. Actually I think you should learn a low level language, any language really. Pascal is just as good for that as C.

You don’t need to be a kernel hacker. You need to know what is below the abstraction. You don’t need to build a complete database in C, you need to know how to manipulate a B-tree in C/Pascal/whatever, you need to know how to deal with graphs and at least know the algorithms (but not have them on your head all the time).

I my experience I had 3 semesters of hardware classes. I built my own 16 bit ALU using only logic ports. I built my own 8 bit processor (around 8 instructions) with logic ports, state machines and VHDL and I found that almost as important as my data structures class taught in C.

In summary, you need to know how the abstraction you are working with actually do. You don’t need to know how build that abstraction all over again.

It is practically impossible to teach good programming to students that have had a prior exposure to BASIC: as potential programmers they are mentally mutilated beyond hope of regeneration.

  • Edsger Dijkstra

I think C was, and remains, the language I enjoyed working with the most…

Source of the Edsger Dijkstra BASIC quote:
http://www.cs.virginia.edu/~evans/cs655/readings/ewd498.html

If modern languages are Turing complete, those are what? Assembly?
For example, they have a very limited set of phonems and they don’t have numerals, but one, few or many, or something along thesse lines.
http://en.wikipedia.org/wiki/Pirah%C3%A3_language
http://en.wikipedia.org/wiki/Rotokas_language

I love C and C++, it’s a pleasure to program with them.
You just had a very bad start with C, give it another chance! ; )

I don’t get it. Are you trying to say that Mr. Wall can’t speak about anything publicly until Perl 6 comes out? If not, what difference does it make how much he pontificates about the differences in scripting and traditional languages?

Another shitty fatwood blog entry. You used to be good.

C is hard. Let’s go blogging!

What? I must be missing something here… the point at which compiling and linking occurs during the development cycle has a profound impact an what programming vs scripting is?

This is a non-argument, you could have just tweeted I like REPLs. I feel like you feel there’s something more profound here… but I’m missing it somehow.

My programming path was BASIC-assembler-Pascal-FORTRAN-C. If you learn assembler first, learning C becomes a joy because you already know the concepts and can implement them more concisely. If you learn Pascal or FORTRAN first, learning C becomes a joy because C is far more productive.

Actually, my most favorite programming tool was a wire-wrap gun.

I’m an engineer at heart. Scripting languages give me hives - they tend to be so flexible that I can never figure out how a given problem is supposed to be done - either the syntax changes in strange ways (Perl), the language itself changes (AppleScript), or there’s a strange mish-mash of standard and optional features (pretty much everything else).

I like static typing, which keeps me in tune with planning code instead of just writing it willy-nilly. I love designing data structures and object relationships - once you grok it, it’s nearly impossible to go back to procedural cruft, or the sorry state of objects in most scripting languages. I like that variables, calling conventions, etc are always consistent and follow a clear grammar. I’m sorry, but I don’t get any of that out of scripting languages.

Now memory allocation and pointer manipulation - that I can’t say I miss terribly. You could achieve some very elegant and high performance code, but the ease of making catastrophic mistakes was just too high. Overall, I’d say I love Java most for its syntax similarity to C, its huge and flexible API, and lack of pointers and memory management. If only I could easily and simply write native code with it, rather than be shackled to a JVM.