The JavaScript Programming Language Videos

I love learning about programming languages. Every language has something unique about it that makes me think: “That’s a nice feature”. While just getting acquainted with a language doesn’t mean that you know how to write code using it, it’s still nice to see what’s out there.

JavaScript is a very misunderstood language. Being “the language of browsers” by perception makes us (wrongfully) think it’s a lesser language than C++ or Java. It also makes JavaScript a very popular language these days, as almost all interactive website include some JavaScript code.

If you want to learn about JavaScript, here are very educating four videos of Douglas Crockford of Yahoo!, including the interesting history of the language:
The JavaScript Programming Language 1/4
The JavaScript Programming Language 2/4
The JavaScript Programming Language 3/4
The JavaScript Programming Language 4/4

My Programming Lessons – #2 – Be Paranoid About Your Code

I chose this to be the second lesson because I feel this is one of the things I learned through experience. It’s the basis of many many other lessons.

So what does it mean to be paranoid about your code? While you’re writing code, for some strange reason, you have this false confidence that it will work. It’s false because it’s statistically impossible to write code that works the first time. Consequently, you have to assume that everything you write will fail.

Sometimes a failure is not bad – it depends on what you’re writing. If you’re implementing a word count feature for a document editor and your code causes the editor to crash, then there’s always auto-save that will give the user his latest changes minus the last 2 minutes or so. But if you’re writing the auto-save feature for that same document editor, your feature can ruin big, important documents that belong to clients who will never buy software from you again.

In practice, being paranoid about code means that you should check every return value from every function and exit error situations as gracefully as possible (the optimum being working in a transaction-like manner). Include sanity checks and assertions as much as you can, so that during tests your code will crash early instead of dragging an error to the point where it can’t be found.

Both advices, “crash early” and “anything can fail”, are well known in one form or another. Today they seem obvious to me, but I first read them in a book called “The Pragmatic Programmer”, which is a great read for developers at all levels.

RSS Explained

I mentioned before that I use RSS. These days I use RSS for almost everything I read on the Internet. I use Google Reader, which is very popular and works well, and I almost never go to websites.

Using RSS is easy. It can help you consume a lot of content and keep you updated without having to browse to all your favorite websites. Without RSS it would have been information overload for me a long time ago. Here’s a short video explaining RSS and how to use it. I strongly recommend it to anyone who feels coping with all the information on the Internet is a heavy task.

Is Microsoft Dead? Define “dead”

Every time I hear someone claiming that Microsoft is dead I roll my eyes and try to stay calm while listening to a whole lot of nonsense. Recently, Paul Graham (famous hacker and also a partner in venture firm Y Combinator) wrote that Microsoft Is Dead.

While I usually distance myself from such clear cut statements, the article itself lists very good points why Microsoft is not the big fearsome monopoly it used to be, and how the new age of the Internet doesn’t take Microsoft as a threat like software companies did in the past. So while the main point in the article doesn’t seem to be that Microsoft is dead (at least not according to my definition of “dead”), it’s still a very good read. (via Download Squad)

How To Install Flash Player 9 On 64 Bit Linux

If you try to install Flash Player 9 for Linux (download link) from Adobe on 64 bit Linux you get this annoying error from the installer:

ERROR: Your architecture, \’x86_64\’, is not supported by the Adobe Flash Player installer.

To overcome this, you can simply run the installer with the following command:

$ linux32 ./flashplayer-installer

The linux32 program makes the installer think that it’s a 32 bit architecture machine and the installation continues. So far I haven’t experienced any problems with the installation.

UPDATE: It seems like I have no sound inside flash any more. It seems to be a known problem with known solutions (solutions search link), but since I don’t have root permissions on my Linux machine (at work) I can’t solve the problem.

The Browser OS – Using Online Instead Of Desktop Applications

lifehack.org (main website link) posted an article on how they use online applications instead of desktop applications, the idea being that it doesn’t matter any more which operating system is running on your computer since you can have all your applications online including Office-type applications, backup, file management and so on.

I believe it’s an over-simplification, but the idea is appealing. I do think that we will have more of our applications online and maybe in the near future all our files will be online, but currently the desktop experience is still important to most users. Generally speaking, I adopt Jeff Atwood position in his post Are Web Interfaces “Good Enough”? (via Digg)

My Programming Lessons – #1 – Learn When To Quit

I decided to start the “My Programming Lessons” series with a lesson I don’t consider the most important but still important enough.

Learning when to quit programming is hard. You have a deadline, you’re stressed and things aren’t going well – maybe the compiler complains about something you don’t understand or maybe the program doesn’t print “hello” even though that’s the first line being executed (or so you believe). This is the exact time you should let everything go and simply head home to rest.

You should let go because when you’re in this state you’re probably more destructive than constructive. The next day, if you’re like me and you re-examine your code often, you’ll probably replace all the crappy code you wrote with smaller, better code that will work first time around. And that’s the good scenario. The bad scenario is that you’ll keep trying to rework that crappy code until it seems to work and this almost always means a bug is hiding in there somewhere.

It takes some insight to learn when the right time to quit is. For me, now that I have a few years of programming experience, I usually know when to quit before I’m destructive. If this time of the day arrived and I still feel like I have to work, I usually do other (not as critical) work like documentation.

Interview With Raymond Chen (Audio)

I’ve written about Raymond Chen and his popular blog a few times before. He’s a brilliant Microsoft employee, who writes about “serious” stuff like how to use some of Windows’ API, while also including nice stories from Microsoft’s past (plus some other stuff, which always shows how much you can learn from him).

This time I’m writing about him because there’s a podcast online where you can listen to him getting interviewed about the blog, his new book and Microsoft.

Did you know that every copy of Windows XP includes Microsoft Bob (Wikipedia definition)? I didn’t. If you have an original Windows CD and you can pound on your keyboard with your hand in a very specific way, you can get to the Microsoft Bob installation on the CD :)

I guess you have to listen to the podcast to know why I’m saying that.

UPDATE: Raymond Chen was interviewed previously on another show. It’s also very funny for Windows developers with a bit of sense of history. Here it is.

Writing Software – Part 3

I worked in Motorola for two years. I enjoyed working there very much, but decided to leave and look for a job in Linux and for a smaller company. I got tired of big companies and I also wanted some experience on Linux. The problem is that once you start working on one operating system (or technology) you pretty much get stuck with it, unless you get a chance to switch. I got a chance simply because there was enough demand and not enough Linux programmers to supply it.

So these days I work for Diligent on Linux. Programming on Linux brought me closer to what I learned in the university. The operating system itself has a very small collection of functions you can use (unlike Windows) and you have to work your way up from there using the huge collection of available libraries. For a Windows programmer like me it seems strange that there is no CopyFile(source, destination) function in Linux (which is part of the Windows API since the beginning of time). Also, some functions simply don’t implement all their advertised interfaces, like getting a process’s memory usage with getrusage(). What’s great about Linux is that you can see the implementation of the function, for example in the Linux Cross Reference. Also, in Linux, if you complain about something they will simply tell you: go and implement it yourself.

So this is my experience so far. I admit that I thought this series would be longer and maybe include more of what experience taught me over the years. However, when it comes to software engineering, there are so many gurus sharing their experience, code and their processes in a much more coherent way than I can, that it seems pointless to reiterate things. As an example, here’s Coding Horror’s top 6 list of programming top 10 lists post. I might start posting short “lessons I’ve learned” posts on this blog in the future.