May 14 2009

Nifty Firefox Plug-ins, Ghostery and YSlow

Category: BloggingPhil @ 8:51 pm

I found a cool little plug-in for Firefox last week called Ghostery. It alerts you about the web bugs, ad networks and widgets on every page that you visit. It is really eye opening, to see how many hidden scripts are embedded in web pages. I am kind of addicted to it now, I feel like I am missing something when switching back to Internet Explorer! The little window to the right is displayed when you visit my blog.

Another amazing observation is how many sites have Google Analytics embedded in them. I have been using WordPress Stats to monitor my blog for the last couple of years. When I switched to Bluehost, I decided to enable Google Analytics for my site, as well as my wifes. If you have not checked out Google Analytics, you should seriously check it out… It is very well done, generates volumes of metrics, and extremely easy to add to your blog or website.

I have already blogged about ScribeFire in the past, I use ScribeFire to do all of my blogging; it is a really nice little tool to create new and edit content on your site. A co-worked hipped me to another interesting plug-in a few weeks ago called YSlow, which is integrated with Firebug.  If you are developing web pages and are concerned about the rendering speed, these two plug-ins look to be the answer. YSlow analyzes web pages and suggests ways to improve their performance. Pretty cool idea! I seem to spend more time on the backend plumbing, but hope to look into these tools more in the the near future.

https://www.beilers.com/wp-content/plugins/sociofluid/images/digg_48.png https://www.beilers.com/wp-content/plugins/sociofluid/images/reddit_48.png https://www.beilers.com/wp-content/plugins/sociofluid/images/dzone_48.png https://www.beilers.com/wp-content/plugins/sociofluid/images/stumbleupon_48.png https://www.beilers.com/wp-content/plugins/sociofluid/images/delicious_48.png https://www.beilers.com/wp-content/plugins/sociofluid/images/blinklist_48.png https://www.beilers.com/wp-content/plugins/sociofluid/images/blogmarks_48.png https://www.beilers.com/wp-content/plugins/sociofluid/images/google_48.png https://www.beilers.com/wp-content/plugins/sociofluid/images/facebook_48.png


May 13 2009

WordPress Migration Complete….

Category: BloggingPhil @ 12:03 am

I finally am back in the the blogging business. Moving the actual domain from my local machine to Bluehost was pretty simple, most of the problems I encountered were self induced!! It was a little more tricky to move my WordPress site from one domain (home.beilers.com) to another (beilers.com), but not really very hard.  Things to be aware of:

  1. Kind of funny, the support staff knew exactly how to answer my question, just like a script! After you export your data from your old database and import into the new database, you need to change two (2) rows in the wp_options table,  ids #1 and #39 need to be updated to the new domain URL. Nice magic numbers!
  2. All of my images were missing in the old posts after the migration, good thing I don’t use a lot of them! Unfortunately after I imported the data, I realized that the full (old) URL was specified in all the <img src=””> tag attributes . I had to go through each post and change it to the new URL and path. Kind of a drag; I probably could have written a database query to do the update, but it just seemed easier to update them by hand! If I would have been more aware, I could have done a global search and replace in the exported text file; that would have been too easy!
  3. There was another small import/export problem. Anywhere I used “quotes” around words, the quote (“) character was displayed in some encoded format, about 5 or 6 characters in length. I don’t remember the exact sequence, but it was pretty visible on the page, especially if you had them in a title. I might have been able to chose an alternative export format to better handle this situation, but by this time, it was too late and I really did not want to start over!
  4. Don’t copy over you plug-ins, it is better to just reinstall them. I simply copied over all my plug-ins and content; which mostly seemed to work.  However when I hit the clean cache button on my wp-super-cache plug-in, it toasted my site (no longer accessible!). I was on the phone with the support team for about 30 minutes. They gave me a little scolding, but are generlly very nice people!  I can’t say enough about how helpful they are…
  5. If you do move your site over, your image upload directory will probably be wrong too. Just go into your WordPress admin panel and update the upload directory to the appropriate location on the server, under your new WordPress installation. I only discovered this after ScribeFire refused to upload new images.
  6. There was one other weird thing, my WordPress account for wp-stats (as well as my Linked.com blog linkage) seemed to take a couple of days to synchronize with the new domain name, the old home.beilers.com reference was there for several days after the switch. It finally switched over to beilers.com this week. All I can say, is ignorance is bliss!

I’m very happy with Bluehost and my decision to migrate over to their servers. I’m set for at least 3 years now, I hopefully won’t have to go through this exercise for quite some time!

https://www.beilers.com/wp-content/plugins/sociofluid/images/digg_48.png https://www.beilers.com/wp-content/plugins/sociofluid/images/reddit_48.png https://www.beilers.com/wp-content/plugins/sociofluid/images/dzone_48.png https://www.beilers.com/wp-content/plugins/sociofluid/images/stumbleupon_48.png https://www.beilers.com/wp-content/plugins/sociofluid/images/delicious_48.png https://www.beilers.com/wp-content/plugins/sociofluid/images/blinklist_48.png https://www.beilers.com/wp-content/plugins/sociofluid/images/blogmarks_48.png https://www.beilers.com/wp-content/plugins/sociofluid/images/google_48.png https://www.beilers.com/wp-content/plugins/sociofluid/images/facebook_48.png


May 05 2009

Problem Detection, Recovery, and Prevention…

Category: Software DevelopmentPhil @ 7:51 pm

I have spent a lot of time discussing software principals and architecture over that last couple of years, and the subject of error handling and recovery always seems to always rear its ugly head. Most recently, in talking about moving from monolithic application deployments to a distributed, web service orientation, many developers seem to immediately go into paranoia mode. They only see two choices for working with distributed systems: the two phase commit or store everything approach, such that it can be resubmitted when the service is available. There is one other option which we cannot forget about, used by many applications regardless of their deployment, the traditional “logging, debug, retry” logic. Unfortunately, we developers like to add this code at the end of the development cycle, and usually as an after thought; but more on that later!

Let’s talk reality… When was the last time one of your systems actually failed due to some type of hardware or service failure? I honestly don’t recall a single failure. Considering today’s redundant hardware technologies, I believe it would be pretty hard to have a total system failure; provided we move away from those monolithic application deployments! I agree that some kind of isolation layer (protection) is required for systems outside of our operational control, such as remote web service. But, our internal network and applications should be a different discussion, one that assumes 100% availability. I realize that some systems can experience performance degradations, but that is also a blog for another day, not something that we should be “protecting” ourselves from. I believe that most of the bugs we encounter in the production environment are actually caused by incorrect or misunderstood requirements, and the the occasional developer contribution  (bad code, insufficient testing, etc.), not by a system failure. Another interesting finding, many of the bugs are actually found in the logging and monitoring (prevention) code, rather than the true business logic. What or who are we actually protecting ourself from?

One of our top goals should be to produce the smallest, simplest amount of code possible to implement the solution. I feel there are two (2) fundamental problem types:

  • Show Stoppers. A show stopper is a dependency in which your system cannot perform its primary function. For example if you created a purchasing system that relied on an external pricing service, your system cannot function without live prices. Assuming that this pricing service is internal to your company, there is no need to protect your service/application from this scenario. The actual risk of this type of failure is not worth the amount of effort required to implement and maintain a possible fall-back solution.
  • Recoverable errors. Recoverable errors are software problems that can be captured and dealt with later, at an appropriate time. Examples might include a failed database update or the failure to update a logging service. If the transaction can be still be completed, without the end user being impacted, this is an acceptable approach. The assumption is that we don’t have tens or hundreds of this issues to deal with, as they can and will happen over time. We just need to ensure that we have a method for recovering from the problems, ensuring that the system can be put back in the proper state of integrity.

I think the  relevance of this post is to ensure that “software issues” can be detected. If we can assume that collaborating internal systems are always available, we can eliminate most of the code to manage these dependencies. We should focus on a  common design/implementation/strategy that can ensure the detection of issues. Looking across existing applications, it seems that each one has its own unique way of capturing and monitoring problems; with each team spending significant design and implementation effort attempting to create a robust method. Ironically, with all of the work developers do, many of these systems have problems that go undetected for hours,days and even weeks, without anyone ever knowing that an “issue” happened. It appears that we should spend more effort on a common monitoring strategy to detect problems; one that makes us aware of problems within minutes, not hours of the problem occurrence.

The second part of this approach is the ability to recover. There are probably some other important concepts that I have in my head, not part of this blog, which actually makes this all possible. I think for a system to be recoverable, it should  be compartmentalized; such as smaller databases, each with its own functional domain areas; rather than a single, gigantic database with full referential integrity. By breaking the system (services and database) into smaller, self-contained “mini” environments, each detected failure has a smaller overall impact on the system, and ultimately makes it easier to recover, as the impact is now isolated to a distinct area of the system.

Hopefully, with ability to detect problems earlier, minimizing their impact, and simplifying the recovery process, should make the prevention of the problem easier to address. With smaller, simpler systems (services), it will be easier to locate and correct the offending code (because there is less code and data coupling), creating less risky changes which are easier to test and validate. Sounds like there is an overall win-win architecture in here somewhere… I sure hope I get to build a system with these principals and goals some day!!!!!

https://www.beilers.com/wp-content/plugins/sociofluid/images/digg_48.png https://www.beilers.com/wp-content/plugins/sociofluid/images/reddit_48.png https://www.beilers.com/wp-content/plugins/sociofluid/images/dzone_48.png https://www.beilers.com/wp-content/plugins/sociofluid/images/stumbleupon_48.png https://www.beilers.com/wp-content/plugins/sociofluid/images/delicious_48.png https://www.beilers.com/wp-content/plugins/sociofluid/images/blinklist_48.png https://www.beilers.com/wp-content/plugins/sociofluid/images/blogmarks_48.png https://www.beilers.com/wp-content/plugins/sociofluid/images/google_48.png https://www.beilers.com/wp-content/plugins/sociofluid/images/facebook_48.png


Apr 26 2009

Outsourced my web hosting….

Category: BloggingPhil @ 8:19 pm

moz-screenshot-6I can’t believe that I just outsourced myself! After my recent Ubuntu upgrade experience, I finally pulled the plug and signed up with bluehost.com. For the money, it is really not a bad deal; especially if you are crazy enough to have multiple domains. Now I just have to figure out the logistics of changing the name servers and track down where the email goes. Not too big a deal, I’m just not looking forward to explaining to my family, just where to find their email!

I was really impressed with the cPanel application, just a couple of mouse clicks and you have a WordPress installation, another couple clicks sets up your email, and a few more sets up the FTP space. Pretty slick! This was not near as much fun as spending multiple evenings learning how to set this up on my own box; now I can really appreciate everything that cPanel actually does.

As a test, I transfered one domain, windyknolldesignstudio.com. Hopefully, in the next two days, all of the name servers will be synced up and I can see what I actually did! When I decide to move beilers.com, there is even a way to transfer my blog to the bluehost server; that will be an interesting test!

https://www.beilers.com/wp-content/plugins/sociofluid/images/digg_48.png https://www.beilers.com/wp-content/plugins/sociofluid/images/reddit_48.png https://www.beilers.com/wp-content/plugins/sociofluid/images/dzone_48.png https://www.beilers.com/wp-content/plugins/sociofluid/images/stumbleupon_48.png https://www.beilers.com/wp-content/plugins/sociofluid/images/delicious_48.png https://www.beilers.com/wp-content/plugins/sociofluid/images/blinklist_48.png https://www.beilers.com/wp-content/plugins/sociofluid/images/blogmarks_48.png https://www.beilers.com/wp-content/plugins/sociofluid/images/google_48.png https://www.beilers.com/wp-content/plugins/sociofluid/images/facebook_48.png


Apr 25 2009

Ubuntu 9.04 Upgrade Disaster, Almost….

Category: Blogging,UbuntuPhil @ 6:38 pm

My Ubuntu 64-bit 9.04 upgrade did not go very smoothly, it left my machine un-bootable. The upgrade downloaded all of the packages, but seemed unable to install anything. The detail window was full of the same message, something about a dpkg failure. I was really bumming, as the upgrade on my 32-bit laptop worked flawlessly. I hoped that I could recover my blog, but was not exactly sure how it would workout. I tried using chroot after booting from the CD, but the install messed up the file system so badly, nothing would run.

I found an old 40GB Quantum Fireball drive in the basement and did a clean install. You have to give the Ubuntu team credit (even though I was pretty mad about my upgrade problem); the install was really quick and everything was auto configured after the install. I was super happy! The clean install actually fixed my NVIDIA driver issue; one of the 8.xx patches toasted my video settings about a month ago. I lost my advanced desktop effects, screen savers, and Avant Window Manager (dock). This actually ticked me off too, I hate when things don’t work like they are supposed too!  One thing that was really surprised me was how slow that old IDE drive was verses the new SATA technology. I have to get that drive out of my box, ASAP!

It was pretty easy to recover MySQL and WordPress. I never took the time to figure out how to backup MySQL, so I was a little worried about losing my blog data; I guess that will now be my number one priority.  The restore was as simple as copying all of the files from /var/lib/mysql and /var/www from my old drive to the new drive. I just had to change the file owners and groups, restart MySQL, and my blog was back, up and running. Not too bad!

Not that it would have helped, but my trusty NAS storage seems to have bit the dust last week; great timing!  I have been using a Buffalo Technology LinkStation for several years as my off-site backup, it is out in the barn! It has always worked perfectly, other than a noisy fan, which has been fixed in the new models.

I’m going to stop locally hosting my blog and sign up with bluehost. I think this will fix several issues for me; I won’t have to run my computer 24×7, upgrades won’t be such a risk, and maybe using them as an off-site backup.  I also plan to move my wife’s web site, she has an interior design business, over to bluehost as well; then I can setup a real site for her, rather than some simple web pages.

https://www.beilers.com/wp-content/plugins/sociofluid/images/digg_48.png https://www.beilers.com/wp-content/plugins/sociofluid/images/reddit_48.png https://www.beilers.com/wp-content/plugins/sociofluid/images/dzone_48.png https://www.beilers.com/wp-content/plugins/sociofluid/images/stumbleupon_48.png https://www.beilers.com/wp-content/plugins/sociofluid/images/delicious_48.png https://www.beilers.com/wp-content/plugins/sociofluid/images/blinklist_48.png https://www.beilers.com/wp-content/plugins/sociofluid/images/blogmarks_48.png https://www.beilers.com/wp-content/plugins/sociofluid/images/google_48.png https://www.beilers.com/wp-content/plugins/sociofluid/images/facebook_48.png


Apr 23 2009

Moving from Continuous Integration to Continuous Testing…

Category: Java,TestingPhil @ 1:01 am

I have been following Kent Beck on Twitter for some time, keeping an eye on his jUnit Max product. I think it is a very cool idea, especially with the Eclipse integration. If you have a well written jUnit suite, this could be pretty slick. I only wish Kent would kill the subscription idea; I can’t really blame him for wanting to make money, he just won’t be getting any from me! It is a bummer the tool is not free. It is hard enough to get some developers to build unit tests, now I’m going to charge them a subscription fee to execute the tests… Not happening!

Here was a short little post on the concept. Give it a read and share your thoughts…

https://www.beilers.com/wp-content/plugins/sociofluid/images/digg_48.png https://www.beilers.com/wp-content/plugins/sociofluid/images/reddit_48.png https://www.beilers.com/wp-content/plugins/sociofluid/images/dzone_48.png https://www.beilers.com/wp-content/plugins/sociofluid/images/stumbleupon_48.png https://www.beilers.com/wp-content/plugins/sociofluid/images/delicious_48.png https://www.beilers.com/wp-content/plugins/sociofluid/images/blinklist_48.png https://www.beilers.com/wp-content/plugins/sociofluid/images/blogmarks_48.png https://www.beilers.com/wp-content/plugins/sociofluid/images/google_48.png https://www.beilers.com/wp-content/plugins/sociofluid/images/facebook_48.png


Apr 22 2009

Validating and Managing Argument Dependencies with Args4J

Category: Java,TestingPhil @ 7:17 pm

I recently reviewed some Java code that was designed to process a set of arguments; my first thought… there has to be a better way! I did a quick Google search and found multiple command line processor implementations. My favorite seems to be the Args4J implementation. I like the simple Java Bean approach, taking advantage of Java 1.5 annotations, enumerations, and generics. The best part is the auto-magic type conversion from string arguments to bean properties. It feels a little like Apache BeanUtils, but the annotation processing makes it more flexible.  A pretty slick implementation, but with a couple of small tweaks, would have been even better.

The Args4J implementation provides an ample collection of option handlers to support automatic type conversion of the basic Java types. Option handlers are provided for the all of the numeric types, URLs, Files, bounded lists (enumerated values), as well as unbounded lists. The implementation is easily extended; custom option handlers can be added to support your own object types or specific input formats, such as dates.

Overall, Args4J is very well done; I would have liked to see a little more support in the following areas:

  1. Args4J provides no default support for handling Java Date Types. I created a simple abstract option handler to support any data format.  A concrete class is required for each desired format; but the subclass only needs to provide the requested date string format. An abstract date handler class might be a nice addition to Args4J, even though it was very simple.
  2. Args4J does not provide any type of argument validation, beyond basic type conversion. In my AbstractDateHandler class, I implemented a validate(<T> value) method. The validate method is invoked before the date instance  is “set” on the bean.  This implementation allowed me to ensure the specified date was before today’s date.  This was really pretty clean; if the specified date was in the future, the option handler threw a CmdLineException containing the validation error in the message. This exception was handled up the call stack, just like any other type conversion issue, no special coding required.
    • I can see this being very useful for numeric types as well. Maybe only positive integers are valid for as a specific parameter. The current Args4J implementation provides no way to seamlessly provide this type of validation via the Option Handlers (without cloning an the existing handler).
    • This type of validation can be implemented in the Java bean, but the annotation must be specified on the setter, rather than the property.  Some developers might actually prefer the validation logic it in the bean. Personally, I would rather see this logic managed by the option handler.
  3. The biggest hole in the implementation is the management of argument dependencies. For example, it would be nice to validate if the specified start date parameter is before the end date parameter, or if the print parameter is specified, the filename parameter is not allowed. This type of validation can be implemented in the bean, but would be invoked outside of the argument processing flow. You will have to mange exception logic in two places, once for the “type conversions” and another for the intra-argument dependencies.
    • There are some flaws in my theory, but I thought it would be better if the option handlers had some knowledge of their own dependencies. My theory works well for required options, but not so well for optional ones.
    • I created a custom CmdLineProcess class, which was hidden by suggestion #4 below. This class owned a dependency manager instance which made the previously processed command line values available to the current option handler.
    • An ArgumentsDependency class was accessible during the validation process. The handler could now ask the dependency manager for values that were processed by other handlers. In this example, the EndDateHandler is asking for the dependency manager for the value parsed by the StartDateHandler.
    • I know this is not perfect, but I really like the way the validation is implemented in a consistent manner, making it possible to handle all exceptions the exact same way.
  4. The implementation also provides a Starter class, which eliminates the need for the developer to write a main() method. It is an interesting idea, but I need to give this style a little more thought! I like having my options class independent of the execution class. The Starter approach merges the options and driver (main) logic into one single class.  I would have preferred to see an argument processor class, with a method like: public T parseArgs(final String[] args, final Class<T> clazz). The argument processor would catch all of the exceptions and output the validation errors and usage information; the caller would need to do no extra processing or validation.

I hope this gives a little more insight into how Args4J is actually implemented and one possible method for extending it. Maybe someone has already handled these problems in a more elegant manner, but I did not to change any of the Args4J source code. That restriction did not give me a lot of flexibility to implement my enhancements!  Overall, Args4J is a simple and elegant solution for sometimes messy problem.

https://www.beilers.com/wp-content/plugins/sociofluid/images/digg_48.png https://www.beilers.com/wp-content/plugins/sociofluid/images/reddit_48.png https://www.beilers.com/wp-content/plugins/sociofluid/images/dzone_48.png https://www.beilers.com/wp-content/plugins/sociofluid/images/stumbleupon_48.png https://www.beilers.com/wp-content/plugins/sociofluid/images/delicious_48.png https://www.beilers.com/wp-content/plugins/sociofluid/images/blinklist_48.png https://www.beilers.com/wp-content/plugins/sociofluid/images/blogmarks_48.png https://www.beilers.com/wp-content/plugins/sociofluid/images/google_48.png https://www.beilers.com/wp-content/plugins/sociofluid/images/facebook_48.png


Apr 12 2009

Angry Coder Mode

Category: Software DevelopmentPhil @ 1:46 pm

When you start researching the code review process, you run across a lot of interesting blog postings, from the process perspective to the emotional aspects.  I found this one, Working with your angry coder, and thought it was worth sharing. I stole the picture from his site too; both the kids and I thought it was funny!

Over that last year, I have definitely tried to be more aware of the comments I make. However, I do remember saying this phrase numerous times in the past “Whoever wrote this code should be shot!”.  I too apologize for to all of the people I’m made cry over the years! I believe that most of these comments were directed at the code and never the original author; I don’t think I am that angry!  I do have a passion and strive for perfection (at least the best job that I can do, given the scenario), which makes it very easy for me to be perceived as an angry coder. I used to think that I was the only one who cared about developing  software quality. Someone told me that most developers are generally passionate about something in the process, usually just not from the same perceptive as me. So in reality, everyone is trying to do the best they can, we are all just coming at it from different directions. We just have to find a way to work more smoothly as a team. As one of the comments said, it is all about understanding each other. To bring this back to the code review process, I think it is all about finding bugs and learning from each other.  If we truly practiced collective code ownership, maybe none of us would take the comments so personally and we would have less anger!

https://www.beilers.com/wp-content/plugins/sociofluid/images/digg_48.png https://www.beilers.com/wp-content/plugins/sociofluid/images/reddit_48.png https://www.beilers.com/wp-content/plugins/sociofluid/images/dzone_48.png https://www.beilers.com/wp-content/plugins/sociofluid/images/stumbleupon_48.png https://www.beilers.com/wp-content/plugins/sociofluid/images/delicious_48.png https://www.beilers.com/wp-content/plugins/sociofluid/images/blinklist_48.png https://www.beilers.com/wp-content/plugins/sociofluid/images/blogmarks_48.png https://www.beilers.com/wp-content/plugins/sociofluid/images/google_48.png https://www.beilers.com/wp-content/plugins/sociofluid/images/facebook_48.png


Apr 11 2009

RC Madness…

Category: FamilyPhil @ 3:03 pm

We gave our youngest son a nitro RC truck, the T-Maxx3.3 from Traxxas, for Christmas last year. He has wanted one for a couple years, and this year it was the only thing he wanted! We purchased it from Awesome Hobbies in Stafford VA. Not exactly sure how we ended up down there, but the owner has a pretty cool setup for the RC crowd. He recently moved his store from a strip mall to a large lot outside of town, probably about 3 acres or more. He built a race track that is about the size of a tennis court and holds several races throughout the year. Michelle took Nicholas down to the track last week; his first time on a real course. He said that it was the best day ever! How great is it to hear your kid say that? As you can see from the video, the track has lots of tight turns and jumps. There is more to it than just putting the hammer down! He learned how to control his truck in the air, it is actually pretty cool. Some of those cars/trucks go about 10 or 15 feet up in the air, they are really moving! He told me that when you are in the air and your truck’s nose is straight down, hit the gas to make it even out. If the nose is straight up, hit the brake. He even learned how to take off the engine; maybe I can have him work on my Chevelle next!

A couple weeks ago, we took him down to the track to see a race. I was amazed at the money, this was definitely not a sport for kids! There were more than 50 people there and most of them there were pulling enclosed trailers behind their trucks. There was even a huge RV there, I have no idea where they drove in from! Each enclosed trailer was basically a mobile “pit area”; they all had generators, air compressors, little power washers, and every imaginable tool at their disposal. I thought I was at a NASCAR race, the kids thought it was pretty cool too.

These trucks are not simple little toys, they actually require a lot of maintenance and up keep. We tried to get him into the electric versions, which actually cost even more, but he wanted nothing to do with them! He’s a real man, he wants to smell that smoke and hear the engine scream! We also learned that there is another group of enthusiasts out there that have a “car show” club. The shop owner said that he was working on “upgrading” a couple of vehicles, with the owners investing over $3500 (each) in tweaking out their vehicles. I could see dropping that into my Chevelle, but not my kids RC truck!!! But thats just me. I don’t think my wife likes the idea of me dropping that money into the Chevelle either, I think she is thinking sofa…. Funny how that works out!

Michelle shot this video at the track, while she was running out to flip over wrecked cars, so cut her a little slack! FYI, this ScribeFire plug-in is pretty cool, you can search You-Tube and plug your video right into your blog! (Video Removed – bummer)

https://www.beilers.com/wp-content/plugins/sociofluid/images/digg_48.png https://www.beilers.com/wp-content/plugins/sociofluid/images/reddit_48.png https://www.beilers.com/wp-content/plugins/sociofluid/images/dzone_48.png https://www.beilers.com/wp-content/plugins/sociofluid/images/stumbleupon_48.png https://www.beilers.com/wp-content/plugins/sociofluid/images/delicious_48.png https://www.beilers.com/wp-content/plugins/sociofluid/images/blinklist_48.png https://www.beilers.com/wp-content/plugins/sociofluid/images/blogmarks_48.png https://www.beilers.com/wp-content/plugins/sociofluid/images/google_48.png https://www.beilers.com/wp-content/plugins/sociofluid/images/facebook_48.png


Apr 11 2009

Code Reviews – What is the point?

Category: Software DevelopmentPhil @ 11:58 am

I recently did an impromptu survey of some friends and coworkers concerning how they conduct code reviews. The responses I got back were a little surprising and definitely not what I was hoping for. None of the responses were incorrect or wrong, but I was hoping that my vision and theirs would be a little more aligned.

Like many of you, I have been involved in my fair share of code reviews. Unfortunately, most of these quote code reviews are more of a code presentation, rather than an actual review. The presenters typically don’t prepare anything for the reviewers, and if they do, the reviewers never have the time to study or evaluate the material. Once the code has been reviewed, you have the challenge of dealing with the  issues generated by the reviewers: How are the issues being tracked? Is there a discussion or evaluation of each issue? How are the issues being prioritized? When and how will each issue be fixed? Don’t forget about the general coordination and procedural aspects: Who is doing the coordination? What code is being reviewed? Who are the scribes? What is the appropriate tracking or reporting format? This is all part of the traditional code review process, or so I thought!

The most interesting response from my survey was that many people considered my definition of a code review to be rather old school and non productive.  I’m not old school, just getting older and hopefully wiser! Several teams said they used tools like Checkstyle and PMD to verify the code, combined with Agile and Pair Programming techniques; thus minimizing (but not eliminating) the need for an actual code review. Teams that conducted reviews seemed to prefer the Net-Meeting (a shared desktop) approach, over meeting together in a conference room. Net-Meetings can be valuable, but I believe that most people are either surfing or reading emails and generally not paying attention during the meeting. Some teams even fix issues right there in the code review. Personally, I think this is very bad practice and not a good use of everyone’s time. Up to this point in the process, I’m pretty much on board with everyone’s process, but I think there is too much informality and and not enough traceability in the overall process. I don’t want to add more bureaucracy, I actually want to make the process more efficient and effective.

I believe in the “pair programming” principal, but consider “pair designing” much more valuable. Teams could minimally implement (and should) some type of virtual partners to get the benefits of pair programming. I like working on projects where some of the team members monitor all of the check-ins, basically performing continual code reviews throughout the development process.  I realize code reviews can have other potential values, such as cross training, mentoring, and promoting consistency and reuse. However, I don’t believe this is the purpose of a code review; isn’t it really about identifying programming flaws? So the question is, what is the most effective way to find bugs?

Some code reviews focus too much on the fluff. Are the indentations and parenthesis in the right place? Are the classes, properties, and variables named appropriately? Is the code well structured? All important aspects, but really don’t need to be addressed in a code review process. All of these issues should have been identified during construction phase using freely available tools, integrated with the IDE and the Continuous Integration (CI) process. I have been using the Checkstyle and PMD for many years to accomplish this task. They can provide value when the team requires the violations to be fixed. I typically configure the Eclipse plug-ins and CI tool to fail if any violations are encountered. Additionally, the CI tool will continue to run, spamming the contributors until the issues are resolved. I have the same philosophy for failed jUnit tests too, I run a tight ship! When violations or jUnit failures are flagged as warnings, rather than errors, they typically get ignored by the developers and are never addressed. When used correctly, Checkstyle and PMD will encourage and enforce specific coding practices, acting as a virtual coding partner, identifying issues when they are created.  Personally, I think these tools help me write better code; as the code evolves and begins to deviate from the original design, these tools usually pick up on the “band-aids” and allow me to fix/adjust the design before it is too late.  I recently added two more tools to my quality validation toolkit, Findbugs and the Testability Explorer.  There is some functional overlap in these tools, but I still like using all of them as a suite, as they each do their job a little differently. Findbugs is very interesting, it works from the compiled byte code, rather than the source code. Findbugs analyzes your code and its interaction with the other included libraries. It will detect problems such as unclosed resources, synchronization issues, and returning mutable collections. The Testability Explorer is my current favorite, but not as easy to understand as the other tools. I will write about it in another post.

Let’s say that we have we have these tools in place and our code is super clean. Unless projects implemented pair programming and are skipping the code review process, most schedule some type of review at the end of the coding cycle. I think most teams identify a random subset of code and schedule a series of meetings to conduct the reviews.  I say random because the developers pick and choose what files are to be reviewed.  How can we be sure that all of the important changes have been identified? This is where each team charts their own path. Some teams have a code “presentation” session with no pre-meeting preparation what so ever. Other teams email out a source file or URL list for each file to review. On the last code review that I helped coordinate, we sent out FishEye URLs for each file to the reviewers. This was pretty cool, because the URL represented the actual changes, not simply a link to the file. This allowed the reviewer to focus on the changes, rather than the entire file. This is point where I believe the whole processes breaks down, how do you report changes back to the developer and track the resolution? Usually issues and comments are sent back in email format, added to a spreadsheet, and checked into version control. One team actually generated PDF versions of their source code and mailed that out, the reviewers then added annotations to the PDF for their comments; kind of interesting. At our code review meetings, we tried to walk through the email comments and tried to address each one. This worked pretty well for those that actually prepared, but we still had lots of manual follow up work.

What I dislike most about this process is the management of these problems. Wouldn’t it be interesting if each issue had its own mini-workflow and was stored in some kind of relational database. Ideally, some kind of Eclipse plug-in to manage them, not necessarily linking the issue directly to the source code, but giving the developer quick access to the problem and approximate location within the file. The issues could easily be easily categorized by type and severity, and managed by the development team, and ultimately reported to management.  There are numerous commercial tools (SmartBear, Atlassian)  and even open source tools (CodeStriker, Rietveld, Review Board) which will automate much of the review process. These tools are actually very cool. It would be so efficient to review, debate, and resolve each issue in an on-line tool,  looking at the actuals changes; just click on the line where the problem exists and create a new comment (start a workflow). The biggest problem with many of these open source tools is around deployment. Many corporations have rules and processes for bringing in open-source tools.  Most of these tools have tons of required components, just to make them work in the environment. Its not like I can just log on to one of the UNIX servers and do a bunch of apt-gets to install the software. Review Board for example, requires: python-setuptools, memcached, libmemcache-dev, Djblets, Django-Evolution, Django, flup, and Python Imaging Library, plus integration with a database. Oh, guess what… it does not support Sybase or Oracle!  Why can’t these guys just give me WAR file that I can drop into an Tomcat server or better yet, have it integrated with Jetty so I can just fire it up!

Even though I appear to be on my own code review island, I will keep monitoring this tools for one that can easily be integrated into the corporate environment. I just might have to build it myself!

https://www.beilers.com/wp-content/plugins/sociofluid/images/digg_48.png https://www.beilers.com/wp-content/plugins/sociofluid/images/reddit_48.png https://www.beilers.com/wp-content/plugins/sociofluid/images/dzone_48.png https://www.beilers.com/wp-content/plugins/sociofluid/images/stumbleupon_48.png https://www.beilers.com/wp-content/plugins/sociofluid/images/delicious_48.png https://www.beilers.com/wp-content/plugins/sociofluid/images/blinklist_48.png https://www.beilers.com/wp-content/plugins/sociofluid/images/blogmarks_48.png https://www.beilers.com/wp-content/plugins/sociofluid/images/google_48.png https://www.beilers.com/wp-content/plugins/sociofluid/images/facebook_48.png


« Previous PageNext Page »