Tim Bray recently expressed doubts about PHP:
So here’s my problem, based on my limited experience with PHP (deploying a couple of free apps to do this and that, and debugging a site for a non-technical friend here and there): all the PHP code I’ve seen in that experience has been messy, unmaintainable crap. Spaghetti SQL wrapped in spaghetti PHP wrapped in spaghetti HTML, replicated in slightly-varying form in dozens of places…PHP has earned everyone’s respect by getting where it is, and Sun should reach out to it more than we have. But in the big picture, it feels vulnerable to me.
Tim’s lamentations about PHP reminded me of my initial encounters with, and reluctance about, some of the computer languages I’ve used–and I’ve used a goodly number. All in all, I can ‘speak’ 20 computer languages. My head is a jumble of languages–a veritable tower of babble.
(Discussion about programming languages and showing of wounds earned follows. Note that I make use of naughty language. Lots and lots of naughty language. It’s a code thing.)
BASIC
I started with BASIC. Contrary to popular myth, that’s B-A-S-I-C, which stands for: Beginner’s All-purpose Symbolic Instruction Code. However, the language is now usually given as just ‘Basic’.
I wrote my first application in BASIC in VAX/VMS. A not particularly useful combination at the time, but popular in colleges for classwork. Yes, I wrote my first application in college, not at home on my PC or laptop. They didn’t have PCs in a box or laptops at the time. You could have a home computer, but you’d have to either hack one, or spend a lot of money on one.
They did have the Internet–and that’s big ‘I’ Internet–but no Web. You could interact with people, though. Usenet, was big–for all those science types to talk about sex.
Anyway, it’s through BASIC that we get the origination of the concept of ‘spaghetti code’. This is code that uses a command called a GOTO to indiscriminately jump about in code to the point where you can’t follow what’s happening, and the code looks like, well, a pile of spaghetti jumbled up on a plate. The following application is an example of spaghetti code, in BASIC:
10 dim i
20 i = 0
30 i = i + 1
40 if i <> 10 then goto 90
50 if i = 10 then goto 70
60 goto 30
70 print “Program Completed.”
80 end
90 print i & ” squared = ” & i * i
100 goto 30
See? GOTO here, GOTO there — pile of doo-doo. My teacher, who actually had a PhD in English Literature but ended up in the computer sciences, said if we used GOTOs, he’d hurt us. Considering that he used to embed bits of Chaucer in his class presentations, I would have thought he would have embraced GOTOs, but, there you go.
That was my first language.
Pascal
My second language was Pascal. This is a language named after that great mathematician Blaise Pascal. It’s also a ‘teaching’ language and was never intended for commercial use. Many software developers learned how to program in a computer language they would never use again once they left college. This is just one of the many head fucks universities put their CompSci students through.
(Even then, the world has a way and Borland released Turbo Pascal. Why? Because Borland was led by a French man, and you never tell the French what to do. Bonus point: who was Borland’s founder?)
Anyway, Pascal is good because it’s a structured language and would, the hope was, teach us all how to be good structured programmers. It introduced us to functions and subroutines and proper naming and rigorous development practices–which we promptly forgot as soon as we got out of school and got into eXtreme programming; drinking caffeinated pop and telling each other jokes where the punch line goes, “…but it worked in PowerPoint!”
We ended up using Pascal for other classes, such as the study of algorithms and relational data structures. Yes, I believe I learned how to do the Bubble Sort with Pascal. This was, what, a quarter century ago, yet Google and Yahoo and other companies still ask potential employees how they would do something like a Bubble Sort.
You know what I would answer if asked this in an interview? Easy:
sort();
Then I would ask the interviewers could we please now get to the real questions?
Assembly
Where was I…programming languages… My next language wasn’t a higher-level language. It was Assembly. Yes, we had to learn Assembly back then. What amazes me is that people are required to learn Assembly in college today. This to me is a demonstration of how most colleges and universities haven’t a clue how to run a computer science program.
Wikipedia had the following assembly language sample:
mov al, 061h
Basically, this is equivalent to moving a hexadecimal value into a register named ‘al’. It is very time consuming. It’s also very powerful — this is to ‘the metal’ programming — as efficient as one can be. One line of code at a higher level language can translate into 10, 20, even more lines of assembly. At some point corporations discovered that it cost more to have programmers write those 10,20, or more lines than it did to add memory or disk space, so most of us don’t use Assembly in our day to day operations.
Modula II, LISP, SNOBOL4
From Assembly, the languages piled on rapidly. We beta tested the first Modula II compiler, which was meant to be a commercial version of Pascal (but never really took off). We then jumped into the esoteric with Lisp (LISP) and SNOBOL4.
Lisp is one of the oldest higher-level programming languages, and is very popular with the AI folks. In the Parable of the Languages story, I called it ‘loopy’ and that’s the best definition I’ve heard of it. I remember talking with my teacher one day about the class. We talked about how each language has a ‘gotcha’ moment when the person learning it finally ‘gets’ it. I asked him when I finally reached this state with Lisp, it would hurt, wouldn’t it?
I still passed the class.
I bet if you’ve heard of Lisp, you haven’t heard of SNOBOL. SNOBOL translates to StriNg Oriented symBOlic Language, but supposedly the real reason for the name is one of the implementors once said, “This program hasn’t a snowball’s chance in hell…”.
I took to SNOBOL4 like a fish takes to tartar sauce–so much so that the next time it was taught, the professor (he of Chaucer fame) had me as teaching assistant. It was when working with SNOBOL4 that I finally learned the most important lesson a CompSci needed to learn: that every problem, no matter how complex, can be broken down into smaller, simpler components.
This might sound intuitively obvious, but it’s actually a tough lesson to learn with programming. Normally when faced with a problem, we see it as a whole and try to solve it as a whole. This is the number one reason for bad code, spaghetti code, what have you. We see the whole, it intimidates us, frustrates us, and we rush our coding so that we’re done that much more quickly. If, instead, we look at the problem and break it down into manageable pieces, the solutions become clear, the code simpler, and we’re relaxed when we write the program.
The more relaxed the programmer, the better the code. This is a lesson that Microsoft never learned. Can we say, “Bug ridden piece of shit”? Better yet:
OUTPUT = ‘Hello World! Windows is a bug ridden piece of shit!’
END
C
What about the C programming language? Yes, what about it. I’ll have you know, I didn’t spend all my time on esoteric languages. I still have my first copy of the classic Kernighan and Richie’s The C Programming Language (second edition).
In my last year of college, the head of the CompSci program told me that one of the other departments needed a C programmer to maintain some geographic programming software that was used by the military in the neighboring Yakima Firing Center. The CompSci head asked if I was interested in the part-time position?
Wow, my first job programming. And then I saw the code.
File after file of code scattered all about a machine, with no external documentation and exactly one line of comments in all of it. One line. To this day, I wondered what would lead a programmer to write one, and only one line of comments. I looked and followed and tried to follow and ended in dead ends with no clue as to how the code ever compiled, much less managed to work. I approached the head of the department controlling the code and said I would need something, some kind of key, in how all this code held together. He then arranged for me to meet with the original developer at a conference in Seattle.
So I asked my now ex-husband to get a day off from work to drive me over (I didn’t drive at the time) and we found the hotel where the conference was, and waited in the car outside for it to end. As it did, one military uniformed person after another left until this one guy–bearded, glasses, button down, pocket protector, the whole geek thing–came out. I guessed this was the person I needed and approached him, introducing myself. He’d already been told I would be coming and as I started asking him about the structure of the entire application, he whipped a pen out of his protected pocket, grabbed a paper napkin, wrote a bit of code on it, smiled toothily at me, passed me the napkin and was off after the uniforms.
I stood there, holding that napkin for a long, long moment. I didn’t even have a chance to ask him about that one comment line.
This was the second most important lesson I learned in college: that people working in computers can be fucking assholes. And here you thought I learned this from weblogging.
I fumed all the way home, and told the department head that I found the person’s help to be less than useful. I also turned in an expense report for the trip, at which point he exhibited surprise and said that they had no idea that I would want to be paid for this work. Oh no, they thought that I would want to use this as fun little challenge. This was news to me, as it was to the CompSci department head, who had some choice words to say to his peer about using and abusing his students.
Third most important lesson learned: Employers will play up the ‘fun’ bits of a job, in order to distract you from the fact that they’re sucking you down to a brittle little former husk of yourself by working you long hours for little pay. Might remember that next time you have that free lunch at Google.
Fortran, not COBOL
Let’s see, what’s our count so far? That’s Basic, SNOBOL4, Assembly, Pascale, Modula II, C, and Lisp. Seven languages.
It wasn’t long after that I was introduced to the old timer, the granddaddy of them all: Fortran. Fortran (or FORTRAN for FORmula TRANslation) is as old as dirt, and has existed forever–at least as long as man. I kid you not, there are cave paintings that could successfully compile through a Fortran compiler.
Fortran was one of the few languages I learned in college that I used in my professional life. Fortran was the language used for Peace Shield, the Saudi Arabian Air Defense System. My job was to take the Fortran created by three separate companies, and reverse engineer it into a data dictionary in order to facilitate the documentation project.
I loved this job. I would take home Fortran pads (Fortran was position dependent–the position in the page where you typed the characters in the program had a significant impact on what happened with the program) and work on the design of my data dictionary tools in the evenings and weekends. Eventually the company gave me one of the very first Compaq portable computers to use, which had an amber screen with black letter and which would crash, on average, once a week.
To mention ‘structured programming’ and Fortran in one breath would, at the least, generate raised eyebrows among the folks working on Peace Shield. The less polite would guffaw. Fortran, at least in those days, was not known to be a highly structured programming language. In fact, there was most likely only one other language that would be even worse to maintain and that was Cobol (COBOL).
(Now, I never learned Cobol. I caught a whiff of Cobol in college and didn’t like the smell and managed to get my degree and go 20 years in the industry without, once, having to write Cobol. I felt pretty clever, I tell you, for managing this–until I saw friend after friend retire early from all that money they made thanks to the Y2K frenzy. Happiest, smuggest people you ever did see.)
Languages…languages…
Icon, C++, Eiffel, Smalltalk
There was Icon, which was the attempted commercial version of SNOBOL4, but which never had a strong following. But I had a chance to chat with the creator, always fun. And it’s still active. And free.
Speaking of free, when I worked in the Database group at Boeing, they were nuts about Eiffel. Yes, while the rest of the world was heading into C++, they were into Eiffel. I hadn’t heard anything about this language for a while, so I searched around and found a Joel on Software forum entry on Eiffel. Seems like it costs thousands of dollars to get a development environment in this language. Thousands of dollars. For that kind of money, the applications should write themselves, let you go out and have a smoke, drink a latte.
In the Acoustic and Linguistics group, we worked with C++ and Smalltalk. We had one of the first Smalltalk environments in all of Boeing. I remember how we would provide demonstrations for visiting management, each of us with our fingers crossed because the applications would fail as often as not. But hey! No spaghetti code here! This was the Real Thing, babies: we were object-oriented a-l-l-l-l the way.
All the way down, that is.
Our count is now at 12, adding in Smalltalk, C++, Eiffel, Icon, and Fortran.
PowerBuilder, Java, JavaScript
I didn’t get into any new languages until I moved to Oregon. I did work with SQL and QUEL and shell scripting on five different Unix flavors, and though I consider these ‘languages’ others may not, so I won’t count them.
In Oregon, I learned the joys of creating applications with an application environment such as Visual Basic, and especially, PowerBuilder. My first tech book was on PowerBuilder. When I was approached about writing another, the editor gave me a choice between two brand new languages: JavaScript and Java. I asked which she thought would have more of a future and she said JavaScript. I found out later, she meant to say Java, but JavaScript has managed to survive nicely, too.
Java, Java, Java. At one point in time the world ran on Java, and it’s still one of the most common languages for corporate web-based applications. As the language became more popular, more additions were added to the language, and it grew in complexity until our sweet, modern language became this many-headed hydra, otherwise known as J2EE.
No language should become so complex and ever changing that developers in the language have to spend all their time keeping up with the mods. But you know, COBOL lost favor so the suits had to have some language to blame.
As for JavaScript, I ended up writing the book on JavaScript, another on Dynamic HTML, and contributed to others associated with this language. It has also grown in complexity, but it started so simple, there was room for growth. If there was any problem with JavasScript (other than those of security), it was because some companies didn’t believe they needed to play nice with others. Now this same company has promised to be good.
Uh huh.
Perl
It was during this time that I got into web development, which meant Perl. We have a lot of options for web development now, but then it was pretty much Perl and, well, Perl. (Don’t talk to me about applets–misbegotten sons of the devil.)
There were and are a lot of good applications written in Perl. There were and are a lot that are shite, too. Perl is a language easy to use poorly. It is a good language. I’m glad I learned it. I’m glad I used it. I’m glad I no longer have to use it. I paid my Perl dues.
And we’re now at 16, with PowerBuilder, Java, JavaScript, and Perl thrown into the mix.
From Oregon to Vermont, where I worked primarily in PowerBuilder and ASP, writing components in Visual J++, C++, and Basic, so no new languages here. From Vermont to Boston, where PB started to lose favor as Java gained in popularity. It was during this time, too, that I also did some work with Borland’s Delphi–the newest incarnation of Pascal that used to be a cornerstone of the Borland IDE products. That is, until the company dumped them earlier this month.
PHP
Then someone told me about this new web scripting language. I first thought it would be another Perl, and went, “Oh no, I’m into Java. Go away.” But this language was nothing like Perl. If anything, it was like ASP or JSP–it was a language embedded within a web page, and which was processed dynamically when the page was accessed. It was called “PHP”, and I loved it.
The first versions of PHP had significant problems and performance issues, but darn if it wasn’t easy to use! After years of languages that demanded a total life commitment from the developer, here was this cute and furry little language that you only needed to pat on the head now and again. It was so easy to use!
Still, the Java developers and the Perl developers and C++ developers and so on, looked down their nose at this cute little scripting language and ignored it. Ignored it until they looked around one day and noticed something…
PHP was ubiquitous.
PHP was used to create photo galleries and weblogging tool and commerce systems. There were libraries and modules and code samples one could use and they were all easy and free and best of all–you could drop these into your site and use without having to beg your ISP to add them to the system.
Just like with JavaScript, PHP had room to grow when it was originally created. As each new version was released, the language tightened, strengthened, and even popular web sites found that their PHP pages served up just fine.
All in the all, though, the best thing about the language was that developing in PHP didn’t make you cool. There were no developers writing convoluted, obtuse, articles about some little known and barely interesting aspect of the language. Groups of hackers didn’t huddle, late into the night, exchanging PHP horror stories.
No, most of the cool kids stayed with oldtimers like Java, Perl, or C++, or went to new kids like Python–leaving the way open for just anyone to develop with PHP.
And they did.
The Uncool PHP kids
Since the people developing with PHP weren’t cool they did uncool things like demand that the language maintain its simplicity and ease of use. Of course, the fact that anyone could code in PHP meant that the code produced could vary in quality. But there is another odd thing about PHP and the code developed with it–most of it is free. Not only is most of it free, most of it’s open source. So even if the code starts out hinky, doesn’t mean it has to stay hinky.
How do you eat spaghetti? You use a fork.
Python, Java, JavaScript, Ruby, Delphi, PHP
In the last few years, I played around with Python, and I’ve kept my Java dusted, and we all know what happened to JavaScript, the little language that could. But it wasn’t until recently that there’s been a new challenger for my affection. After all, they say Rubies are a girl’s best friend.
And with Ruby, Python, Delphi, and above all, PHP, we have 20. That’s twenty languages. Of course, writing all of this has made it impossible for me to blame the language when my code is crap.
Darn it.
I remember when I was slashdotted for Parable of the Languages, back in 2002. Mark Pilgrim chuckled about the fact that the page was written in PHP, and wondered when it would melt down. At that time, I wondered the same and would have agreed with Tim about PHP being vulnerable.
Now, four years later, PHP bids fair to be the baddest bitch in the ‘hood’.
Don’t Forget…C#
Tcha! And I forgot one language: C#. I actually rather like C# too. Almost wrote a book on it.
The memory is the first to go.
Hee.