Tutorial: Getting started with Netbeans and JUnit plus Cobertura (Part 1)

I believe strongly in testing. I saw companies and products without any automatic test frameworks and the slightest change to the codebase (often in the urgent ‘we-need-to-fix-it-now-and-give-to-the-customer-in-1hr’ mode) made parts of the product or modules prone to crashes because no one could test the changes against the complete application. In my current endevour to create a new product we embrace testing, though we dont practice TDD (test-driven-development), but at least we maximize the amount of automatic testing with tools/frameworks like Netbeans, Hudson, Cobertura and others. If you dont practice TDD, how can you judge how much of your codebase is really tested, even you assume all you business testcases are covered ?

The other day Code Coverage crossed my way (Thanks Chris!). Eager to find out how to “do it” or to “use it” I found a few tools suitable for the Netbeans environment. It actually drilled down to only one tool: Cobertura. It fits exactly into our landscape using Netbeans and Hudson and it is opensource.
To get started with Cobertura you should be familiar (a bit) with Netbeans, JUnit and Ant. The Cobertura website offers sufficient reference for all functions and introduction to get you started. But what I missed is a tutorial the start from the scratch using Netbeans and Cobertura. I found 3 references (I will add them at the end,) which are not complete or just not working for me), so let me share the most basic getting-started steps with you.
Please note: This is how I get started, it might not be complete, foolproof or even correct in all details. Please feel free to comment, correct or give other feedback !

Continue reading

Advertisements

About Waterfall Methodology

In today’s IT world there is lots of talks, discussions and religious wars about Software Implementation Methodology or Strategy. You can read about XP, Rational, Scrum, Agile,.. to name a few but most dominant ones. I am very strong believer in an agile approach, even I know it is a hard way to get it communicated to the customer and digested by them (but I will do everything to come close to it). We all do the Waterfall Approach knowing it is crap. Dr. Winston W. Royce was writing about in 1970 (!) and already mentioned it would not  work for large IT projects. But we are still doing it after almost 40 years ! Carrying the self-fulfilling prophecy in front of us saying “Yes, it is like that. No customer will agree to or understand agile.”

Links:

  • The original concept by Dr. Winston Royce, Managing the Development of Large Software Systems (link)
  • Wikipedia about Waterfall Modell (link)
  • Mitch Lacey, Presentation “When Working Software Is Not Enough: A Story of Project Failure” on InfoQ (link)
  • Scott Ambler, Presentation “Agile in Practice: What Is Actually Going On Out There?” (link)

SCM – Sourcecode Management

In the beginning there was one developer and it was fine. Then someone decided to add a second developer to give the first one companionship and it was chaos.
I think every developer run at least once into the situation that someone else touched the same piece of sourcecode as he and faced the situation to merge the sourcecode. Sometimes possible and easy, sometimes impossible because 2 parties were working on the same module for months (for whatever reason causing this situation!). Lets ignore the organizational reason why more than 1 person does the same thing.

In the first company I ever worked in (15 years ago) we realized this is a problem and solved it manually by a simple homemade tool that locked (write-protect) certain source files on shared drive. Later we bought another 3rd party tool to do this job and finally we moved on to MS Sourcesafe in the late 90’s. It worked very well because we were only 3..5 developer sitting in the same physical location.

The next company I joined did the same, but bought a very expensive piece of SCM which did the same job for a considerable alrge number of developer at different sites. What happened ? The system was not very stable, at least from the moment we had no more fulltime admin, lot of downtimes happened and developer were not able to synch or commit changes. Individuals started to remove the write protection on their local sourcefiles and within of weeks there were numerous branches of sourcecode. And it was chaos.

Finally I decided to start development again and learn from previous mistakes. For SCM you have a selection of commercial and opensource products. To name 3 of them: CVS (link), Subversion (link) and Bazaar (link). You can download them and install them on your server (and potentially run into the trouble of administrating both hardware and software!). I came to the conclusion to buy this is a service from a reliable provider.

You might want to checkout this company (link)

I use their team subversion package. Subversion is integrated into Netbeans (link) and can be used with Windows Explorer with Tortoise as plugin (link).

Reality check on Agile

There are plenty of post-waterfall development and project approaches and methods (Iconix, Agile, XP,..) and some almost religious discussions and controversary are coming along as well. I cant promote a certain methology but I strongly believe todays IT (project, application development) world (both on vendor and customer side) needs to change its attitude towards handling IT projects. I will try to make use of agile concepts in our effort to do development of any kind. A stony way I guess, but let’s try and encompass changes !

Oh, and my advice to all you buzzword loaded managers out there: Agile is not going fix to your rotten, heavily delayed, run-over-budget IT projects ! Read and learn about it before you start boasting with it.

Scott Ambler did an intersting presentation on Agile during the “Agile 2008” conference. See some more info and the video at InfoQ (link).

More:

Manifesto for Agile Software Development
Wikipedia on Agile
Agile Alliance

On virtual conferences

I just highlighted the value of joining real conferences. Besides getting to know more about the topics, it is alway a great opportunity to get in touch with people and grow your network. But sometimes the pricetag can be high or the location is really out of the way. So another good source for joining a conference (in a less interactive manner, not sitting there), is to watch the video transcripts that you find occasionally online. Be aware, there a lots and lots of them and you might spend the whole day watching that stuff.

Todays recommendation: 10 Ways to Screw Up with Scrum and XP by Henrik Kniberg (Agile Conference 2008, Toronto, link)