Tag Archives: Tools

SonarQube Code Quality Platform

As an architect my core responsibility is to look over improving the quality of software delivery. One of the core aspect of keeping the quality is code reviews. I am always inclined and insistent upon offline manual code reviews. But in distributed teams and large settings, it is highly difficult to keep up the pace of development that happens over the week or even day by day. Another aspect of it is on organizational level, the consistency of manual code reviews are difficult to keep up. Also, there is particular focus area for each code review likes of systems components written in different programming languages,performance, maintainability, security, unit testing or design reviews etc. I have seen many mid and small organizations still struggling for later part of institutionalizing delivery quality across the projects or products.

My quest for institutionalizing software quality landed me onto SonarQube (also reffered as “Sonar”) platform. It is open platform to manage code quality. It is developed with JAVA but fairly easy to install and use. It also works in an enviornment where system is made of different components which are written in different prorgamming languages. I have been using SonarQube from last two years and pretty happy with the results of it. It is one of the tool which greatly helps to bring in the much needed change in entire organization or product towards technical quality and engineering.

Without much ado, let’s see how you can get your hands on with SonarQube and help your organization to setup code quality platform. We are going to use SonarQube 5.0.1 version.

SonarQube Installation and Configuration

Pre-requisites

1. Download and install Java JDK 1.7.  Check your operating system version whether it’s 32 bit or 64 bit and select the appropriate package. This is important since based on JDK version, we need to select SonarQube installation package.

Url: http://www.oracle.com/technetwork/java/javase/downloads/java-se-JDK-7-download-432154.html

2. Set JAVA_HOME to c:\ as shown in following snapshot. Make sure, to set it into “User Variables” section as well as in PATH variable under “System Variables”.

Environment Variables

Environment Variables

Please DO NOT FORGET to restart your system after creating/changing/editing or modifying any environment variable entries.

Download following software/libraries

FxCop 10

http://download-codeplex.sec.s-msft.com/Download/Release?ProjectName=fxcopinstaller&DownloadId=821386&FileTime=130407655516000000&Build=20959

StyleCop 4.7.49.0

http://download-codeplex.sec.s-msft.com/Download/Release?ProjectName=stylecop&DownloadId=323236&FileTime=130408175287730000&Build=20959

System Properties Window

System Properties Window

OpenCover 4.5.3522

https://github.com/OpenCover/opencover/releases/download/4.5.3522/opencover.4.5.3522.msi

Please note, while installing OpenCover choose advance option and select to install for “all users”. Set the installation path to C:\Program Files (x86)\OpenCover. With default options openCover installs under c:\users\<your username>\

SonarQube v.5.0.1

http://dist.sonar.codehaus.org/sonarqube-5.0.1.zip

Extract the zip to c:\sonar

Sonar Runner v. 2.4

http://repo1.maven.org/maven2/org/codehaus/sonar/runner/sonar-runner-dist/2.4/sonar-runner-dist-2.4.zip

Extract the zip to c:\sonarrunner.

And create new Environment variable under User variable name as “SONAR_RUNNER_HOME” and set its value to “C:\sonarrunner”

Also, edit path variable under “System Variables” and append value “; C:\sonarrunner\bin;” as shown in following snapshot.

Please DO NOT FORGET to restart your system after creating/changing/editing or modifying any environment variable entries.

Download Sample Project

https://github.com/SonarSource/sonar-examples/archive/master.zip

This has various sample projects for sonar which are good for demo purpose. Extract the zip anywhere and since we are only interested with .net projects, take CSharp folder and copy to C Drive i.e. your project is at “c:\csharp”

To run sonarQube Server

1. Go to “C:\sonar\bin” folder. According to version of your OS, choose appropriate folder. For example, I am running Windows 8.1 64 bit OS so I have chosen “windows-x86-64” folder. If you are working on Windows XP 32 bit edition, choose “windows-x86-32” folder and open it.

2. From Command Prompt Run “StartSonar.bat”. This will keep SonarQube server running. If everything goes smoothly, you will see prompt like

StartSonar.Bat

StartSonar.Bat

If you face any error at this stage, please check whether you have selected correct JDK version (32 bit/64 bit) installation. Also, verify all environment variables are correct or not.

Now, you can visit, http://localhost:9000 and you will be greeted with default SonarQube page. Login there using “admin/admin” credentials. Keep the command line SonarQube process running so as long you want to run the server.

Configuring C# Plugins and mapping Paths

1.Once you login, go to Update Center by navigating to following path. On Top right corner, select Settings->(on left navigation pane) System ->Update Center->Available Plugins

Install the plugins mentioned in following snapshot. You will see install button once, you click on the plugin name. For example, below screenshot come for JAVA.

Mapping Path for SonarQube Rule Engine

Java SonarQube Plugin Installation

SonarDashboard

Sonar Dashboard

2. After Installation, now, we need to set the plugin [Tools like FxCop, StyleCop and OpenCover] local paths. So, navigate to, Settings->General Settings->Select Category C# ->Code Analysis/C#

3. Set “Path to FxCopCmd.exe” to “C:/Program Files (x86)/Microsoft Fxcop 10.0/FxCopCmd.exe” and save the settings.

4. Now, click on Rules menu once you click on Activate in->select the “Sonar Way “Quality profile. If you don’t see any profile in the dropdown, make sure to set the “Sonar Way” profile as default Quality profile under Quality profile tab.

SonarQube QualityProfile

SonarQube Quality Profile

How to Run SonarQube

SonarQube works on concept of server and client. Each project/Solution/Codebase has its client settings file called as “sonar-project.properties” file. It is a convention and best practice to keep this file in the same folder as that of visual studio solution file.

We need to author this “Sonar-project.Properties” file for each visual studio solution.

Running Code Qualtiy Analysis for sample Project

1. Now, from command prompt navigate to “C:\csharp” and execute the command “sonarrunner”

2. This will take few minutes and give you execution Success message at the end. If there are errors, you can rerun the process “Sonarrunner –e” to view the errors.

3. Now, browse to http://localhost:9000/ and select “CSharp Playground” to view the dashboard for sample project. Dashboard should look like as shown below.

Sonar Final Dashboard

Sonar Final Dashboard

Please note that, for this post, I have configured bare metal SonarQube. As you keep analyzing specified codebase again in future, it will also show you comparisons and trends and lot more data than displayed in above diagram. There is great plugin ecosystems that gives you various perspectives on your codebase through SonarQube Plugins. For more interesting statics and demo, you can also visit to http://nemo.sonarqube.org

Things To Do After SonarQube Code Quality Analysis

Please be mindful that SonarQube gives much needed platform for code quality but do not fall into pray of being only number obsessed.

Code Quality is journey towards technical excellence and SonarQube platform or Sonar Code Quality index gives one of the important perspective towards it.

Balsamiq Mockups Review

Nowadays I am doing requirement gathering and analysis for a good project here in Gibraltar.So you can imagine lot of user interactions ,taking interviews of end-users , sometimes shadowing them to their specific work function and lot of questioning etc are going on…at least project started off good and we are heading in correct direction.

For successful execution of project,the team which is going to implement or code,should get understanding of the ideas and concepts and functionality and thus the need of good mock up tool arise. These tools plays a vital role of explaining the ideas and bringing the life to boring documentation. It is truly said that “1 picture is equivalent to 1000 words!”.

In my previous projects,I had mostly used visio and its sort of standard at my workplace for mockups.Though recently I had also tried out serena prototype composer for one project.These tools have their advantages and disadvantages.

Visio is the huge software.It is not meant just for prototyping or diagramming.However,it comes at a price and it requires a lot of time to starting off and be expert with it.You can find massive features are poured on as just any other Microsoft stable software.After using visio ,I came to a conclusion that visio is good tool ,but still not a very handy tool for creating mockups quickly.

I explored a bit more on internet and found Serena Prototype composer.Serena prototype composer scores over visio ,when you want a clickable prototype.But then serena prototype composer needs to be installed where you want to run your prototype and seems to be pretty rigid kind of a tool.I didn’t like it much though it has unique advantage of creating clickable prototype.

Then again in search of perfect mockup tool,I downloaded and tried many. One day(actually night),when on the verge of just concluding that there is not so much great tool other than visio,I found the gold “Balsamiq Mockups”!!!

As a practice,Without much hopes,I downloaded and installed it.As a authentic software engineer,I never use manuals or help to use software [In fact,I had reached to conclusion that if you need help or manual for running a software,there is a problem with usability of that software]. Firing up balsamiq tools,I was just kind of landed in my dreams!! Since,it is just made for making mockups!!! Very no not friendly,I will say inviting user interface.there are all UI elements at the tops with really big and wide tool strip which shows of drag and drop user elements some common like buttons,text,all types of containers(i.e. group box,tabs etc) and some uncommon like accordion,cover flow,video player,street maps etc.The most surprising is I found sticky[comments as they call it ] and charts and graphs as well.Wow! pretty genius work.Since,many business software always need this and very few people do have mockups for this stuff.

basamiq-mockups

You can create a new mockup and start building your mockup by dragging and dropping these elements.When you drag and drop the vertical and horizontal guard lines appear to assist you for placing the elements,taking care of alignments which is again cool feature.

You can set properties of individual element by selecting the element and then property bar appears out of nowhere.You can drag it anywhere so that it will not disturb you or obscure the view of element that you are working with.Also The properties are fantastic set,Just as what needed no extras .These things truly live “YAGNI(You aren’t gonna Need It!!) agile principal.

On top of this,the mock up you created can be saved or imported as XML file or can be exported as PNG files.

Balsamiq Mockups team has really come up with really genius product !!

However,there is a saying that greedy man and end-user can never be satisfied  🙂

I must also point out some things that they can improve into their next version.

After using it for two or more weeks ,I realized that grouping and un-grouping of containers and their child elements are somewhat confusing to me.Since,The controls that we drag goes back side of group box and another thing I wanted is the ability selection of many controls like visio gives. As of now,to move entire thing,we have to group them.There must be the selection ability for controls that are not grouped.

The community of Balsamiq Mockups is also good.And they had come up with several templates that you can find at http://www.mockupstogo.net .

All in all,It is insanely great tool built by genius people out their at Balsamiq.I think I can saved at least 40% of time required to create mockups with Basamiq compared to Visio.I will certainly recommend that try your hands on Balsamiq and you will be happy making your mockups ever after.

 

Share this post :

Cost Of Not Upgrading Developer’s Computer

Computers and Servers repairing snapshotMany times, there is situation where people in SMB and startup businesses do not upgrade their computers and perhaps their software tools too. Most of these businesses think that it is pretty ‘OK’ to run things as it is ,for years since either they are running the same things.And upgrading systems would add up to their cost.But they eventually forget the cost of loss of productivity of developers. This added cost would certainly pain for customers as well as it can harm your business severely.

Let me give you an example,If there is some code base of your product, which takes 3 minutes to build and compile and run on normal [read upgraded or having latest hardware and software], and you had a machine with your developer which is taking 7 minutes and project would gone up to 24weeks and developer had generally compiled solution even only 50 times per week then you are losing the productive time of 2 Person-Days. Assume, you had 8 working Hours per day.

Time lost in each Build/compilation = 7-3=4 minutes.

24 cal. Weeks = 24 X 50 X (Time lost in each code compilation) = 120 days.

24 cal. Weeks = 24 X 50 X (4) = 4800 Min/60 =80 Person-Hours= 10 Person Days].

So for 6 Calendar Months of work the organization is losing 10 Person days per developer.

Doesn’t that is good eye opener for managers? I think that is quite a lot valuable time and that it is wasted just because you had not upgraded your hardware or software system.

Sometimes, many of us forget that we are using computers just because those damn good and fast machines can do tasks faster than human can think of.

Share this post :

Tools for MicroISV organizations

Following are the tools that can be used for a start ups or Micro ISV.Note that all are free of cost.

Process                                        Tool URL/Name

Project Management                DotProject ,NetOffice

E-Learning                                 Claroline
*Wiki                                           TiddlyWiki
Desktop Stickies                         http://www.zhornsoftware.co.uk/