Category Archives: Maintainability
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 …
Stay Single and Get Admired for Your Code
You might be wondering on the relationship between staying single, getting admired and coding! And, then, staying single forever 🙂 is something which may not be liked by most of us. So, what is this blog all about? Well, with “single, I am trying to point at “Single Responsibility Principle” and with “stay single”, I am pointing towards writing code based on “single responsibility principle”. Well, as the title of this blog goes, if you keep the “Single” responsibility principle (SRP) in mind while writing your code, there are high chances that you will end up with a great piece of code which will get liked by many including your …
A Quick Way to Identify Code with Low Testability
Following is a quick way to identify code with low testability and hence low maintainability: Take any specific public method of the class Count for number of decision points such as following: – If – For – While – Switch – Inline ifs If the number of decision points in a method is more than 15 or so, it could be taken as indication that it may get difficult to write unit tests covering all possible flows. Thus, the code will have lower testability. The number of decision points in a method is also used to define/measure cyclomatic complexity of the method, or more specifically, McCabe Cyclomatic Complexity. Thus, mathematically …
How to Write Re-usable Code
In my software quality sessions, one of my favorite questions had been “how to write re-usable code”. The most common answer has been following: Once one identified the re-usable components based on the functionality, once can write the components accordingly such that it can be reused. However, this argument required one to identify the reusable components at the design time. The question still remained. How would one write a code that can be termed as re-usable even if the component is not required to be reused at the moment? Another question that I ask is if it is possible to look at the code and say if this is a …
Software Quality Review – Scribe OAuth Library
Scribe OAuth Library helps you do quick OAuth based integration with some of the following web applications: Google Facebook Twitter LinkedIn and many more. You could find further details on following page on github. Following will present information on different perspectives: Structure Maintainability The duplication percentage isn’t very high. Duplication is one of the key criteria that reflects on the maintainability of the code. Higher the duplication, difficult is the code to maintain. Duplication is also considered as one of the code smells. Also, due to unavailability of unit tests in the source code bundle, I could not find the test coverage. Otherwise, test coverage depicts the testability of …
Test-Along Development (TAD): Unit testing technique
While talking to one of the client stakeholder, I came across this interesting term as Test-Along Development. Following are two different techniques I came across as common way of writing unit test: Test-driven development where we write unit tests first and then write enough code to make unit tests pass Write unit tests at the end once you are done with the development. Both of the above techniques presented enough challenges to the software developers. Some of them are following: Test-driven development: In agile development, in 2 week sprints, the design took much longer than 2-3 days. Thus, doing test-driven development was found to lead carry-overs for sprint given on …
They confuse between Module & Component
Ask software developers about what do they mean by a module and a component and, what is the difference between them? Ask them about how would they represent module or a component in their daily development activities? Most of the time the answer is quite confusing. Although they use these two words interchangeably, they remain confused on their actual meanings. Module can be defined as following: Represents a functionality Can be represented as a set of components Can have manifest file representing component configuration One or more modules make an application. Technically, a package can be termed as a module. There is something called as module oriented programming as well. …
Multiple Classes with Single responsibility VS Single Class with Multiple Responsibilities
While taking a session with a set of mobile developers, one of them asked a question that made many of them curious. Why multiple classes when single class can do? The main reasoning for single class was that one would be able to save some lines of code. Also, one would be required to create just one object for multiple functionalities. Lets look at some of the key advantages of multiple classes, each one of them having single functionality. High in cohesion, and hence reduced coupling. This tends to make the class reusable. Lesser costly to change than single class. Following explains the cost structure related with a change: Let’s …
I found it very helpful. However the differences are not too understandable for me