Whatever comes in life, take it on your feet.

  • Sensible Software Development
  • Galleries
    • Architecture
    • Big Cats

Coding standards, and why they are bad.

Posted by Gary McNickle on May 13, 2012
Posted in: Sensible Software Development. 4 comments

 This article is part of a series called Sensible Software Development.  This series is designed to present practical, real-world information on software development.  Each article discusses a topic in simple language with explanations that are easy to apply to your software development lifecycle.

At virtually every development shop I have ever worked in, someone has written up a coding standard which was intended to be applied universally throughout the company.  Some companies will go so far as to write up several, one for each common programming language in use.

In my nearly 15 years as a professional software developer, every attempt I have seen at enforcing consistent style has failed.  The worst of these are those attempts which reject a build or flag it as an error if some style guideline is not followed, as this method hinders productivity far more than it encourages it.

The idea is flawed, and I have come to believe that is has virtually no merit whatsoever.

What it comes down to is this; style means nothing.  Any reasonably qualified programmer should be able to follow code written in any style – as long as the code itself is clearly written.

Now, I do not mean to say that you should not expect a certain level of professionalism from your developers.  Writing clean, easily maintainable code should be a requirement of any good programming shop, but what constitutes clean code has a whole lot more to do with solid design principles than style.

It is far easier to explain why something such as the Single Responsibility Principle[1] is a good idea than it is to try to convince someone that their code is ‘bad’ because they happen to like using tabs and you prefer spaces.

So, if you want to try to improve the overall quality of the code in your shop, focus more on solid design principles than on style.  It has been my experience that improving the design of the code has a far greater impact on its overall quality than naming schemes or spacing requirements ever will.

Following the principles of ‘SOLID’ design will give you a far greater return on your investment.

SOLID (Single Responsibility, Open-Closed, Liskov Substitution, Interface Segregation and Dependency Inversion)

  • Single responsibility principle
    The notion that an object should have only a single responsibility
  • Open/closed principle
    The notion that software entities should be open for extension, but closed for modification.
  • Liskov substitution principle
    The notion that objects in a program should be replaceable with instances of their subtypes without altering the correctness of that program.
  • Interface segregation principle
    The notion that many client specific interfaces are better than one general purpose interface.[2]
  • Dependency inversion principle
    The notion that one should ‘depend on abstractions’, not on concrete implementations.[2]

 

Recommended Reading:

  • Clean Code: A Handbook of Agile Software Craftsmanship. Prentice Hall PTR. 2008.
  • “Design Principles and Design Patterns”, Robert C. Martin, objectmentor.com.

 

[1] Martin, Robert C. (2002). Agile Software Development, Principles, Patterns, and Practices. Prentice Hall.
[2] Martin, Robert C. Design Principles and Design Patterns, objectmentor.com

Is your testing process starting too late?

Posted by Gary McNickle on May 11, 2012
Posted in: Sensible Software Development. Leave a Comment

 This article is part of a series called Sensible Software Development.  This series is designed to present practical, real-world information on software development.  Each article discusses a topic in simple language with explanations that are easy to apply to your software development lifecycle.

The act of developing software is an expensive one, everyone knows that.  When asked, most reasonable project managers and executives in charge of developing software will tell you that quality is important to them,  and most software development teams will employ some form of testing.  Yet, very few companies can tell you how much money their testing effort saves or costs the company.  I believe that the reason for that is two-fold;  first, they really don’t want to think about the ‘cost’ of testing, and second, they either don’t know what metrics to capture to measure the savings, or they have no faith in those metrics.

While I don’t prescribe to the idiom that all metrics are good,  there are a few simple metrics that companies can gather to help them discover the relative costs associated with the quality of their software product.

 

The Relative Cost of Fixing Defects

To begin to calculate the cost associated with finding and fixing defects, you must know at which point during the development cycle those defects are found.  The reason for this is because where a defect is found dramatically impacts the cost associated with fixing it.   To illustrate:

 


IBM Systems Sciences Institute

 

According to available research, a defect found in the development phase (code) costs 6.5x as much to fix as a defect found in the requirements or design phase, and a defect found during testing costs 15x as much.  The exact figures vary by researcher, but according to National Aeronautics and Space Agency (NASA) findings, “problems that are not found until testing are at least 14 times more costly to fix than if the problem was found in the requirements phase.” [1]

One complaint that I often hear from testing teams is that they are not involved in the requirements phase.  In some industries this may be unavoidable, but in others, the solution is often a simple one; inject yourself into the requirements phase completely.  Ask to be invited to the meetings, ask to review the requirements, etc.  Requirements should be scrutinized just as severely as the product itself is.  If you need to convince management of the necessity of your involvement during this phase, then use the material here and elsewhere to show them how finding defects in requirements will save the company money.   Just remember, to speak to management you must speak their language.  Managers love graphs like the one above.  Keep the details at a high level and provide industry references for your data.  Here is one for you;  involvement of testing resources during technical design within iterative development life cycles is appearing in research proposals [2].

Interesting enough, a James Martin study revealed that the root cause of 56% of all defects is errors introduced in the requirements phase, with approximately half of these defects being the result of poorly written, ambiguous, and incorrect requirements. [3]

When you combine this with the common reality that the bulk of testing efforts occurs towards the end of the project, what you end up with is that test efforts are not providing the best return on investment that they could be.

Survey results from the Quality Assurance Institute annual software testing conference. [4]

It should be clear by now that companies who wish to reduce the overall cost of defects should be applying testing efforts earlier in the process.

Earlier I mentioned metrics, while the average cost of a defect found during the requirements stage is $1125, it is not an exact number, and can vary wildly from company to company.  Thankfully though, there is a formula to measure this cost. According to Tom King and Joe Marasco[5]:

It is done in 5 steps:

  1. Estimate the number of screens and reports in your final project.
    If you don’t know this number, you can estimate it based on the visual representation of use cases; just list the functions or activities that each actor performs in each use case, some of these activities will involve displaying screens or running reports, making it easier to count.Multiply this number by four person-weeks (pw)
    development effort = 4pw * (# screens + # reports)
  2. Estimate the number of defects to expect at system test.
    Your defect rate will very depending on your level of quality control in the development process.  If you do not have historical data to base your estimate on, you can use the industry average of 1.0 defect per person-week.
  3. Estimate the number of requirement defects.
    Again, historical data is best here, but lacking any, the industry average is 50% of the total number expected.
  4. Estimate rework cost
    If you do not already measure the percent of rework on development projects through accurate time accounting, then estimate where you stand within the industry average of 20 to 40 percent of the development effort.  If for example, your estimate is 30%, then rework cost = 0.3 * project development cost.
  5. Estimate the amount of rework cost due to requirement errors.
    The Chaos Report [6] and Dean Leffingwell’s Managing Software Requirements [7] indicate that about half of all software defects are due to missing or bad requirements.  However, the cost of finding and fixing requirements defects (because this most often occurs at test or post-release) is higher than other types of defects.  They indicate that 75 to 80 percent of the rework cost is due to requirements defects.rework cost due to requirements defects = 0.75 * rework cost.
  6. Divide the rework cost due to requirements defects by the number of requirements defects.
    cost per requirement defect = rework cost due to requirements defects / # of requirements defects

For Example:

# of screens plus reports = 25
estimated number of total defects = 100
estimated rework cost = 0.3 * $250,000  ($2,500 being average salary + benefits @ 40pw/year, making the project development cost $250,000)  = $75,000
total development cost  + estimated rework cost = $325,000
now estimate the rework cost that will be due to the requirements errors  0.75 * $75,000 = $56,250
and lastly, divide this rework cost by the number of requirements defects to determine the cost per requirement defect  $56,250 / 50 = $1,125

So, what does all of this mean?  Take a look again at the chart showing the relative cost to fix a defect at various stages.  If you are not applying testing practices to your requirements and design phases, then it will cost you $1,125 to find and fix a defect in the testing stage.  Whereas if you had found the defect during the requirements phase itself, it would have only cost you $75.

 

References

[1] Rosenberg, L., Hyatt,L., Hammer, T., Huffman, L. and Wilson, W. (1998) Testing Metrics for Requirement Quality, presented at the Eleventh International Software Quality Week, San Francisco, CA.
[2] Ramachandran, M. (1996) Requirements-Driven Software Test: Process-Oriented Approach, ACM SIGSOFT Software Engineering Notes, Vol. 21, Issue 4, pp. 66 – 70.
[3] Mogyorodi, G. (2003) What is Requirements Based Testing? The Journal of Defense Software Engineering, 12-15.
[4] riceconsulting.com, The Economics of Testing. www.riceconsulting.com
[5] Tom King and Joe Marasco, “What is the Cost of a Requirement Error?” stickyminds.com
[6] The Standish Group, “The Chaos Report”
[7] Leffingwell, Dean and Wildrig, Don. Managing Software Requirements: A Unified Approach. Addison-Wesley Professional, 1999.

The Stratfor Debacle

Posted by Gary McNickle on January 28, 2012
Posted in: Uncategorized. Leave a Comment

I have been an avid fan and member of stratfor.com for many years and I have found their articles and insights to be, if not wholly accurate, far and above the typical nonsense that comes out of mainstream media.  The Stratfor team has consistently put together analysis that have challenged my views and made me think of global events in a much wider sense.  In short, they have given me a new take on what happens in the world, and the role the U.S. plays in it.

After the recent hack of the stratfor website, and subsequent release of member information to the web (mine included), I thought long and hard about continuing my membership.  The guys at Stratfor made some pretty rookie mistakes by not encryping member information and not using a secure third party for their credit card processing, but the bottom line is this – They are a group of intelligent individuals who’s personal and corporate reputations are critical to their success.  I have to believe that they have learned from their mistakes, and reviewing the changes they have made to their website, it seems they have done everything they can do to ensure that a similar incident does not happen again.

Ultimately, the protection of my identity and credit is my responsibility.  Discover was quick to respond to my request for a new credit card and assured me that, even if my leaked data was taken and used, I was protected.  The analysis that I get from Stratfor is too important to me – I will remain a member for as long as they continue to produce such excellent analysis.

 

 

 

Amur Tigers

Posted by Gary McNickle on November 1, 2011
Posted in: Uncategorized. Tagged: photos, tigers. Leave a Comment

The new Tiger Forest exhibit at the Indianapolis Zoo is a big improvement over the old tiger area.  With a large glassed in viewing area that lets you get right up close to the tigers as they are feeding, the exhibit is very popular!

The best time to show up for photos is a few minutes before feeding time (earliest is 10am I believe), but be sure you are early, and claim a good vantage point right away – the crowds tend to sneak up on you and before you know it, you are three of four heads deep from the glass.



Yet another move…

Posted by Gary McNickle on October 31, 2011
Posted in: Uncategorized. Leave a Comment

In preparation for an upcoming move to New Hampshire, I have taken down my servers and moved my domain to another hosting service.  Until I get everything back up, well… this site will be rather dull.  My Apologies.

 

Posts navigation

  • Recent Posts

    • Coding standards, and why they are bad.
    • Is your testing process starting too late?
    • The Stratfor Debacle
    • Amur Tigers
    • Yet another move…
  • Recent Comments

    • Gary McNickle on Coding standards, and why they are bad.
    • wekempf on Coding standards, and why they are bad.
    • Gary McNickle on Coding standards, and why they are bad.
    • wekempf on Coding standards, and why they are bad.
  • Meta

    • Log in
    • Entries RSS
    • Comments RSS
    • WordPress.org
  • Contact Me

    Gary's Contact Information
Proudly powered by WordPress Theme: Parament by Automattic.

Bad Behavior has blocked 57 access attempts in the last 7 days.