When I type
2 + 2 on a compiler I know there is no way the computer will give me an answer other than 4. Computers are precise, accurate. They don't make mistakes.
Try it. Enter 2 + 2 on your machine. It will give you 4. Unless you go ahead and modify the very soul of the machine to not get it right there is no other way around it. Even if you did, you would have destroyed too many things to even get your machine to boot.
What does this mean? It means we can rely on computers. It is normal to expect your machine to give you the correct answer. Programmers can write applications and expect them to behave the way they want it to on someone else's machine. So our job as programmers is easy.
The computer does all the heavy lifting automatically, while we just give the instructions.
If you are a programmer you are probably saying 'yeah right'. Because despite the computer never making a mistake, the programming experience is chaos.
It is a stressful, confusing, frustrating. In my old cubicle, every 10 minutes I heard "FUUUUUUCK!". Because this well structured, built from scratch new programming paradigm someone fought so hard to get approved just failed and became a clusterfuck of confusion. In other words, it became worst than what it was designed to replace.
My Experience with programming
“If I could rewrite everything from scratch it will all be better”
This is a popular song in computer programming. Unfortunately, it's a myth. I, too, fell for it. I had the chance to be the sole developer on an internal tool for a company.
Let's call it Gstats. Wait that was its real name. Google stats. It was a custom tool that was supposed to pull all our insightful findings from Google and help us make better decisions when changing our websites.
The first time, I wrote it without any framework because who wants to waste time learning a framework before starting to work. So I wrote the code the way I saw fit. And it was beautiful. And it produced fresh muffin like insights, that was also delicious money savers. I was proud of this tool I authored. Everyone was proud of me.
Then, a week after the release, a manager requested a new feature. He sent an email with detailed instructions and how he wanted the URLs to be structured to make it compatible with another internal tool. The other team will need it by following Monday.
Wait what? URLs? Does he want to use it as an API? There is no API here, this is a simple tool for managers to download a CSV. The tool was not designed to be an API.
But I made the changes anyway. For every requests I was making all the databases calculations. On some places, I even made web requests inside the request.
So I started creating cron jobs (a scheduled task) to prefetch the data ahead of time and make browsing the service faster. I wrote it, tested it, and it worked on my machine. Victory.
Now a new problem. The server I was deploying to was a staging server for another website that required very low maintenance. So they let me use it as my production server for GStat. Cheap bastards wouldn't spin a new VM server just for me.
Anyway, the server refused to run my cron jobs. I checked error logs, permissions, groups, everything I could think of. I couldn't make it work. The day of the deadline was approaching. In desperate times, drastic measures will be taken.
Monday morning, I sent a group email welcoming the brand new API from Gstat. The developers tested it and were very happy with the results. Everyone was happy. Except me. I did something I was not proud of. I created a hack in the very system that I had designed.
What they didn't know was that. I setup a CRON job on my own machine to access a specific script on the server via URL to start the pre-fetching of data. This was to run twice a day to have up to date data.
That's not how I do things usually, but because of the time constraint I had no other choice. Now I couldn't shutdown my machine when I leave for the day. (I shut down my machine every goddamn day)
For the following months, I received all kinds of weird feature requests, each attached with their very own deadline.
The worst request was to add 200 iframes to a page and refresh them every minute. The manager thought this was a good way to detect if one of our websites was down. (Don't even start!)
One day, I wanted to make a simple fix on the date time format and notice that my once cherished code became a living hell. The whole service was a hack. I didn't like it. Because of these deadlines I was forced to create this pile of garbage. It worked, but it was garbage. If only they could give me time so I can create a proper framework that can handle all these tasks with ease.
You get what you wish for.
I was given the green light to dedicate all my time to GStat.
Now, for the first time in my career, I got a notebook and wrote all the specs. I inked down all different scenarios and provided solutions. I even created a simple templating engine inspired by smarty; not as complicated but very flexible.
I called the Sysadmin, and I found out that my crons were not working because the website running on the server used an unconventional directory name for its crons.
I also created a command line system similar to the one you find in Symfony (With all the fancy colors).
Not only I learned a lot, but I created an amazing framework. The website was so fast, that I had to make visual cues when you moved from page to page; because the navigation didn't even flicker when you clicked on a link.
I was proud of my work. Almost felt like a celebrity when people asked, "Are you the creator of GStat?"
Then one day, one of the managers collapsed and was rushed to the hospital. The doctor said he suffered from chronic featuritis.
One feature after another, deadline after deadline, my code became just as disgusting as before. Few month into it, I was back to square one.
Management changed hands and the project was abandoned. I learned the lesson. Time healed me but I shall never forget the experience.
I learned that the only way to keep a project clean, was to scream No! followed by a loud screech until the manager left me alone.
I rejoined my team that were very glad to help me reintegrate society. Time cures everything.
A few month later, a new intern was hired. On that day, all the memories were brought back. My name was plastered all over some big pile of code he inherited. So he asked to speak with the maker. And said maker was to mentor him.
Of course I didn't document the code. The code is the documentation right? I mentored him. I did my best and let him fly with his own wings.
A few days before I left the company, I went to check the service. See how it was doing. For old times sake you know.
index.php was renamed to
runapp.php. It was a whole new framework. The intern rewrote the entire thing. God bless his heart. I hope he doesn't fall in the same infinite loop I just finished recovering from.
Why do I tell you all this?
Because programming is hard. Programming is so freaking hard. Sometimes it's so hard that I am depressed and I don't know who to talk to about it. I can't call my mom and tell her:
Mom, it's me... I screwed up again.
Most if not all my friends work at a job were you have to wear back braces and lift a heavy object. They all think "You have it good man, you work on the computer".
Programming is not as cute as President Obama and Michael Bloomberg make it seem. It's hard. Did you see those little games they made using drag and drop? Did you know that someone had to program the application that allows you to drag and drop things?
Did you ever try to make a game? Did you ever have to deal with openGl and shaders?
Programming is stressful, it's hard. It's not for the weak hearted. Sure, I love programming. But I can't say everyone should code with a straight face.
Everyone should take a programming class just like they take a chemistry class in high school. Just to see if you like it. You are not a chemist today are you? (If you are, good for you)
But working as a programmer from home or in office is not a luxury. You don't get to sit down and play solitaire as they say. You solve problems. And by God, there are so many problems.
Even a simple blog that like this one, that almost no one visits is hard to maintain. Sometimes, I write code that should work. I know it works. I tested it. But as soon as I deploy, it doesn't work. Why?
I go through my logs, I see a bunch of people with tons more experience than me trying to hack my poor website every single day. Why? What did I do to them?
Have you tried to maintain code written in C? Why do they think I know what
p is? Why is
p |= b << a; Why didn't they give those variables proper names?
Every ruby programmer will tell you how easy it is. Just type scaffold and you are done. Have you tried setting up the damn thing in the first place? Nothing works.
Why is PHP giving me a Segmentation fault?
Oh God, please make this post end before I go nuts.