Update on Programming: “It pays the bills” vs “It satisfies me”

I’ve gotten a lot of positive responses for my previous article: Programming: “It pays the bills” vs “It satisfies me”  and it has now be republished in Chinese here , here, and here. Thanks to my Chinese readers. I can now check off another item on my list of lifetime To-Dos. Programmers of the World, Unite!

Booyah!

Debugging: joy or necessary evil?

That’s it, you’ve done it. Spent countless hours programming this feature, the design was excellent, the coding grueling but finally: It is ALIIIVVVEEE…Wait! What was that? No…No, that’s not how it’s supposed to go, WTF (What The Fortran)!?. And so it begins, you now need to DEBUG! Personally, I do enjoy it and i recognize that due to its nature, it is understandably not a cause of enjoyment for all. First of all, there has to be a distinction made between debugging your own code, and debugging code written by somebody else. I do not enjoy the later as much as the first.

Debugging someone else’s code

Debugging somebody else’s code is obviously a longer process, where you have to get into their thinking mode, and reverse engineer their code. If the code lacks comments or proper documentation and is not particularly clearly written, then to me, debugging becomes a necessary, soul sucking, sarcastic evil. It can provide for some entertainment though, and is nonetheless a good learning tool whether the code is great, in which case you learn new techniques or patterns and improve yourself, or find the most horrifying pieces of code that even as an inexperienced but sharp programmer you can detect all that is wrong with. In both cases you are able to grow by learning from someone else’s coding abilities (or not).

Debugging your own code

To me this is where most of the fun is, as I think of it as me against myself type of fuel. It offers incredible insight into the way your mind works and increases your self awareness. It’s a game of highs and lows where at times I’ve felt like the smartest person on earth for coming up with a clever solution for a particular bug, or the dumbest for making such a dumb, obvious, noob programming mistake. And sometimes a mix of the two but nonetheless a rewarding experience.

The debugging mind

I’ve realized now through my career that the same set of problems usually have the same set of solutions. That is the crux of experience. My greatest gains as far as knowledge and experience have come not from designing a new solution to a problem, but rather from coming up with alternative for an existing one. The number one skill required in debugging is, and let me put it in bold: patience; this is where most realized that they were not built for computer science in college. Through the first programming assignments and the obligatory long debugging  sessions that followed to ensure that the code turned in did what it was supposed to, those that were not cut out for computer science were initially weeded out, including friends of mine. It takes patience to sit in front of a computer screen staring at lines of text that are not part of Facebook or Twitter, re-running the same piece of codes, hundreds if not thousands of time and still not getting them  (lines of text) to do what you want.And still go back to it. And again. And again…Until you get it. And this is where the second crucial component comes in, and not just in debugging but in programming in general: passion.It does not take only patience to sit in front of a computer for hours when you could be doing ten thousand other  (better?) things. It takes passion, and most of us in the field are in it because we love it and love takes sacrifice sometimes.

The Bug

The Bug, in programming, is usually of our own making. Like a rebellious child bent on destroying its genitor (at least that’s how i see it). It can be subtle, smart and refined, or on the opposite freakish, flamboyant and agressive. The latter is usually picked up at the compiler level, and can be promptly subdued and compiled merciless into submission but the former…Ahh the former, The Bug….it is the silent ninja assassin created and trained in the depth of our mind who comes out attacking in full force once the program is running. In debugging I have learned that indeed as The Ghetto Brothers have rapped about, “my mind is playing tricks on me”. Sometimes The Bug is sitting in plain sight in my code, and after pulling countless hours trying to find a solution i realize that it had just pulled an “Wandering Eyes” ninjutsu that had me looking everywhere else in the code but the most obvious part for it. I do feel dumb and taken advantage of when that happens. But it is all part of the game because as I also learned, The Machine Only Does What You Tell It To. I’ve spent countless hours screaming at the code for not getting the logic right only to find out that mine indeed was the logic that was flawed and that The Machine Only Does What You Tell It To. Enough said.

The Challenge

To those programmers that enjoy debugging, I think the enjoyment comes from The Challenge. The Bug is indeed an enemy, standing in the way of your own self assessment as a (very) good (even excellent) programmer. The Bug and The Machine are plotting against your intellect and have officially thrown “The Challenge” to your face. How disrespectful! It is as if they were 18th century Frenchmen who just pimp-slapped you (reverse of the hand) and said: ‘I challenge you Monsieur, to a coding duel!’. Are you going to take it like a Frenchman(*See legal disclaimer)? Are you? Non Monsieur! They shall soon regret rising against your algorithm magnificence!

Once down from your ego high, you realize that although it strongly feels like a duel between Man and Machine, where most of the time, you are really fighting yourself.

*Legal Disclaimer: I by no mean imply that a Frenchman taking it  is nothing more than a Frenchman taking it in the context of an 18th century duel. I have nothing against the French, in fact my best friend is French (and his name is Fry’s like in Futuruma).
 

Google/The Community

Debugging would not be the same without search engines. Debugging would not be the same without Google. As a matter of fact, I’ve gained respect for the old school programmers that used to fight it out by themselves. Today, your Google-Fu mastery may be as effective as actual coding/debugging skills to resolve problems. I would like to think that I am at least a Google-Fu black belt (I will tell you for sure next month, I am taking the certification exam). The trick in using Google, and where most brown-belt-and-under  Goog-Fu practicioners fail, is learning to properly formulate your search terms. I know the secret, polished and sharperned by years of practice, and I can teach you, for a nominal fee of $7.99, but WAIT! If you tweet this now, not only will i teach you the secret once, but i will teach it to you TWICE and if you still don’t get it I will slap you in the back of the head until you get it! But seriously, for most bugs, the developers community have been good through various sites in documenting most bugs and even in the case of new or specific-to-your-own-case ones, by being a little analytical, you are given enough of a clue to know what direction to look into. More than often this is enough to reach a “RESOLVED” status on The Bug. By the way, when you ask a question to the community on a forum, get help, or figure it out on your own, come back and post it for future generations. If you don’t fine but don’t come back and post “I’ve figured out how to do it! “, not post your solution and disappear for good in the depth of the Internet. That gets you bad karma. I know, I’ve sent it your way. Debugging can sometimes be a detective game and understanding it from that angle will sometimes help relieve the tediousness of it. It sometimes take painstaking, slow, detail oriented work to solve the crime but when that happens The Yeah! Moment is a reward in itself.

The Yeah! Moment

This is the moment we do it for, whether it’s debugging or programming, the moment where IT WORKS! The gratification, the adrenaline, the rush, the congratulations, the hugs, the smiles all in sloooooow motion. The Hollywood moment. The Kick. More than the paycheck, that’s the feeling we are craving and working for. It’s the sense of accomplishment as I was explaining to my wife that keeps you coming back. I think one of the greatest things about programming is that you can go home everyday and feel like a million bucks because you feel like you saved the world (as defined in your business requirements). The Bug has been conquered, The Machine subdued and Man reigns supreme.

The Council Of The Sages

Now a long time ago (equivalent to two hours in a Twitter moderately busy TL), a group of great programmers, The Council Of The Sages, wise from their experiences fighting The Bug, came up with design patterns, tools and methodologies to give Man success in the fight against debugging and the loss of productivity. They invented JUnit and its clan of ruthless TDD derivatives, Log4J The Recorder and The Tribe Of The Logging Tools, Firebug, the fire breathing cockroach spreading terror in the heart of Javascript critters. Those are all great tools and methods to help you in the fight against The Bug, and I encourage you to look into them to better your craft, although I admit that sometimes System.out.println is just too tempting to pass on. Bad, I admit, but it just feels so right…

Credits

So The Bug died a horrible death and the sun started setting and you and your laptop turned to the camera and shared a passionate kiss when all of a sudden…

In conclusion I hope I did not turn my one paragraph blog thought into a full fledged i-don’t-know-how-many paragraphs ramble but since it seems like i did and that I rambled more than I thought about debugging I will just accept the facts as they were and strongly encourage you to do so if you are still reading. Debugging does not have to be a drain on your morale. If it still is, just imagine The Bug and its eville associate, The Machine having a drink on you, giggling, pointing fingers at you, laughing hard hahas of the Simpson’s Nelson haha! Are you gonna take it? Are you?

Note: Be sure to come back next week for my next post: “Testers: The Enemy Within”. Yes I said it!

Programming mistakes and how to avoid them

For a good write up on some common programming mistakes and how to properly avoid or mitigate them, check out this excellent article by Paul Tero. Not only you get an explanation of the mistake, but he also gives you some tools and techniques to use alongside. What i really appreciated as well about the article is that Paul is not shy about admitting to past mistakes, no matter how serious, which helps give perspective about their repercussions and is without a doubt a sign of experience and maturity. Insightful to say the least, I have made some of these mistakes and picked up a few best practices from him:

My Favorite Programming Mistakes.

 

Google Music Beta: A couple of months later…

I was excited to participate in the Google Music Beta testing and so far i can say that i really like the app. It performs well as far as playing music, specially through Bluetooth which i use daily. Be warned though that you better organize your music before uploading to the cloud. As I have found, once it’s up there, if you need to delete anything, well, let’s just hope that you have a blazing fast connection and the patience of a pimp. I basically gave up. My collection is unorgazined and since it seems that Google is following the convention (is it one?) or organizing albums by the “Album Artist” property of the IDv3 tag, well let’s just say that i have thousands of albums of one song…in the cloud…teasing me…Anyway, I looked for a way to wipe my collection clean and start over, but it seems that for now, no dice. You just can’t delete all your files in the cloud.

My second problem, which is more of a feature request, would be the ability to tweet the Now Playing song name and artist, optionally album with the #np hashtag from within the Android app. That would be neat and up to the time! My solution for my earlier problem right now is to just deal with my offline music until somebody comes up with a solution. I’ll ping the Beta team with my problem and see what comes of it.

Update 07-08-2011: Other people are apparently trying to do the same. No dice so far.

Update 01/19/2012: To delete your entire music library and start from scratch, go to Music Settings (Click on the Gear Icon next to your Google Profile picture in the top dark Google bar) and choose the option Delete My Library. It was a long time coming!

 

Programming: “It pays the bills” vs “It satisfies me”

At this point in my career I find myself increasingly frustrated with my day to day work. You see, living in the DMV area (DC-MD-VA), a lot of the jobs available are in government contracting and as many will tell you, those are well paying jobs with a certain level of job security added. For a while I did it and enjoyed it but deep inside i knew that this was not really what i want to be doing for the rest of my life. With things being the way they are, even when trying to switch jobs, it has been easier to do so going from one government contract to the next, with my attempted moves to the private sector being unsuccessful primarily because first my experience is mostly related to government projects, and second, the pay range was below was I was willing to go for. It is not greed on my part, but being married with kids means ” I got mouths to feed man! “(<= in Dave Chappelle’s voice) and obligations I have to tend to and can’t ignore.

This has limited the number of opportunities I considered and from a passing thought in the back of my mind it has grown into a daily contemplation of my future in this business. Over the years, I have gravitated toward doing and enjoying more of the front end work, and it’s a coincidence that the field in itself, especially when it comes to enterprise J2EE development, is becoming a full position in itself as opposed to being lumped in the “Java Developer” category just a couple of years ago (It still is, i just got another inquiry from a recruiter looking for a Java Developer where most of the work is front end related). My frustrations with the projects I have been on mostly stem from the technological limitations of working on government projects which sometimes involves outdated technologies,  security limitations and convoluted requirements that end up taking the fun out of the development process. From a design and functionality point of view, these applications lacked the “Wow” factor and being internal applications, even if they were, they were not of the “living portfolio” type of web applications that customers companies want to see when interviewing a developer.

I’ve realized that the type of work I want to be involved with has to be challenging, innovative, and current to what’s getting done today. It has to be a good mix of creative and technological skills that keeps me on my toes and gets the “Cool!” approval from family and friends when presented with it or when explained to, instead of a blank stare and a “Uh?”.

To work towards achieving that goal, I’ve started working on projects of my own, ideas i have been nurturing for a while with the hope of turning it into a startup if it gains traction. It’s a combination web/mobile app developed with CakePHP and Sencha Touch that has helped me turn some of the concepts and techniques I have been reading about and itching to try into actual code and challenged my thinking and skills in a way I had never experienced before. It has forced me to step out of my comfort zone and try new skills I didn’t practice before and it is a continually rewarding experience. I’ve also started working on side projects for friends of mine in order to expand my skill set and keep it sharp and relevant.

Through discussions with others (friends and colleagues) I’ve found out I was not the only suffering from this programmer’s “existential malaise” but some choose to go with the status quo while others like me find other projects to get involved with on the side that keeps them interested and challenged.Some have started their own startups, non-profits and organizations, building on the skills they have and pushing into new directions. Me, I figured I could spend my free time better than racking up “The Feared” accolades on Modern Warfare 2 or shouting angrily at my TV because my players messed up again in Fifa 11.

All this in waiting for that project that will bring the good mix of creativity, innovation, coolness and most of all, “will keep the kids fed, man!”(<= in Dave Chappelle’s voice).