Sunday, July 11, 2010

Idea: JUnit and Code coverage connection

I'm going to share my first thoughts regarding unit testing, JUnit and TDD (test-driven development). I'm sure that this won't be the last post on this subject because there is a lot that can be said and I've had a few interesting discussions with a colleagues of mine regarding the benefit of TDD and whether it is a good or a bad principle.


Here I'm going to share a thought which seems logic to me, but unfortunately have not seen it implemented yet.
I've been writing some unit tests recently and  it occurred to me that it would be nice if the JUnit was combined with code coverage and after runs of the test suites, there is a statistic that shows which test (test method), which lines of code did they cover!

Imagine if it was possible to see that - when an old test fails, it shows you which particular code it validates, so if a change in that code occurred, you can catch it immediately!

Of course there is the scenario when a change occurred in the context of the process that is tested and not the process itself and the code that could break a certain test, but nevertheless this information won't lie to you and trick you and slow you down in rooting down the real problem.

Also some monitoring of the submits to the project repository and analyzing which code fixes what test , would be the same as which test validates which lines of code.

There could be done something about that!

Some basic tips:

For NetBeans users check this link:

Check official xUnit site or Junit


Saturday, July 10, 2010

Eclipse DemoCamp 2010

Here I'm going to tell every reader what amazed me and what I think is remarkable around Eclipse DemoCamp 2010 Sofia.

First of all I would like to give my special thanks to the organizers who managed to stay in schedule through the whole event - all presentations were exact, question sessions, no power surge problems, comfortable hall and of course top-class food and beverages prepared for the breaks.

I was impressed that the president of the Eclipse Foundation presented its goals and its history and path for the future - very interesting indeed to hear it from the man who has seen it all from the very beginning and gave birth to something that is accepted as a standard in the modern world - open-source foundation which holds and nurtures different projects under the hood of Eclipse.

There were a few presenters whose names I cannot write, because I don't remember them (sorry) but they covered the following areas:
- OSGi bundled application server - Virgo
- Swordfish - framework for bundled enterprise services
- Rational - IBM's CASE non-free very functional software product
- context-depended language generator plug-in for Eclipse

1. Virgo
 I was most impressed by the Virgo application server which is constructed using the ideology of bundled products (like Eclipse IDE) and the ease and plugability at runtime of small software components called bundles. In that way you can turn on/off features at runtime with no downtime and manage dependencies between different components.
Also you can create very light and feature-set specific application servers who can for example support only Servlets (web container) and you don't care about EJBs or Web Services and all you need are simple security and logging for example.

The man presenter was very young Spring (now VMWare) developer who demonstrated the Virgo server
and it started very quickly and redeployed applications with just a click and no waiting or whatever...

Just amazing! - Believe me, you will find it amazing if you have to do an enterprise application and deploying it on a heavy proprietary application server like NetWeaver, whose architecture is just not modern anymore. The bundle concept is unknown to it. Nevertheless still an excellent application server.

Don't forget scalability - using bundles would be much easier to manage dependencies and physical separation and transport.

2. Context-dependant language generator plug-in for Eclipse
There was an amazing demo of a framework which lets you easily define your own language and reserved words for it. After that you can easily create an Eclipse project specific for your new language and even have the editor validate your syntax and semantics!

The presenter Kiril did a great job and capture the audience - he was the winner of the Demo sessions.

3. Rational
The presenter was a guy from Croatia (sorry if I am wrong) and used not 1 but 4 presentation sessions to explain what Rational can and cannot do (actually, I think it can do everything, even prepare you a sandwich...)

So basically Rational is a CASE tool which covers all aspects of software development process:
- requirements engineering
- storing requirements and managing them
- preparing architecture
- design analysis
- bug tracker and connection to various requirements
- track exceptions with real code lines and bugs
- suggest improvements based on an exception
- complex statistics and diagrams which even the presenter was confused to explain
and many more

Believe me, if you know all the features of Rational and can use it productively  you are a GOD.

Unfortunately not everybody in the audience appreciated the presenters attempt to cover high percentage of the products capabilities... His voice wasn't as clear as hoped either...


All in all I am very confident that I will attend the Eclipse Demo Camp next year and who knows - may be I'll present something of my own...