Monday, March 30, 2009

Recursion makes my brain hurt

Recursion.

It's a simple programming principle: a function repeatedly calls itself until some condition is met. Tree views, such as folder paths, rely on recursion. With a folder tree, you start at the root folder and scan for subfolders. Then you scan through each subfolder and it's subfolders until you've scanned everything to get the entire folder tree. As you can imagine, it's pretty daunting at first.

Another example is cascading menus: you're given a <select> and if you choose a certain option it opens a second menu, which could have an option that opens a third menu and so on. Aaahhh!

I've known about it for many years. Yet it confounds me!

When I try to write something that uses recursion I get so confused. I am able to figure it out, but it's usually a very, very slow process. I wish this came to me more easily. I guess I just need to work with it more to get a better grasp.

I took the author of xkcd.com's challenge ("Which sorting algorithms should I use?") and I was able to write a quicksort, but it took a long time, and I don't know if it's a true quicksort. But whatever it is, it can sort (it works!) and I learned a lot about recursion and sorting in the process.

That's how you learn how to program - by writing programs.

Friday, March 20, 2009

It ain't easy being a Front End Web Programmer

I once heard it said that, "Nobody cares what kind of hammers were used to build the house," when talking about web programmers.

What a load of ignorance! They would care if they had to fix the house and found that it was made out of Styrofoam! I look at the horrible, inefficient code I inherited when I started at my job and how much I've improved it. Functions that before were 20-25 lines long (that simply showed or hid something) are now 3 lines long. I re-wrote another that was over a hundred lines long that would add/remove options from a <select> and my version is about 24 lines (and fully dynamic, unlike the old one which required a separate function for each select!). Massive, enormous tables with spacer cells all over the place have been replaced with clean, efficient <div>'s.

How does this affect you? Well, it's that much less data to transmit from the server to the client, so it speeds things up.

It also makes development SOOO much easier. I try to make everything I write as dynamic as possible. I hate hard-coding things!

Sometimes as a programmer I get lonely. The other programmers that work here can't appreciate how I've streamlined things because they're all Back End programmers. They like static, hard coded stuff and live in a world that hasn't changed in years (when's the last time SQL was updated?).

I've learned so much about CSS and javascript and making dynamic magic on the Front End, and I have noone to share it with. I could go on programming forums but there never seems to be time to go in those - so many posts to read through! When I try talking about it, people's eyes glaze over and they get bored and change the subject. Noone wants to hear about how the house was built.

The best recognition I and other Front Enders can hope for is to wow people with effects (script.aculo.us, etc.), like the sliderbar I created for the new BG site. But - oh wait - nobody cares how it works. :( Designers get all the glory, front end programmers are relegated to the background.

It ain't easy bein' a Front End Web Programmer...

Wednesday, March 11, 2009

Ummm... Netscape?

Why do I still see references to Netscape 4? Why does Dreamweaver CS3 still have "Add/Remove Netscape 4 Resize Fix" in the Commands menu?

NOBODY USES NETSCAPE ANYMORE

According to hitslink, Netscape 6, the highest of all the Netscape versions, registered all of .59%. All versions of Netscape made up only .66%. Last week, 3/3/09, the website I work for had
270 visitors using Netscape. That's .13% of our traffic.

It's 2009. Netscape is dead. Upgrade to Firefox already and remove all references to Netscape!