Friday, May 8, 2009

Continuous Integration Lessons Learned

I got a lot of interested from my most recent post about The Ultimate Enterprise Java Build Solutions and it motivated me to find one of my favorite blog posts I posted somewhere else originally back in December 2004. I found some of my lessons still relevant so since I could only find it on the wayback at http://web.archive.org/web/20050528062417/blogs.apress.com/authors.php?author=Christopher+Judd. So, I thought I would repost portions of it.

During the process of using CC, I learned the following valuable lessons I wanted to share.

First, once every 24 hours is not frequent enough for continuous integration. As mentioned above, I use to set up CI environments to build once every 24 hours. When I initially set up CI, I was asked to set the builds to run every 4 to 6 hours. There were skeptics who believed any more frequent builds triggered by repository activity would interfere with a team so new to CI and cause unnecessary anxiety. However, every 4 to 6 hours was a problem when trying to set up and configure CI initially so I set the CI to check the repository every minute and if something changed to wait for 5 minutes of inactivity before starting the build. Fortunately, I forgot to change it to a less frequent iteration and the minute check made into the final configuration. We discovered that the short frequencies actually provided the best results by giving everybody comfort since they got immediate feedback. Plus without a frequent build, one bad build could cause the red lava lamp to be lit all day.

Second, there are multiple audiences for the builds so there is a need for a continuous integration build and a nightly build. The audience of a continuous build should be the developers themselves. Developers need quick feedback to provide confidence. They need to know what they checked in to the repository works outside their development environment and what they check out of the repository works. So, this build should focus on code compiling, passing the unit tests and being able to be packages and possibly deployed. The second audience is management and architects. Managers are often trying to collect metrics from frameworks like NCSS and JUnit (number of unit tests). Architects are often interested in code quality reports such as PMD and unit test code coverage. These types of reports take longer to produce and don’t need to run continuously. A separate build that runs at midnight is perfect for executing metric and code quality reports. Of course developers should be able to run these reports at any point in time in their development environments since the same build scripts should be used by both the developers and CI environment.

Third, a CI web site like the one already in Hudson and provided by Sonar is a very valuable communication tool. While developers need to be notified immediately of build problems via email, IM or lava lamps, other such as managers do not. A website can provide the information they need at their convenience.

Forth, lava lamps are a fun way to provide a visual indicator of the build. I initially thought the idea was rather hokey but I was wrong. If you want to learn how to integrate lava lamps with CruiseControl check out Mike Clark's Pragmatic Automation web site (http://www.pragmaticautomation.com/cgi-bin/pragauto.cgi/Monitor/Devices/BubbleBubbleBuildsInTrouble.rdoc).

Tuesday, May 5, 2009

The Ultimate Enterprise Java Build Solution

Early in my career I took on the role of setting up and operating the build infrastructure of many of the projects I have consulted on. I started in this role before Apache Ant released its 1.0 version. I have struggled with using Cruise Control as my continuous integration server including lava lamps for broken builds. Finally, I have also used and configured just about every code quality tool for Java and built a dashboard to try to combind all the results.

Now after all these years, I think I found the right solutions for Enterprise Java Builds. The solution involves 5 open source projects: Maven, Subversion, Hudson, Nexus, Sonar.

At the core of the solutions is Apache Maven, a build, project, dependency management framework. Maven makes it easy to declaratively describe a project or collection of projects that generate artifacts like binary jars, source jars, doc jars, dependency lists and other artifacts. All these artifacts can be versioned to ensure all developers are using the right artifacts. These artifacts can also be published to a Maven repository making distribution of the artifacts seamless.

In order for developers to collectively own code and integrate often, a source code repository is necessary. Subversion has been a proven enterprise scale repository which integrates well with may tools like Eclipse, Hudson and Maven. But there are many other quality source code repositories that could fit in Subversion's place such as Git. The exact source code repository for this solutions is not as important as having one and having one that integrates well with the choosen tools.

One of the biggest challenges in developing software with a team of people is integrating the software so the practice of continiously integrating has become a staple in many enterprises. After every developer check-in, a continious integration server will check the code out, compile and run all the unit tests. Hudson is possibly the easiest and most powerful continious integration server available for Java. It has a very simple web console that makes creating and configuring build jobs a cinch especially Maven jobs. Just incase that is not enough, it has a very nice plug-in system and community making it very flexible and robust.

After Hudson builds artifacts (jars) that developers need it must publish them to a Maven repository hosted within the enterprise. Nexus is that Maven repository. It enables you to publish both release and snapshot artifacts, provides different views into the respository and includes searching for artifacts even their contents. In addition, it can act as a proxy to external public Maven repository providing traceablity into where artifacts came from as well as improve download performance. Both developers and Hudson can use Nexus to keep their local artifacts up to date providing continious integration for everybody all the time.

Finally, it is valuable to keep metrics about code quality. This can help show if code is improving or declining. This can help easily identify problems, risky areas and bad pratices. Sonar is a server that provides a dashboard into your code quality. It integrates with many common code quality tools like PMD, Checkstyle and FindBugs. It include metrics for code coverage, unit testing and lines of code. The trending capabilities make it easy to identify patterns.

Wednesday, April 8, 2009

Startup Weekend Columbus 2 (SWCII) Experience

I can’t believe it is the Wednesday night after SWCII already. I am still riding on the high of the weekend. Not only did I get to start a new company this and meet some new friends I also got to geek out too by writing an iPhone application.

Ok, let me start back at the beginning. Friday, April 3, 2009 about 130-140 people meet at TechColumbus to pitch ideas for companies and products. There were 73 or so pitches. They ranged from the absurd to the brilliant. Then we voted on which ideas we liked the most. After the cream of ideas rose to the top we formed groups around our favorite ideas.

I feel blessed that at the end of the evening I had a great team of six very talented developers and business men excited about implementing one of my two pitches. I have been thinking about this idea for over two years and this weekend gave me the kick in the pants and the team I need to make it real.

The team itself is very tech heavy and age light. The three senior members of the team were:

Dave Lucas - President/Consultant at Lucas Software Engineering
Josh Brown - Senior Consultant at Sogeti
Harish Raju - Software Development Manager at HP

The team also included three very multi talented and tireless college students that provided major contributions. All three of them would make great interns or employees so if you are looking for some check them out. I want to see this type of talent stay in the Central Ohio market.

Ben Gilbert - Computer Science and Engineering/Entrepreneurship student at OSU
Andrew Kane - Computer Science and Engineering Student at OSU
Matt Hill - Economics at OSU

I did not get any sleep on Friday night because I had so many ideas racing through my mind and I was so excited to get started.

Saturday and half of Sunday, we spent building a functional prototype which included an iPhone application and website. We also spent time putting together a business plan and presentation for the final program. During our software and business development efforts we used an agile process called Scrum. We conducted 2 hour iterations and performed a stand up (meeting where you literally stand up to encourage a short meeting in which you answer the three questions of what have you done since the last meeting, what do you plan to accomplish before the next meeting and do you have any road blocks) after each one. We all felt this made us feel extremely productive and increase our communications. It also encouraged accountability and helped us to tack concerns very early before they become problems. We also found Google docs and Google Groups very helpful. With such short timelines, Google docs gave a way of sharing and even simultaneously make changes to spreadsheet, word processing and presentation documents. Google Groups enabled to send communications out to the whole group at one time making sharing information quick and easy.

We were also glad we set up subversion repository before we started doing any development. This gave us a convenient way of sharing code and managing the rapid development.

I also got to evangelize and make some converts to some of my favorite technologies, Groovy and Grails. While most of the team had not had the opportunity to work with these technologies before, they picked it up extremely quickly which was great since I was pretty much heads down in iPhone development. I think that is a huge testament to Groovy and Grails. I really don’t think we could have put something together in a weekend using standard Java technologies since just downloading all the projects and getting them configured would have taken an immense amount of the valuable time we had.

Finally, we found the book Presentationzen Book an invaluable tool for putting together a compelling presentation.

The whole weekend TechColumbus and the sponsors provided a great facility and kept us well fed (when we actually tore ourselves a way from our work to eat) and caffeined which helped provide the perfect condition for productivity.

You maybe wondering by now what our company is. Well, I am going to keep you in suspense a little longer. We are hoping to have a beta start within two months. I will post more when that happens.

Thursday, March 19, 2009

3D Modeling Class

I love learning new things and 3D animations. So, I combined these passions this winter by taking a 3D modeling class at Columbus State. It was very different than what I do on a daily bases with computers and quite a challenge. I had tried learning 3D modeling on my own with the open source Blender tool but never got the hang of it. So I thought I would see if a structured class would provide be a better learning environment for me and I think it did. I have come a long way in a short period of time. I think I understand the concepts and terms now and I can create a pretty convincing model. However, there is still much more to learn. I hope to continue 3D modeling as a hobby and I hope I have time to take the advanced modeling and the animation classes next winter.

Our project was to model, texture and light a room and render 4 still images of it, 2 up close and 2 from a distance. I chose my son's room so I could make 3D toys. I also add a little bit of a Star Wars theme which he loved. Below is my final project.

Tuesday, March 10, 2009

Groovy and Grails Overview Slides updated

Over the past year, I have been presenting a free 1 1/2 hour Groovy and Grails Overviews to any group or company who will listen. Each presentation includes a copy of my book Beginning Groovy and Grails for the organizer. This presentation has been so popular, I have forgotten how many times I have presented it.

In preparation for presenting it two more times this week, I updated my slides to reflect the new releases of Groovy 1.6 and Grails 1.1. I also had to update the resources since so many great new books are also available. You can find copies of the slides here.

Groovy and Grails at Cleveland User Group

I will be speaking about Groovy and Grails at tomorrow night's Cleveland Ohio Java Users Group. If you are in the area please come on out.

Thursday, February 26, 2009

Chmod iPhone Application

I am excited to announce my first iPhone app is now available in the Apple App Store. The apps name is Chmod and it can be used to help determine the appropriate Mac OS X, Linux and Unix file and directory permissions. Check it out, it's free.

AWS EC2 Hibernate Java SDK v2 Example

I recently wanted to automate the creation of developer VMs in AWS using EC2 instances. To improve the developer experience (DX), I didn...