Thursday, July 31, 2008

Ur Doin It Wrng

I'll be forthright: I only skimmed a bit of The 'Anti-Java' Professor and the Jobless Programmers the first time. After going back and giving it the attention it deserves, I agree with the message it's trying to send, though I must admit it's really an echo of similar arguments I see in other respected programming blogs (see: Joel on Software's The Perils of JavaSchools).

So, really, I'm not trying to say or point out anything particularly new. No, the parts of The 'Anti-Java' Professor I wanted to point out were the following quotes:

Dewar stresses that he’s not against Java itself. But the fact that Java is taught as the core language in so many colleges is resulting in a weak field of computer science grads, he says.

The reason: students’ reliance on Java’s libraries of pre-written code means they aren’t developing the deep programming skills necessary to make them invaluable. Colleges, alarmed by falling CS enrollment, have dumbed down the course requirements. Consequently, CS majors sail through a curriculum of Math Lite, earning a smiley-face on their papers for “developing” projects using pre-built libraries.

Followed by:

But wait a second, Professor Dewar...I wanted to ask him, since this list of popular programming languges puts Java at No. 1 – ahead of biggies like C, C++ and Visual Basic – doesn’t that negate his theory?

I mean, if Java is this popular, maybe universities should teach it first. It called “being in touch with the real world,” isn’t it?

Before continuing any further I'd like to point out I don't specifically have anything against Java. I feel like it is a perfectly adequate language that the right people can do great things with, like all languages. This is not about Java (it could just as easily have been about Python, and so many other languages). It's about the ATTITUDE that is being flaunted; Java just happens to draw this kind of attitude. Take or leave that as you wish.

When I first read this, taking it seriously, it infuriated me, mostly because this is the attitude I see at my own school. So many times I have see my fellow students (in my eyes) just give up because a language "is so much easier" than C, C++, Lisp...whatever. When I mention that I am leaning towards doing a video game project in Lisp for my masters work I always get the exact same question: "Why are you using Lisp?", usually followed by, "Why not just use Java?"

It boggles my mind. It's like asking me "Why are you doing computer science?". I'm doing it because I love computer science and want to learn as much as possible, not just sit around and churn out easy code. If I wanted to do THAT I would just do HTML all day and try to convince people I was a programmer. I mean, it's easy, right? Why spend time learning something more complex like Java?

Why is it so weird when you're devoting at least four solid years and thousands of dollars to something that you would want to learn as much as humanly possible? Is this not the point of college? While I do agree there is a place and time for very good tools (such as the ones Java provides), there is also a place and time to learn how exactly these tools work by building them yourself.

Just as a random anecdote, a friend of mine decided to rewrite a built-in Java search and came up with his own search (in Java as well) that was magnitudes faster. He learned something important from that experience, as we all should.

Wednesday, July 9, 2008

Linux Wants to be Your Friend (Part II)

Wow. Linux Mint...I was really, really impressed. Of all the "user-friendly" Linux systems I've messed with, this one is hands down one of the most solid and truly user-friendly.

Installation was, as expected, a breeze. It took maybe 10 minutes total, and like most modern, desktop-based Linux distros allowed you to explore the LiveCD at your leisure while the partitioning and file-copying and whatnot was being done.

The full installation naturally has the essentials: the excellent Synaptic package management system, Firefox, Pidgin, and a nifty little update program that allows you to update the entire system with a few mouse clicks. The aspect I enjoy most about the update program is it resides in the toolbar along the bottom, very unobtrusively indicating, with nothing more than a slight change in the button, that there are new updates available.

The best part: all internet plug-ins are installed right away, as promised. I was still having issues with applets (they weren't aknowledging keyboard input, very odd...), but there was no need for me to do any manual installs of...well...anything. Probably the easiest Linux install I've ever had to be quite honest.

The only minor issue I had with this distro is it doesn't do root like I normally expect it to do root. You have the *option* of setting a root password, although it's recommended you don't. The first time I did set the root password, just out of habit, and after multiple failed attempts to start up a device manager, I realized that the desktop was, like Mac OS X, asking only for the user's password. sudo asks for the user's password, and, to my horror, the user can even modify important root-level files (for example, the grub boot menu file) just by sudo-ing. Depending on the environment in which this distro is installed, this could be unforgiveable or just cringe-worth.

Outside of this I would highly recommend this system to any Linux n00b who just wants a working system set up quickly and painlessly. This distro will be remaining on this desktop until the techs find out and become engraged at the lack of Vista.

Tuesday, July 8, 2008

Linux Wants to be Your Friend (Part I)

What do you do when the Vista computer at work, which already runs painfully slow due to the underpowered computer it was forced on, becomes so choked with viruses it is virtually unusable? Well, you install Linux on it, of course. The problem? You (in this case me, but meh, pronouns...) are pretty good with Linux, and the people sharing this computer haven't even heard of Linux. What distro do you use?

The fun thing about this is it gives me a chance to field test a few Linux distros for usability, and see how each one stacks up again the other. My first choice was <a href="">Debian</a>, which, in hindsight, was an awful idea.

Pros of Debian as a "common user" system:

1) It is incredibly easy to set up. The net install takes maybe a half hour, just due to all the file downloads. If you have a fast connection it takes even less time.

2) Just installing the "core" components gives you a fantastic Gnome desktop right away (this may seem like an obvious point, but I've installed more than one distro that requires you to install xorg on your own, or do xorg configuration, and so on).

3) It has a shnazzy update system, as well as the always-excellent package management system.


1) Debian's staunch adherence to F/OSS, while admirable, is the main source of many headaches. Flash was easy enough to get working, but I never got the JRE to work right (many applets just displayed a frustratingly cryptic "Error Loading" message), and I don't think there's any chance I'll ever get Firefox 3 installed on there. Yes, Iceweasel is technically Firefox, but it is still the old version and this is still unendingly frustrating.

2) Their dedication to having a solid platform is fantastic for servers, but especially when it comes to web browsers, being even a few months behind is too much. New Flash plugins are released all the time, and sometimes software, such as Firefox 3 as I mentioned above, is important enough that I want it installed and running right away. However, an outdated system makes everything that much harder to get running (GTK libraries aren't up to date, and didn't want to get up to date, so I was left Firefox-less), and leads to a lot of extra work I don't feel like I should have to do, especially when it's a computer I hardly use more than a few hours out of an entire month.

The next distro on my list to try will be <a href="">Linux Mint</a>. I'm burning the boot disk tonight; the excitement is palpable. Linux Mint is based on Ubuntu, but it's supposed to have all media plugins installed already...I'm anxious to give it a try and see how easily it is to install and use. Stay tuned for Part II tomorrow!

Monday, July 7, 2008

Problem in Interpretation

Just as a programming exercise, I've been trying to write an interpreter for the esoteric Brainfuck language in C++, and it is hands down my most unsuccessful and frustrating project ever. Taking my first far less competent attempt into consideration, I've probably been working on this for a half a year (though I should mention that the "work" was extremely sparse at best).

My first attempt, before I understood the goodness that is the STL string class, was to utilize arrays. To be fair this was (pre-Theory of Computation) how my mind felt the interpreter was MEANT to be implemented. I mean, it uses > and < to increment and decrement the pointer. And really, stripping it down to its core, all the language does is move a pointer up and down an "array" and increments and decrements the contents until it gets a command to "print". At that point it is assumed you're outputting an ASCII character; all that work just to create a string of ASCII characters from their number codes.

My next crack at it (meaning my current attempt) is involving an array, but only an int array in the main increment and decrement function. The actual input, as well as the final output, are both strings (so, if you want to get really technical, they're char arrays, but we're not going to worry about that because you don't have to treat them as such when you're actually using the string class. Because the string class is so wonderful).

The issue I'm running into again is the same issue I ran into with my last attempt: the while loop encased within the "[" and "]". The problem here is twofold: 1) figuring out how to recursively call the increment/decrement function so that I won't be re-writing the main chunk of code in my program and 2) dealing with the situation where the current index (ie the index the pointer is on at the point of the "[") will either be the number to be incremented/decremented, or the counter.

So during the while loop there are four essential pieces of information: the index to be incremented/decremented, the counter index, and the actual value at both these indexes. I have to keep track of this, while being able to throw everything back to the "main" program in which everything is just a straight line of incrementing/decrementing.

My friend suggested using a stack at this point, and my initial sketches involved pushing and popping the "+" with each run of the loop; after considering, I don't think this is at all effective. The first move will be to push each + found in the first run through (for the sake of simplicity I'm assuming the modified index will only be incremented); after the first run it will be obvious what the counter is and what the index being modified is. Keep pushing + until the counter runs down, then pop each + until there aren't anymore. Voila!

Hopefully I'll have a working interpreter by the end of the week; I'll post code once it's completed.