Programming Sucks, Always
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to produce bigger and better idiots. So far, the universe is winning.
— Rich Cook
Programming is a hobby of mine. I have yet to figure out why. Programming is a pastime similar to banging one’s head against a wall, but with fewer opportunities for reward. I personally cannot understand why anyone would electively major in Computer Science knowing how intensely boring and unrewarding it is. But hey, we need those people out there writing those quarterly profit statistic programs!
This rant is a revision of an earlier one of the same topic. That one was originally based on a blog post I made late at night, and later transformed into a rant and never completed properly. And thus, I take this opportunity of boredom to present you with a load of crap from my brain.
Terminology
I don’t care much for the “official” definitions of programming language and scripting language, so here are my own:
programming language: Any language which is compiled into native code and executed directly. Such languages include COBOL, C, C++, D, and Fortran.
scripting language: Any language which is either directly interpreted by another program or compiled into bytecode and interpreted by a so-called “virtual machine.” Such languages include Java, Perl, Python, and Ruby.
The definitions provided by FOLDOC (or anyone else) hold no relevance in this document.
Background
I starting using IRC when I was around ten or eleven. At the time, I used mIRC, and the only exposure to programming I had was mIRC’s scripting language. If you are at all familiar with this language, then you have a pretty good idea of where I’m going. While almost completely useless, mIRC’s scripting language exposed me to general programming concepts and ideas. I found myself spending hours and hours just seeing how much I could accomplish.
Eventually, I came upon dynamic HTML generation. I learned PHP by just messing with it back in the PHP3 days. Knowing absolutely nothing of other languages, I thought PHP was the shit. I even started writing IRC programs in it.
Quite some time after that, I wanted to write more useful IRC programs. It seemed that most IRC programs were written in C, so I resolved to learn C. Easier said than done. C being my first “real” programming language, it took me around a year to completely and firmly grasp all of the concepts involved with learning C. Eventually, though, I went “oh, I get it.” It’s been around two or so years since then, and I can honestly say I don’t still don’t completely understand everything in C.
I got tired of “reinventing the wheel,” and decided to look for a new language. I read about C++, and, not completely understanding the object-oriented paradigm, I went back to PHP. I thoroughly learned PHP through several books, and it served as a nice introduction to OOP. Having knowledge of this concept, I went back to C++ and decided it was interesting, but too cumbersome to actually implement anything in. So I read about Java. At first, it seemed very interesting; however, aftering having read about and learned the language, I felt differently. I read about D; unfortunately, D is still young and has a long time before it’s widely implemented properly. I hope that D displaces C some day. It certainly has the potential.
I was then subjected to many, many scripting languages, the first being Perl. I tried and tried to learn this language, but kept coming away dry. At the time, I couldn’t understand why. I just knew I didn’t like the language.
I heard about Python and Ruby (and a million others), but never really got into them, as I was still doing all of my programming in C. However, later learned both of these languages, and my programming life has changed forever. This is my story.
Object-Oriented Programming
I almost invariably hate it.
Don’t get me wrong, I like the idea of it, but the implementations never fail to blow. C++ and Java specifically. They both treat you as if you have no business programming (Java moreso than others). They have so many constructs to protect you from yourself. Well, golly, but if you don’t have a fucking clue what you’re doing then you shouldn’t be using a computer. They’re not toys. If you don’t know what you’re doing, you definitely shouldn’t be telling a computer what to do.
OOP implementations in C++ and Java are the blight of programming. Java doesn’t even have pointers! This is supposedly to protect you from screwing shit up. Okay, any OS that doesn’t have memory protection by now needs to be trashed anyway. It’s not 1975.
The morons we’ve worked so hard to account for in our programming are now doing the programming themselves. C++, Java, and OOP are destroying the world.
Languages
The languages I’m going to be discussing are the languages that I care about. If I don’t talk about your favorite language, I don’t care. I’ve done a hefty amount of reading on a huge amount of languages, and I’ve decided on the ones I particularly like and the ones I don’t particularly like.
The ones I particularly like:
The ones I don’t particularly like:
If you disagree with me, I don’t care. I mean, really, this site is about me. If you love Perl, that’s great, I don’t, go away.
I’ll be going in the order in which I was introduced to the languages.
PHP
When I first learned PHP, the only other thing I had used at the time was mIRC’s scripting language. As you might imagine, I loved PHP. Since then, however, I’ve learned other, more sane, languages, and after two major versions of PHP I’d still rather not use it. This is why.
PHP is a giant hack. I mean, look at it. It started out as one guy using it to parse forms (why he didn’t just use CGI, the world may never know). Now, don’t get me wrong, I think PHP does an outstanding job at Web development. I’m not really involved extensively in Web development, so I don’t really have a firm basis to be dictating any of this, but I’m going to anyway. PHP is a giant hack. It’s a slew of “let’s throw everything right here.” It’s barely better than mIRC’s scripting.
With the introduction of Zend, PHP actually made it out of the “giant hack” status somewhat. I’m not sure how Zend works exactly (I’m not sure if it’s compiled into bytecode or what) but I still don’t like PHP. The grammar is too C-esque for a “modern” language and the rest of the language seems to be trying to cram Perl ideas into a C syntax. I think the main reason I don’t like PHP is because they just make it up as they go. They never have and apparently never will have a plan that they follow. They just keep turning out absolute crap.
When I use PHP I feel dirty. Where’s the structure? Where’s the library? And, good heavens, where are the namespaces? Who ever thought it was a good idea to just throw every single symbol into the global scope? There’s just no structure to any PHP programs I’ve seen.
You can do great things with PHP, if you don’t like thinking clearly. PHP is just way too illogical for me to use. Even if it is the “most modern” and mainstream Web language, I’m still not going to use it.
PHP5 is at least an improvement. They crammed more OOP in, like OOP interfaces
to the MySQL library (but it’s stupid anyway). They provided Ruby-esque
accessor methods (__set() and __get()), as if accessors aren’t completely
retarded 99% of the time. What? You know you never have to do any specific
magic when you set a variable? And you also know that you’re going to have a
jillion of these objects and you’d like to keep the overhead to a minimum?
Sorry, you’re screwed. You could make them public, but that’s against the
so-called object-oriented pantheon.
PHP5 is a step in the right direction. Maybe by PHP7 it’ll be worth while.
Perl
Perl is worse than Python because people wanted it worse.
— Larry Wall
I hate Perl with an intense passion.
I just don’t get it. I can see it being useful for something a shell script could do just as well, but certainly nothing over 100 lines. Perl is just too unintelligible to use for a medium-to-large project. I’ve tried to read Perl books. I’ve tried to read Perl references. I’ve tried to read hold-my-hand-mommy Perl tutorials. I just don’t get it.
Yes, Perl has tons and tons of useful features. It seems if you want something in a language, just ask Larry Wall and it’ll wind up in Perl. It’ll be obscure and no one other than a select few people that care will know what it does, but that’s okay, it’s Perl.
I don’t know a whole lot of Perl (of course, neither does anyone else) but I do know it has a lot of kind-of-neat kind-of-gay features that you either love or hate. That’s fine. Perl’s operating principle is “there’s more than one way to do it.” Why? I just totally and completely disagree. Having multiple ways to accomplish things is going to happen anyway, why make as many obscure ways to do it as possible?
Granted, Perl can be used properly and be semi-maintainable and readable, but it rarely is. Ruby has a lot of the same misfeatures that Perl does, but you rarely see totally unintelligible Ruby programs. In contrast with the Ruby community, Perl hackers seem intent on abusing the language as best they possibly can. You could write it nicely, but why?! It’s Perl!
A friend of mine notes:
Perl has lots of line noise. It’s not nearly as unmaintainable as you might think, though; but portability and multiple-coder projects are pretty much pointless, as different coding styles will shoot you into orbit (the whole “there’s more than one way to do it” paradigm). Given that there are so many language features (and that’s what most people really like about it, I think), it’s probably nearly impossible to know them all; when you look at someone else’s program, it may be akin to trying to learn another language. I’ve read a hefty amount of Perl documentation, and I haven’t even scratched the surface of what it’s capable of. However, like you’ve noted, I’m still trying to find the module that makes it look pretty.
— Stephen Belcher
He has an excellent point. Perl is the way it is because the Perl hackers
wanted it that way. It seems the majority of Perl scripters would rather the
language be totally unintelligible. I guess they find it more useful. Myself,
I prefer strict rules that I need to follow. Why? Because it makes it easy to know
what’s going on. That’s one reason I’m against things like operator
overloading. You have no idea what’s really happening until you go through
and read the class. I thought classes were supposed to be used as blackboxes?
How can you do that if you don’t even remember why the hell the == operator
works in a certain way on the class objects? Isn’t this against the
object-oriented paradigm?
If you can use Perl and understand it and think you’re the most advanced Perl hacker on the planet, I suggest you learn another language so you can see how it’s done in the real world.
Some people, when confronted with a problem, think “I know, I’ll use regular expressions.” Now they have two problems.
— Jamie Zawinski
C
Ah, C. My old friend.
C is, today, the most common systems language in use. It’s highly likely that the vast majority of programs that are running out there in the real world doing all of the dirty work are written in C. C gives you the power of assembly in a more sane manner.
However, I fully believe C’s time has passed. I think D is the future of systems programming, and I hope it indeed becomes such. Today, C is still the only way to ship portable programs (Java sucks). I think C is a pretty crummy language when it comes to non-systems programming, and something more sophisticated like D should claim that place. It will never, ever be Java.
Less and less people have a reason to learn C today. If you want to understand a great many things about your computer, I’d suggest you learn it. It took me a good two years to solidly grasp every concept of C. Pointers in particular continued to elude me until one day I “just got it.”
C’s age is showing though. While I believe structs can be used to accomplish anything you’d have to do OOP wise, it’s still old. No namespaces, no booleans, no symbolic includes, dynamic loading is a bitch. You continually have to “reinvent the wheel” to accomplish most things. It’s only slightly better than assembly.
C was my first “real” language, so naturally I’m partial to it. But, alas, its time has come to pass. D is the future.
C++
This is going to be brief.
C++ is a useless extension of C. It adds useless classes (fancy structs), rapes structs into classes, adds useless OOP stuff that could be done just as well if not better in C. I don’t get it. C++ is just a dumbed-down version of C. They kept pointers! That’s the only plus, it seems.
It appears the deeper you get into OOP the more the language treats you like you’re a giant dumbshit. I mean, if you’re a giant dumbshit, and you need the language itself to protect you from yourself (ahem, Java), then you shouldn’t even be using a computer, let alone telling one what to do.
Java
<Hagar> I read somewhere that java is just as fast as C when the JVM is preloaded
<rakaur> i read somewhere that java was a piece of shit
<rakaur> probably that sentence i just typed
<chodapp> I read somewhere that rakaur read somewhere that java was a piece of shit
<chodapp> and I agree— #python on irc.freenode.net
I hate it. It’s destroying the programming world as a whole. With its useless OOP paradigms rendering you absolutely helpless to actually accomplish anything, I don’t see how this language has taken off so well.
Java allows the people that know absolutely nothing about programming to program. I don’t get how it’s taken off so well.
I mean, Sun came along and said “hey look, we’ve got a spiffy new language here, and it runs everywhere! and it does everything!” and people bought it. Let’s look at this a little closer.
“Write once, run everywhere.”
Gosh, you mean, like Perl or Python or Ruby or PHP or… ? How can people buy into this bullshit? Interpreters and virtual machines were figured out years ago and work well. Too bad Sun doesn’t know that.
Oh but wait! Java is two-step. That is, you compile it into bytecode and distribute that instead of distributing the source code and doing JIT compliation. This allows you to be a giant cock and not release your source.
And as a bonus, Sun will keep Java closed so that in the long run the free and openly available languages like Perl and Python will be supported on far more platforms than Java.
What a wonderful innovation, Sun!
No pointers, “for your safety.”
Right, because pointers are the root of all evil. After all, one might wind up garbaged and try to write outside of its memory space.
In 1975, maybe.
What were these shitcocks thinking? Let’s remove any usefulness from the language? I can’t imagine working without pointers. That’s one reason I don’t like Perl. References are a huge bitch to use in Perl. In Python, everything is a reference (pointer), and this works much nicer. Variables simply point to some internal Python construct. Knowing this, and knowing how pointers work, you can do really neat things. But not in Java! How does Java deal with the lack of function pointers?
No preprocessor, “for your developmental pleasure.”
Right. Since there are no “real” globals in Java, and since there’s no
preprocessor, and since there’s no inline functionality, and since there’s
no way to escape from the type-safety prison, there’s a huge collection of
optimizations that you just can’t perform in Java. This is another reason that
it’s so painfully slow. Java will never be fast enough for real world usage.
No “real” namespaces?!
What?! All that fancy package mumbo-jumbo and all you can come up with for
namespaces is some specially crafted import statement? What a load of shit.
Java has a fast development cycle.
Than what, assembly? Yeah, maybe. Python or Ruby would kick its ass to Sun and back in development time.
Java sucks.
That’s the only thing I can say. Java is useless. It encourages bad programming by people that shouldn’t be programming and is thus destroying the computer science field totally. Stop using Java.
D
D, I hope, will be the future of systems programming. It’s just so awesome, that I believe it could, and should completely displace C. D isn’t “just another C extension.” D is a completely new language, based on adding OOP capabilities that aren’t as retarded as C++ and also aren’t as restraining as Java while offering the complete power and freedom of C. D is designed to be a systems language (something neither Java nor even C++ could ever claim). I would love to see an OS implemented in D.
I really can’t explain all of the details, so I encourage you to go to the D Website and check it out. It was designed by people that have spent the last 30 years implementing compilers for C and C++, et al. I think there’s no one better qualified. D is also being designed by the people that use it. That is, we have systems programmers, designing a systems programming language. I know what you’re thinking, the last time we did that Perl happened, but that’s not true. Perl was a try-to-do-everything-in-every-way language from the get-go. D is for systems programming.
To be honest, I really couldn’t give a shit about any statically typed/low-level language at the moment. Right now, I’m more interesting in high-level dynamically typed languages like Python and Ruby. That doesn’t mean I don’t love D and hope to see it reach the future it deserves.
Python
Python is, right now, my favorite language. I’ve written a much more comprehensive rant on Python, and it covers more than I cover in these blurbs.
Please see my Python opinons here.
Ruby
(I’ve since written a Ruby-specific rant, which you can find here.)
Ruby is neat.
According to Yukihiro Matsumoto (“Matz”), the creator of Ruby, he designed it to be “a better Perl” and “more OO than Python” and to follow the “principle of least surprise,” that is, if you think it should work in a certain way, then it should.
I have some problems with Ruby.
“A better Perl.”
This, for the most part, is entirely true. Perl has long been a write-only
(that is, you can write in it, but good luck going back to read it), and by
combining pure OO and some of Perl’s niftier features (inline regular
expressions, for example) you get the power of Perl with a clean syntax and
design model. Unfortunately, Ruby took it too far, I think. It relies heavily
on the Perl special variables, $_ and friends. That is, $_ is the same
implicit special variable in Ruby that it is in Perl. Also, pretty much every
other special variable in Perl is available in Ruby. Another thing is the
inline regular expression syntax (that is, string =~ /pattern/) is impossible
to understand unless you’re familiar with Perl. The same special variables
($1, $' and friends) also get set by this. However, the =~ method is
just an alias for Regex#match. So you have a choice, the Perl way or the OOP
way (similiar to Python but much more powerful).
However, unlike the Perl community, the Ruby community is (mostly) friendly
and sensible. They (for the most part) don’t abuse the language features such
as $_ in the way that the Perl hackers do. I’ve mentioned before, Perl
hackers seem intent on overusing every aspect of the language as if to say
“look ma, no hands” whereas the Ruby community perfers to write in the same
way the Python community does.
“More OO than Python.”
That’s debatable.
People tend to think OO was hacked on to Python. In a sense, this is somewhat
true, but not for te reasons they think. People think that explicitly defining
‘self’ in method definitions and explicitly requiring self to dereference
any members of the class/object scope is because OO was hacked on to Python,
while it’s simply not true. Explicitly requring self to reference anything
in the class/object scope is for clarity (much like Ruby’s @instance_var) and
was carried over from Modula-3. However, the fact that you have to define self
in method calls was because it as the easiest way to implement it in the
interpreter. That’s kind of cheesy, so people get half a point for that.
The next major argument is “len() and str() are functions but items()
and index() are methods.” Yeah, that does suck. Really, though, len()
just calls object.__len__() and str() just calls object.__str__() or
object.__repr__. They’re only there as functions because that’s how it started
out, and, unlike Ruby, Python has a thing for backwards-compatibility. I’m
not defending this though. Remember those inconsistencies I was talking about?
Python is plagued with them.
Also, Ruby has some of the same issues. For example, why is it
puts 'string'
instead of
'string'.puts
Doesn’t this completely disagree with Ruby’s pure OO paradigm? Of course, it’s Ruby, so you could easily do:
class String
def puts
puts self
end
end
And then write:
'string'.puts
Of course, I guess it’s just there because it’s easier to have there. But I think it should either be asking the string to print itself, or asking the out stream to print something. In which case,
$stdout.puts 'string'
Works perfectly well.
“The principle of least surprise.”
This one is definitely debatable.
In my experience, I found Python to follow this far more than Ruby. If you
come from other languages then you expect there to be for loops, not Ruby’s
iterators/closures/blocks. Python has all of the power of blocks Ruby does,
except it implements them as iterators and generators. After having said that,
though, I like Ruby’s idea better. But it hardly follows the POLS.
Also, rescue without a specific exception class defaults to SystemError
instead of a catch-all. Why? In every other language this defaults to a
catch-all, but to do that in Ruby you have to do rescue Exception which seems
kludgy to me. Also, there’s absolutely no documentation as to what methods raise
what exceptions, so you’re left with trying to catch them all or catching a
huge range of exceptions. Oh, and if that’s not enough, the exception
hierarchy changed completely from 1.6 to 1.8. That’s awesome.
Another thing, I expect subscripting a string to return characters.. but no! In Ruby you get the ASCII numerical values.
rakaur@cyndane:~$ irb --simple-prompt
>> 'hello world'[1]
=> 101
>> ?e
=> 101
>> 'hello'.each_byte { |x| puts x }
104
101
108
108
111
=> "hello"
>>
Yeah, I’m sure someone has ever wanted that.
So you’re left with either appending .chr everywhere or writing your own:
class String
def each_chr
self.each_byte { |x| yield x.chr }
end
end
Ruby seems to be based very heavily on what character set it’s being written in. That’s just a bad idea all around.
Conclusion
Ruby is very different. Perhaps if you’re Asian then it follows the POLS, but for the rest of us it’s very different. I found Python to be far more inviting to beginners than Ruby could ever be.
Ruby, though, is still very immature. It has potential to be a great language, but is only now getting the following and the community that it deserves. However, Python is far ahead of it in terms of features and innovations and experience.
Conclusion
Right now, I don’t care about native code languages. As of this writing, I am awaiting the arival of my Ruby book (since practical English documentation is far too much to ask apparently) and as such cannot judge Ruby properly. So, my preferences at the moment (languages I’d use in order of greatest to least):
If you disagree, I don’t care. Go away.
0 TrackBacks
Listed below are links to blogs that reference this entry.
TrackBack URL for this entry: http://mt.ericw.org/mt-tb.cgi/285
