Category Archives: Software Quality

JUnit Tests Code Samples for Testing Exception Scenarios

The article presents an example of unit tests which tests both happy path and exception scenario. Business Requirement User trying to open an account must be validated against the business rules related with users’ registration. Following are different business rules: User must provide a valid email address User must provide his first name User’s age must be 18 and above   Class Design To demonstrate the unit tests with happy and exception scenarios, following classes have been shown below: SignupValidation: Consists of code validating business rules SignupException: Custom exception representing Signup business rules failure EmailValidator (Get the code from this page). SignupValidationTests: Unit tests for testing signup validation code Class …

Continue reading

Posted in Unit Testing. Tagged with .

Unit Tests – An Alternate Functional Requirements Documentation

The article presents a perspective on how unit tests could be written in a way that they could be used as an alternate form of documentation for understanding functional requirements. Many a times, it has been found that developers, primarily rookies, did not have a clarity on how to name unit tests. Thus, many of them have been found to name the unit tests such as testXXX where XXX is name of the method which they wanted to tests. There has been many recommendations on how to name unit tests, some of which are following: Given…When…Then… Check the page by Martin Fowler (http://martinfowler.com/bliki/GivenWhenThen.html) WhenXXX_ExpectYYY Names representing different use case scenarios …

Continue reading

Posted in Unit Testing. Tagged with .

How to Measure Software Development Productivity

The article lists down pages/papers on measuring software development productivity. The Theory of Constraints: A good read on measuring software development productivity Measuring Productivity of Software Development Teams: The paper lists down different techniques/models for measuring software development productivity. CannotMeasureProductivity: Then, there is this article by Martin Fowler which says that it is difficult to measure software development productivity. He points about ineffectiveness of following approaches of measuring developer’s productivity: Lines of codes (LOC) Function points The software development teams working based on Waterfall model or Agile methodologies model tend to measure the developer’s productivity in terms of following variants: Function Points Story Points (size) vs Velocity Following pages present …

Continue reading

Posted in Software Engg, Software Quality. Tagged with .

What’s Needed to Get Your Code Quality Match ISO Standard 25010

The article relates software quality characteristics defined by ISO 25010 standard (SQUARE) with code quality and, recommends on what could be done by the developers to write the code matching the ISO quality standards. SQUARE stands for Software QUAlity Requirements and Evaluation (SQUARE). Please feel free to comment and add further points in any of the sections pertaining to quality characteristics listed later below. As per ISO 25010 (SQUARE) standards, Software quality can be defined, managed and measured in terms of following two broad categories: Quality in Use: Relates to the outcome of human interaction with the software Product Quality: Relates to the static & dynamic properties of the software …

Continue reading

Posted in ISO Standards, Software Quality. Tagged with , , , .

How to Measure Code Maintainability with Sonar

sonar code maintainability

This article talks about 4 different quality parameters found on Sonar dashboard which could help measuring code maintainability. Following are those quality parameters: Unit Test Coverage: Unit Test Coverage depicts code coverage in terms of unit tests written for the classes in the project. Greater test coverage depicts that developers are focusing on writing good unit tests for their code which results in greater test coverage. This also depicts the fact that the code is testable and hence, easier to change as a bad change could lead the unit tests to fail and raise the red flag. And, a code easier to change becomes a code easier to maintain. One …

Continue reading

Posted in Software Quality. Tagged with , .

How to Increase Unit Test Coverage of Legacy Code?

test coverage

The article represents a time-tested approach on how to increase unit test coverage with legacy code. I shall try and answer following relevant questions in order to present the approach on increasing the test coverage of legacy applications (code). What are some of the key challenges? Leadership Buy-in: As soon as you start planning for writing unit tests on legacy applications, you come to realize that it won’t be very effective and smooth without the consideration of code refactoring. The reason being the fact that legacy code in many cases are found to have very high code complexity in terms of cyclomatic complexity and, familiar code smells such long classes, …

Continue reading

Posted in Maintainability, Software Quality, Testing, Unit Testing. Tagged with , .

Top 5 Code Smells Newbies Developers Could Easily Identify & Avoid

code smells

Following is one very popular image which has been used to represent time and again for representing code smells. I am doing it again. Apologies if this one is repeat for some of you. But the image nicely represents how to find if your code really smells. The code smells listed in this article would certainly lead to increase in WTF count 😉 For newbie developers, it has always remained a challenge to write code of great quality from day one. One of the primary concerns they have been found to have is following: What kind of code could be termed as high quality code? There are several characteristics of good …

Continue reading

Posted in Freshers, Software Quality. Tagged with , .

Top 6 Refactoring Patterns to Help You Score 80% in Code Quality

refactoring

This blog lists down top code smells and code refactoring patterns which would help you write good quality code. Top 5 Code Smells Have done several code reviews in past and found following top 5 code smells common across most of these code having code quality issues: Large Class: The classes were found larger enough due to lack of developers’ understanding on one of the primary coding principles which is “Single Responsibility Principle” (SRP). These classes use to get larger due to various methods serving unrelated functionality in the same class. Long Method: The methods have been found longer due to several reasons such as following: Several block of code …

Continue reading

Posted in Code Review, Software Quality. Tagged with .

Top 5 Bad Application Security Practices

bad security practices

We all come across good security practices and make ourselves familiar with them to develop secured code. However, it may also be good idea at times to know about some of the bad security practices such that we, for sure, try and avoid them. [adsenseyu2]   Following are top 5 bad practices you may want to know about: Do NOT interact with un-trusted programs: Make sure that the external programs that your program is invoking for reasons such as data or functionality, must have got reviewed and tested for security compliance. One of the common entry points into secured applications are these unsecured applications and hackers just love them. Hackers, …

Continue reading

Posted in Application Security, Code Review. Tagged with , .

Campus Bytes – New Initiative

college research and revelopment

We are starting on with a new initiative where we would like to review and write about the research & development going on in several engineering colleges across the country (India) and, how they could benefit different IT companies. This would include reviews on white papars published in different journals, college websites, interviews from paper authors, lecturers and professors. In addition, we would like to invite key stakeholders from different IT companies to present their views on these papers and any further research that they would want to fund in one or more areas from within colleges. If you belong to one or more colleges and would like to submit …

Continue reading

Posted in Software Quality. Tagged with .

Attention Developers: Take Care of Your Debts

Clear your technical debts

Hmm.. was the title intriguing enough for you to check out if you as a developer got any debts to clear (such as that represented below :-)? Well, I am talking about what is called as “technical debt” and that is it. 🙂 Believe me, there are high possibilities that most of the developers do have technical debts to clear which they (or someone else) introduce in the system while working on it over a period of time. Lets try and understand what/how/why/whens related with technical debt?   As Fowler writes in his blog, technical Debt is a wonderful metaphor developed by Ward Cunningham to help us think about this …

Continue reading

Posted in Agile Methodology, Software Engg, Software Quality. Tagged with , .

Top 4 Java Static Code Analysis Tools

Static Code Analysis

[adsenseyu2] Before going over some of top static code analysis tools for Java, lets quickly look at why do we need static code analysis in the first place? Following are some of the reasons: Rules compliance: Pre-defined rules can be set as per the coding standard and automated static analysis could be run to figure out rules violation. This does cut down on the manual code review for the related rules. Code quality metrics: The static analysis could be used to measure some of the following based on which software code quality can be measured: Code complexity Unit test coverage Re-usability Duplication Reports: Creates management reports that can be used …

Continue reading

Posted in Software Quality. Tagged with , .

Logging Tips/Best Practices for Newbies

When starting the career of application developer in IT with one or more programming languages, one thing which is kept on back burner and kept for really long is logging. In fact, when I started my career as a programmer, when I realized that I wanted to know about what to log and what not to log, it was almost 4 years or so. This was my involvement in learning nitty-gritties of programming language itself, and not paying enough attention to logging at all. And, when I learnt most of it all, I realized how much value I added to programming by logging appropriate stuff in log files which was …

Continue reading

Posted in Freshers, Maintainability, Software Engg. Tagged with .

Top 3 Most Visited Blogs for Great Software Code Quality

Following are top three most visited blogs this month in relation with software code quality: The rule I followed to become a great developer Refactoring 3000 lines of code Security code review tips for application developers Thanks to my readers for appreciating above blogs. I shall keep it flowing…

Posted in Software Quality. Tagged with , .

If I Woke up as a Test Engineer One Day…

If I, being an application developer, have to spend a day as a tester, following are some of the activities I would do: Analyzing Test Cases: Examine test cases and make sure that the coverage is maximum in terms of including all test scenarios in relation with the use cases. Test Automation: Look for the areas which can be automated and suggest the same to my lead/manager. Digg a little deeper in the code to find bugs which are difficult to find in manual testing. Learn techniques in performance testing as I am very passionate about the same. Learn few tips and techniques in security testing, along with knowledge on …

Continue reading

Posted in Software Engg, Software Quality. Tagged with .

The Rule I Followed to become a Great Developer

DISCLAIMER: The article is in no way an intention of bragging about my development capabilities. The intention is only to emphasize in so many ways on a rule which can surely, in my opinion, help developers improve quite a notch and become a better developer. I would like to reach as many developers as possible with an intention to create a belief in them regarding the principle I spoke. Thanks for reading the blog. Please feel free to share. For several years that I spent in IT industry while working on a different roles and responsibilities such as developer, technology lead and architect, I was looking for that ONE THUMB …

Continue reading

Posted in Software Quality. Tagged with , .