2010-03-03

“All of this agile nonsense is just a fad. Don’t listen to the buzz. It’ll wear off eventually and all of those agile, pair programming nuts will move on to the next hot, new industry practice. You’ve never been agile before and it’s worked out just fine. Why start now?”

It seems as though the latest movement (read: fad) in the world of software development is agility. Everything needs to be made agile nowadays. The other day Chad interviewed a potential programming candidate. When asked about a line on his resume mentioning that he had experience in AGILE methodologies the candidate rattled on for about ten minutes about each aspect of the code that was agile, each of the practices that were agile, and everything else.  Agile, agile, agile. It almost seems like a buzzword these days and it can be kind of hard to see past the smoke and mirrors of this whole agile development thing.

This book does not give you smoke and mirrors. In fact, you might be better served replacing the word agile. Go ahead and give it a try. The book is just as valuable if you were to say, “Practices of a Pragmatic Programmer,” “Practices of a Nimble Programmer,” or even “Practices of a Great Programmer.” Practices of an Agile Developer by Venkat Subramaniam and Andy Hunt (of The Pragmatic Programmer fame) is a nice read detailing the 45 practices that agile developers can use to improve their code and their workflow. That’s right, increase your agility! Each chapter and section details a specific practice to ensure that you are on-your-toes agile. Now, when I say agile I mean “best practices that every programmer should follow and every team should implement.” Like the authors of the book, I do not recommend instantly practicing every tip. Some of these will not integrate with your process.

Like I said earlier, there are 45 tricks of the trade contained in this book. Implementing them all would be such a radical change, even the authors note you would be hard-pressed to jam them all into your current project. Some of the practices are key advice that do not require a process change such as: “Blame Doesn’t Fix Bugs,” “Don’t Fall For the Quick Hack,” and “Do What’s Right.” Most of the practices are definite should-dos that definitely should-not take a lot of effort such as: “Keep You Project Releaseable At All Times,” “Integrate Early, Integrate Often,” and “Measure How Much Work Is Left.” Other practices, might be a harder sell to get implemented easily like: “Treat Warnings Like Errors,” “Tackle Tasks Before They Bunch Up,” or “Use It Before You Build It.”

The book does a great job of briefly describing each practice, explaining why it will make your life so much better, and providing excellent example uses. (Is there anything Venkat and Andy haven’t seen?) I think in a world of verbose programming books, that really is undervalued. Each chapter, each practice is concise. They don’t bother with a five page history of how unit testing came to be. If you really, really need some history or anecdotal evidence, you will get the skinny. Mostly you are going to get two or three reasons why the practice will make your life easier. In fact, if you were wondering why I did the review of the book in the format you see here, that’s because this is how they layout every chapter. It begins with perhaps some common opposition to the practice as the devil on your shoulder. Then they go right on to the meat of the chapter, discussing the practice itself, the benefits, and an example of how awesome it worked. This is followed by the practice name (the one you’ll find in the cheat sheet in the back) with a description from the angel on your shoulder. To wrap up the chapter, they include how good you will feel for doing it right and some tips on how to keep balance. I really like these tips because if you become skeptical of the practice, it kind of shows you that there is a way to make sure you don’t overuse the practice or try to solve a problem that doesn’t make sense with it.

Read Practices of an Agile Developer. A good book is a good book just as good advice is simply good advice. It may seem like some of the practices in this book might not work for you. That’s fine. A lot of the text in this book, however, transcends agile as a buzzword. Agile does not mean a strict diet of pair programming, unit testing every single function of every single class, and using Erlang and Java for every project.

What It Feels Like

It feels good to stop planting time bombs in your code, staying nimble, and keeping your code nice and clean. A deep sense of accomplishment comes from within when you start realizing that you have cut down on bug counts as your peers point out those nested logic errors in a code review. There is a moment of zen to be found when your build machine kicks out the first working build. That new hire will give you a hug when he sees how the code-base is clear and, oh my, commented well!

Keeping Your Balance

  • Don’t go out and grab this book just because I told you to. Go buy this book if you want to improve.
  • This book IS a short read, but it is also a good one.
  • Practices of an Agile Developer is not a magic bullet. You have to want to improve and you have to act on what you read. As noted in Pragmatic Programmer and Joel on Software, don’t let the higher ups get you down. Implement this stuff locally if need be.
  • Share/Bookmark
2010-02-28

At the end of last year I made a blog post entitled New Year’s Resolution? Be A Better Coder. In that post, I detailed three key areas in which I hoped resolved to improve. This is the end of the second month and here’s my progress. (Hey wait a minute, that’s not fair. This was a short month!)

1. Read More
The Idea: There is so much knowledge in both books and online. It would be a bountiful effort to take in some said knowledge.
The Goal: My goal is to read three books this year (one every four months) and subscribe to ten good blogs.
The Progress: One. More. Chapter. I have been reading Practices of an Agile Developer and I am very close to finishing it. I have but one short chapter to go. On the blog front, I have subscribed to three more programming blogs to bring my total to eight. (No, I’m not counting myself.) Now, I really want to start following more game programming blogs specifically. Anyone have any recommendations? I’ve only but a few.

2. Learn a New Language
The Idea: Every language is a tool in the toolbox. Learning more tools and maintaining a repertoire of them would be most beneficial.
The Goal: My goal is to learn and implement a few solutions in Python and in Perl.
The Progress: I have implemented some Python at work. I have been delving into SMTP, MIME, and data structures in Python to create a nightly process that will really help out. I think I gained a good chunk of knowledge and made ample progress on this (for a short month.)

3. Be an Architect
The Idea: Where a programmer applies some duct tape to stop a leak, an architect replaces the corroded pipes with sturdier ones. This is most essential to career advancement, I’d say.
The Goal: My goal here was a little more extract. It was a promise to leave things in a better state than when I found them.
The Progress: I think I created a monster! At work, I started using a tagline to legitimize a background initiative I had for cleaning up the code-base and ending a dependency on an immutable, third-party library. Well, this month it’s catching on and people have been making check-in comments beginning with the tagline. Is this being a good architect?

  • Share/Bookmark
2010-02-25

I am going to admit right now that I only wrote this article because I thought of a clever title. I have figured out that any piece of coding wisdom to be handed down must come with a catchy title or an easily rememberable acronym, else it risks being ignored. This I say to you. Coding in a vacuum sucks! CIAVS, as the kids say these days.

Okay, maybe the kids don’t say that. Maybe the kids are too busy playing video games and they’d rather call people “fag” on XBox Live. However, I would like to imagine a few cowboy coders sitting in mom’s basement reading programming blogs and trying to create the game of their dreams. To them I say, “Coding in a vacuum sucks!” What do I mean by coding in a vacuum, though?

I mean a few different things. First of all, coding alone. Being the only coder on a project. Yes, it is nice every now and then. You don’t have anyone mucking around in your code. You have the liberty to program as you please. (Hey, maybe that’s another blog title right there!) With reckless abandon, you can ignore warnings, write single letter variable names, and sweep exceptions under the rug. Yes, sir. You can ignore all forms of good practice and really crank out some code of terrible design. Not to post again about the power of a good code review, but every once in a while you should have someone review your code. It is incredibly hard to catch bad habits that you formed as a self-taught C Programmer ten years ago.

The buck doesn’t stop there. Just as beneficial as having someone else read the code that you have written, I would argue that it can be mutually beneficial to read the code that someone else has written. You might pick up on something. The other day my friend made a post about something he did in his own code and a very informative comment let him know about the Resource Acquisition Is Initialization idiom. I did not know the acronym, but it is a cool pattern that I had seen utilized at work before. Had I been programming off by my lonesome, I never would have known about this type of pattern. (But I would still hate the goto keyword.)

You may be asking yourself, “But Chad, how can I avoid it?” Here are a few surefire tips to avoid separating yourself from coding society.

Don’t code in your own branch! It’s true, partitioning your changes off so that only you see them is fine sometimes. That is, as long as you integrate often. When you spend a few weeks in the chad_monkey_work branch, however, you cut yourself off. It is easy enough to duplicate changes that someone else is making, introduce subtle bugs in another system that you are not testing, and set yourself up for a painful merge.

Get involved in open source! Open source projects are kind of a bear. Anyone can contribute, so usually there are some pretty decent projects out there with style guidelines that are simply dreamy. Getting involved with an open source project is a good way to start familiarizing yourself with new paradigms, patterns, and coding styles. With any luck you can get some feedback on your own stuff, too.

Join a forum! Go on! Give it a shot! There are communities out there willing to talk shop. You can visit StackOverflow.com or DreamInCode.net, just to name a few. You can also look for a community focused a bit more strongly in your preferred language or area of interest. Are the XNA forums more your flavor? Give it a whirl. Who knows what kind of niche advice, tips, or tricks you’ll discover?

Now go out there and be as social as awkwardly possible! Don’t make me break out more bad puns. You won’t like the title of the next post. Trust me.

  • Share/Bookmark
2010-02-16

Recently the topic of code reviews has been coming up around me. I had been doing some consulting work last month. (Remember that game you played in school on graph paper? Go buy Family Dots, a family friendly game!) They mentioned that they had Jason Cohen conduct their technology related interviews because, “Hey, he created Code Collaborator. He programmed a program to help programmers. He’s a fan of code reviews. He must be a smart guy, right?”

Also quite recently, my friend began writing Objective-C. He’s not a bad programmer, but he is new to the nuances of the world of Obj-C. In fact, he’s much less of a bad developer in my mind because he was cautious. He asked me to help him out and give his source a quick code review.

In another, unrelated case, someone at work asked me to swing by for a code review of about ten or twenty files that would be going live and possibly seeing heavy use. It took us about twenty-five or thirty minutes, but we sifted through each and every change in that diff.

It seems code reviews have been popping up left and right for me and you know what? I am glad! You can doubt the power of a code review. You could argue that it costs more time than it saves. You would also be wrong! That’s right, I’ll go ahead and say it. Code reviews are an amazing way to catch potential bugs before they are born. It doesn’t have to be fancy, necessarily. The simplest of methods is better than the most absent of methods. It doesn’t have to feel like a firing squad, either. In fact, it shouldn’t. A code review should feel like your parents helping to nurse a newborn baby or helpful critique from your girlfriends before girls night out.

Listen, you’re prone to typos. No finger is too precise. A code review can catch that. You might make a small mistake in your order of operations. A code review can catch that. You might even be the root cause of some latent bugs! You know what? A code review can catch that. Just about any mistake has the potential to be caught in a code review. The owner of a system will tell you how radically different you’re using his interface than intended.

You ever hear people mention something about a second pair of eyes? (How about a third or fourth?) Attached to those eyes is a fresh, critical brain that thinks in an entirely different way. A whole new thought process! That unique brain has serious potential to find those killer logic bugs, or at least nitpick your variables until you find them yourself! Maybe you did not know that comparing to a string’s Length property was faster than a string comparison to String.Empty, or maybe you would rather be explicit and check String.IsNullOrEmpty(). (Maybe you didn’t know these lovely functions exist!) Hopefully, in a few weeks, months, or years your code won’t be that war zone other developers avoid.

So what am I saying here? Perform code reviews? Is that really my only piece of advice? Yup. (For now.) If I can sell you on the merits of doing peer code reviews now, maybe later I can talk about them in more depth. (Definitely expect a part two.) I believe they save more time than they cost. I think they help maintain solid, consistent, and readable code. Hopefully, programmers can better develop their skills through peer review as well. However, let me talk about those two code reviews I mentioned earlier a little bit.

My friend, new to Objective-C asked me to code review some of his work. Luckily for him, it turns out that I happen to know a little more about memory management in Objective-C than he does. There were a lot of small leaks that got cleaned up as a result and a whole pantload (That’s big.) of C++ code that translated into two or three Obj-C messages. It was like building a skyscraper when all you really needed was a doghouse.

At work, a new member of the team asked me to attend a code review since he would be checking code into a branch critical to me. (Read, a branch in which I deal with all the fallout.) During our review I found three critical issues that would have plagued my team much farther down the road. They were mostly catching unnamed exceptions. (Please don’t sweep exceptions under the rug, especially without naming them for your friendly neighbor, who will be debugging that code later.) This is exactly a problem we had seen in the code three or four times before and you know when your office mate hits it from the loud, “Ugh!” that suddenly fills the room.

So you see, much pain was saved in the long term by spending the time in the short on the code review. Whether you’re doing them over-the-shoulder, by email, by changelist, or by something Smarter like Code Collaborator, the code review is a powerful tool. I hope, if you did not believe in it already, I have sold you on the benefits of the code review.

  • Share/Bookmark
2010-02-01

At the end of last year I made a blog post entitled New Year’s Resolution? Be A Better Coder. In that post, I detailed three key areas in which to improve. At the end of each month, I have decided that I will give a little status update.

1. Read More
The Idea: There is so much knowledge in both books an online. It would be a bountiful effort to take in some said knowledge.
The Goal: My goal is to read three books this year (one every four months) and subscribe to ten good blogs.
The Progress: Out of all the resolutions, I think this is the one where I am tearing it up. I am a little more than half-way through a book I picked up after The Pragmatic Programmer (See my post on that.) called Agile Development. On the blog front, I have finally set up my Google Reader and I am following five programming blogs (and XKCD, of course). As an aside, I am always looking for recommendations!

2. Learn a New Language
The Idea: Every language is a tool in the toolbox. Learning more tools and maintaining a repertoire of them would be most beneficial.
The Goal: My goal is to learn and implement a few solutions in Python and in Perl.
The Progress: None. I could give you five great excuses why I am too busy, but great excuses only help me to develop my ability to bullshit.

3. Be an Architect
The Idea: Where a programmer applies some duct tape to stop a leak, an architect replaces the corroded pipes with sturdier ones. This is most essential to career advancement, I’d say.
The Goal: My goal here was a little more extract. It was a promise to leave things in a better state than when I found them.
The Progress: On two projects that I am working on, I have been able to clean up some rather hairy code.

  • Share/Bookmark