Showing posts with label plugin. Show all posts
Showing posts with label plugin. Show all posts

Saturday, June 4, 2011

5+1 Sonar Plugins you must NOT miss


Sonar, to my humble opinion, is the leading system to help developer teams track,manage and eventually enhance the overall quality of their code and obviously their software products/projects. To be honest, this is not a post to describe either Sonar features or the necessity of a tool for every developer that respect his time and efforts. If you want to read such analysis you can see my related post To Sonar or Not to Sonar. In this article I briefly present 5+1 plugins that every Sonar Installation should have them. I would like to clarify though some exceptions I have made prior to my final choice. I have excluded all plugins that have to do with additional languages and IDE to keep this post as much as objective I can. I have also excluded all commercial plugins for obvious reasons. After that assumptions I have limited my selections to the following categories : 
  • Additional Metrics
  • Governance
  • Integration
  • Visualization / Reporting
Sonar itself comes with a variety of features that cover most of the needs of a software development team. However I consider that the following plugins are essential, especially for those that have adapted or trying to adapt agile practices. To be honest it was very difficult to select only 6 plugins!!

1.Hudson / Jenkins plugin
Although Sonar analysis can be easily triggered from several build tools (maven, ant etc.) I strongly believe that its native integration with the most famous open source CI server makes itself an important part of the continuous integration / deployment practice. The configuration is extremely easy and as proposed the best practice is to trigger Sonar at night builds. Team members can track day by day software quality, automatically, without bothering when a new analysis should run.

2.Jacoco Plugin
Unit Test results, with drill down analysis, line and branch coverage, running and failed tests are features implemented in Sonar core and cover in depth all aspects of unit testing practice. But, as there is always a 'but', what about Integration tests? What if we want to have separated measures about unit and integration tests? Here comes JaCoCo plugin to save our time and money. Although JaCoCo is an alternative to Cobertura (default Sonar coverage tool ), it may be properly configured to display metrics only for Integration Tests. There is a great article that explains in details how we can use it and get the same analysis ( as for Unit Tests ) for Integration Tests.

3.Useless Code Plugin
It may looks similar to the Sonar Core feature named Duplicate Code, but it adds some more metrics, which I think are very useful especially for large or legacy systems. In general it measures how many lines can be removed from your code. It reports what is the number of unused private methods that can be safely removed and the number of unused protected methods exist in the code that can be removed after some more careful code examination. Finally it provides some more details about code duplication informing how duplicate lines are formed (i.e. x blocks of y lines )

4.SIG Maintainability Model Plugin
This plugin, as its name implies is an implementation of the Software Improvement Group(SIG) Maintainability Model. It reports ranking - from -- :(very bad) to ++ (very good) on the following base indicators:Analysability, Changeability, Stability and Testability. The core idea for this ranking is to measure a series of base metrics such as Lines of Code(LOC), Duplications,Unit Tests,Complexity and Unit Size. Each of these metrics is then accounted into some of the mentioned indicators and the final result is representing the overall maintainability of the project. We can see the results of this analysis in a graphical (spider) presentation with all four axes of the model. With a glance a this graph you have a global and detailed at the same time view of how easy is to change and maintain your codebase. For me it is the first index I check every morning and if something is not + or ++ then we definitely have done something wrong ;-)

5.Quality Index Plugin
Have you ever wanted to check a single number (indicator) and understand how healthy is your project? I am sure you have!! Well, the quality Index plugin is exactly what you are looking for. The plugin combines four weighted axes (complexity, coding violations, style violations, test coverage) of quality and produces a ranking between 0 (lowest) and 10(highest). Moreover it calculates a method complexity factor based on the complexity factor mentioned above. Have you ever tried to get a ranking of 10 with this plugin? I think it worths the effort! :-)

6.Technical Debt Plugin
Last, but not least, the plugin that reports about the interest you have to pay as a developer, as a team, as a company. Technical debt is a term invented by Ward Cunningham to remind us that if we don't pay our interest from time to time, then it is for sure that eventually this will make our software unmaintainable and hard to add new features or even find the root cause of defect. The plugin, which has a very powerful configuration, represents technical debt in four dimensions.
  • Debt Ratio : The percentage of current technical debt to the maximum possible technical debt.
  • Cost to reimburse : Cost in your currency to pay all interest and clean up your code
  • Work to reimburse : Same as above measured in man days.
  • Breakdown : Distribution to the following axes: Duplication, Violations, Complexity, Coverage, Documentation and Design
Be sure that you check its measures to avoid find yourself in bad situation like spaghetti code :-)

I am pretty sure that there are plenty of interesting Sonar plugins so please feel free to post your comments with your list of them.




Friday, May 6, 2011

My first opensource journey

A few weeks ago, without any particular reason, probably to satisfy my continuous research for new hobbies and interests, I decided to contribute to an open-source project, initially developing a small plugin (module). The truth is that I did not take under consideration what I might encounter during this effort. Now, having completed the first version of the plugin, I feel that I finished a short journey in a different world of software development from that than I knew, and with this post I would like to share my experiences. Before that, however, I believe that it is appropriate to shortly describe what the plugin is about.

For over a year I am using the (in my humble opinion) ultimate tool for software quality which is Sonar. What makes Sonar so perfect and amazing? The infinite possibilities that offers to a software team in order to monitor the quality of a project under development / maintenance in detail. it covers the 7 axes of code quality: Design and Architecture, Duplicate Code, Unit Tests , complexity, potential software defects, Comments, and finally code rules.Integration with other popular systems like Maven as build system, and Jenkins for Continuous Integration practices, definetely increase its capabilities. Of course, to be honest, to benefit from Sonar, it is not enough just to keep track of code quality, but rather to act continuously towards improvement. The plugin, therefore, I developed for the Sonar, provides integration with Google Calendar, which is part of the suite of applications offered free by Google. Whenever Sonar completes the analysis a quality project, the plugin takes action and creates an event in Google Calendar set by the end user.

What did I encounter during my first opensource try?
Firstly I found a very structured and well-organized environment/community that provides tools for rapid development of plugins, control them, test their usage by other developers (SNAPSHOT release) and final publish them to thousands of Sonar users. The developers, are always willing to contribute their knowledge, ideas and comments whether positive or negative. There are rules and procedures, strictly followed by everyone, that define how the code is developed, how the documentation is written, about automated build processes and quality ( eat your Own Food ), even how much spaces should have the pom.xml file that describe the plugin. At almost every step there were a sonar core developer who was correcting me (thank you Evgeny!) and was giving extrelemely valuable feedback. I confess that after fifteen years of experience (?) In software development I felt like a student who developed my first Hello World example! Even how and when a plugin is ready for release is determined by a voting process among active developers/contributors of the project. All so different from what I was used or learned so far and so exciting for someone who wants to work within a standardized environment.


What have I learned - How have I expanded my technical knowledge?
I extended my knowledge around Maven. I learned new features in practice and how they serve specific purposes during the development of a (sub) system.
I studied a working example of a modular system without the cumbersome use of other technologies like OSGI. Besides, I used it to develope, test and release the plugin!!
I discovered the new google-api-client and more specifically the part that needs to process data in google calendar. A completely different API, and an approach that only ... Google could ever follow!
Finally I participated in a community of developers with different skills and knowledge, but they all respect each other and exchange ideas and comments without hesitation and intolerance.


My feelings
Initially, enthusiasm, which was then replaced by deep speculation until I managed to understand both systems and their API (Sonar/Google Calendar). With the completion of a beta release I started receiving feedback. That was a grear disappointment but make me try even harder for the final result. New efforts for better quality , always attached to the prescribed rules and procedures.Finally the first version is ready. It is approved by developers community and to be honest I feel as proud as I felt when I was finishing some lab exercises back in the mid-90s ? 
For one thing I am absolutely sure ... The open source software community of Sonar won one more supporter and as my free time permits I will continue to contrinute to it!

P.S. More Info about the plugin can be found at http://docs.codehaus.org/x/KAB-D 

Thursday, May 5, 2011

My first opensource journey - Greek Version


Πριν από λίγο καιρό, χωρίς να υπάρχει ιδιαίτερος λόγος, μάλλον για να ικανοποιήσω τις ασταμάτητες ανησυχίες μου για νέες ασχολίες και ενδιαφέροντα, αποφάσισα να συνεισφέρω σε ένα open-source project, αναπτύσσοντας αρχικά ένα μικρό plugin (υποσύστημα). Η αλήθεια είναι ότι δεν το πολυ-σκέφτηκα, ούτε ήξερα τι θα συναντούσα στην πορεία. Σήμερα, έχοντας ολοκληρώσει την πρώτη έκδοσή του, νιώθω ότι τελείωσα ένα μικρό ταξίδι, σε έναν διαφορετικό κόσμο ανάπτυξης λογισμικού από αυτόν που ήξερα, και με αυτό το post θέλω να μοιραστώ τις εμπειρίες μου. Πριν από αυτό, ωστόσο, κρίνω σκόπιμο να περιγράψω με λίγα λόγια το ίδιο το plugin.

Εδώ και πάνω από ένα χρόνο χρησιμοποιώ το ( κατά την ταπεινή μου άποψη ) απόλυτο εργαλείο ποιότητας λογισμικού που ακούει στο όνομα Sonar. Τι είναι αυτό που κάνει το Sonar τόσο τέλειο και καταπληκτικό; Μα, οι δυνατότητες που δίνει σε μία ομάδα λογισμικού να παρακολουθεί την ποιότητα ενός project υπό ανάπτυξη/συντήρηση με κάθε λεπτομέρεια. Οι άξονες στους οποιούς κινείται είναι οι εξής 7: Σχεδίαση και Αρχιτεκτονική, Διπλός Κώδικας, Unit Tests, Πολυπλοκότητα, Πιθανές ατέλειες λογισμικού, Σχόλια και τέλος Κανόνες Κωδικά. Η συνεργασία του με άλλα δημοφιλή συστήματα, όπως το Maven ως βuild σύστημα, και το Jenkins για συνεχή ολοκλήρωση, αυξάνουν κατακόρυφα τις δυνατότητές του. Βέβαια, για να είμαστε ειλικρινείς, για να επωφεληθεί μία ομάδα λογισμικού από το Sonar, δεν αρκεί να καταγράφει την ποιότητα του κώδικα, αλλά κυρίως να ενεργεί συνεχώς προς την κατεύθυνση της βελτίωσής της. Το plugin, λοιπόν, που ανέπτυξα για το Sonar, παρέχει ολοκλήρωση (Integration) με το Google Calendar, που αποτελεί μέρος της σουιτάς εφαρμογών που παρέχει δωρεαν η Google. Κάθε φορά που το Sonar ολοκληρώνει την ανάλυση ποιότητας ενός project, τότε το plugin αναλαμβάνει δράση και δημιουργεί ένα event στο Google Calendar που έχει ορίσει ο χειριστής.

Τι συνάντησα λοιπόν από την πρώτη ημέρα που ξεκίνησα την ανάπτυξη μέχρι σήμερα;
Καταρχάς βρήκα ένα πολύ οργανωμένο περιβάλλον/κοινότητα το οποίο παρέχει εργαλεία για τη γρήγορη ανάπτυξη υποσυστημάτων, τον έλεγχο αυτών, τη δοκιμαστική τους χρήση από άλλους developers (SNAPSHOT release) και την οριστική τους διάθεση στους χιλιάδες χρήστες του Sonar. Οι developers, είναι πάντα πρόθυμοι να συνεισφέρουν με τις γνώσεις, τις απόψεις και τα σχόλιά τους είτε αυτά είναι θετικά είτε αρνητικά. Υπάρχουν κανόνες και διαδικασίες που τηρούνται πιστά από όλους. Από το πως θα αναπτύσσεται ο κώδικας, το documentation, οι διαδικασίες αυτοματοποιημένου build και ποιότητας (eat your own food) μέχρι πόσα space πρέπει να έχουν τα XML αρχεία που περιγράφουν το υποσύστημα. Σε κάθε μου βήμα σχεδόν υπήρχε ένας developer που με διόρθωνε. Ομολογώ ότι μετά από δεκαπέντε χρόνια εμπειρίας(;;) στην ανάπτυξη λογισμικού ένιωθα σα φοιτητής που έγραφα το πρώτο μου Hello World παράδειγμα!!! Ακόμα και το πως/πότε ένα plugin θεωρείται έτοιμο για release καθορίζεται από μία διαδικασία ψηφοφορίας ανάμεσα στους ενεργούς developers/contributors του project. Όλα τόσο διαφορετικά από αυτά που είχα συνηθίσει ή μάθει μέχρι τώρα και τόσο συναρπαστικά για κάποιο που θέλει να δουλεύει με οργάνωση και τυποποίηση.


Τι έμαθα - Πως επέκτεινα τις γνώσεις μου τεχνικά;
Έμαθα πως αξιοποιείται το Maven στην ολότητά του. Έμαθα νέα χαρακτηριστικά στην πράξη και πως αυτά εξυπηρετούν συγκεκριμένους σκοπούς κατά τη διάρκεια ανάπτυξης ενός (υπο)συστήματος.
Μελέτησα ένα ζωντανό παράδειγμα modular συστήματος χωρίς τη χρήση άλλων δυσκίνητων τεχνολογιών όπως το OSGI. Άλλωστε το χρησιμοποίησα για να αναπτύξω το plugin!!
Γνώρισα το νέο google-api-client και πιο συγκεκριμένα το κομμάτι που χρειάζεται για την επεξεργασία δεδομένων στο google calendar. Ένα εντελώς διαφορετικό API και μία προσέγγιση που μονο ... η Google θα μπορούσε να έχει!!
Συμμετείχα σε μία κοινότητα από developers με διαφορετικές εξειδικεύσεις και γνώσεις, οι οποίοι όμως όλοι σέβονται ο ένας τον άλλον και ανταλλάσσουν απόψεις χωρίς ενδοιασμούς και μισαλλοδοξία.

Τα συναισθήματά μου
Αρχικά ενθουσιασμός, στη συνέχεια προβληματισμός μέχρι να καταλάβω τα δύο συστήματα και τα API τους (Sonar/Google Calendar). Με την ολοκλήρωση μιας πρώτης έκδοσης, άρχισαν οι παρατηρήσεις. Απογοήτευση αλλά συνάμα μεγαλύτερη επιμονή για το τελικό αποτέλεσμα. Νέες προσπάθειες για ποιοτικότερη εργασία, προσαρμοσμένη στους προβλεπόμενους κανόνες και διαδικασίες. Η πρώτη έκδοση είναι έτοιμη. Άγχος για τη ψηφοφορία. Θα εγκριθεί το plugin από την κοινότητα ή όχι. Θα μπορέσω να νιώσω τόσο υπερήφανος ξανά όσο όταν ολκλήρωνα τις ασκήσεις στα εργαστήρια της σχολής; Ακόμα δε ξέρω... σε λίγες ημέρες όμως θα το γνωρίζω ... 

Για ένα όμως είμαι σίγουρος... το open source λογισμικό κέρδισε ακόμα έναν υποστηρικτή και όσο μου το επιτρέπει ο ελεύθερος χρόνος μου θα συνεχίζω να ασχολούμαι ενεργά!!