The Code Whisperer

Practical, on the ground advice for efficient software development

Archive for the ‘Techniques’


Interesting Postings

I was in London all day yesterday and today has been spent trying to get a software release together and an odd error in Installshield is preventing this.

My usual buffer of postings has been exhausted, so today I’m going to post links to some other blog entries.

If, like me, you don’t like fingerprints over your screen, you will agree with Jeff Attword in his post on the subject. A bit extreme, but I know where he is coming from! www.codinghorror.com/blog/archives/001115.html

The second is from Steve McConnell. He’s carried out a survey on the classic mistakes presented in his Rapid Development book, which are the basis of the current series on this blog. The survey can be seen here: Classic Mistake Survey

Steve has also updated the Classic Mistakes list recently and we will cover this once we’re past the first 36. The 7 new mistakes are list on this post: Classic Mistakes Updated

36 Common Software Development Mistakes

I’m a big fan of Steve McConnell’s Rapid Development book. Although the title suggests that it covers a new trendy method of software development, in reality it provides plenty of tips and suggestions for any method of development. In the book Steve lists 36 classic mistakes made during software development that will adversely affect the delivery of the project. Often these mistakes are made in an attempt to reduce timescale or bring back the delivery date, but they make matters worse.

I’ve picked from Steve’s list and my own to produce the 36 Common Software Development Mistakes:

People

  1. Undermined motivation
  2. Weak personnel
  3. Uncontrolled problem employees
  4. Heroics
  5. Adding people to a project
  6. Poor office environment
  7. Relationship between developers and “customers”
  8. Unrealistic expectations
  9. Lack of project sponsorship and buy in
  10. Lack of user input
  11. Politics over substance
  12. Wishful thinking and blind optimism

Process

  1. Over optimistic schedules
  2. Insufficient risk management
  3. Third-party failure
  4. Planning failures
  5. Wasted time during the “fuzzy” front end
  6. Skipped or inadequate requirements and design
  7. Inadequate testing
  8. Insufficient management controls
  9. Missing tasks from estimates
  10. Catch-up later
  11. Code like hell programming
  12. Insufficient coding standards and development process documentation
  13. Insufficient code reviews
  14. No defect tracking tool

Product

  1. Requirements gold-plating
  2. Feature creep
  3. Developer gold-plating
  4. Push-me, pull-me negotiation
  5. Bleeding edge development

Technology

  1. Silver-bullet syndrome
  2. Overanticipated savings from new tools
  3. Switching tool mid project
  4. Lack of source control
  5. Lack of automated build process and tool

Over the coming weeks I’ll be looking at each of these in detail.

Writing a Procedures Manual

A few years ago, and much to my wife’s horror, I took a book called The E-Myth Revisited by Michael E. Gerber with me as holiday reading. In this book E stands for Entrepreneur rather than Electronic, and through examples it demonstrates the value in having business processes documented. The idea is that as the fledgling company grows, you can employ staff who are smart and can get things done, point them at the procedures manual and they should be able to get on with the job with a minimum of time consuming supervision, something the growing business doesn’t have a lot of. This frees the business owner from doing jobs in the business he or she shouldn’t be doing and lets them get on with working on the business. Part of the reason that some of the fast food franchises are just about identical the world over is because each franchisee has an operation manual explaining exactly how to run the business. It is one of the best business books I’ve read.

Unwittingly I’ve been producing procedure manuals in various forms for years. When I was rallying we had a ring binder with laminated instruction sheets for various jobs on the car. If we needed to swap parts or make adjustments during service time we had detailed instructions on how to do it, so that the work was completed in the shortest possible time.

A Paul Gorman seminar I went to in 2006 had a guest speaker from a company that hired broadcast quality video camera equipment from their office in London to world locations. Kits were tailored to the needs of the individual hire and sometimes, generally due pressure of time, essential bits of the kit were left out. Fed up with checking each kit personally, the managing director instigated complete documentation of the company’s processes and added checks at various stages of despatch to at least reduce the number of mistakes being made. Once this had been completed ownership of the process documentation passed to the individuals involved in that part of the company. If they could improve the process they did, and documented it. The quality perceived by their customers soared - the equipment was identical, simply the correct equipment was being delivered. The company ran smoothly and when a kit sent out failed, a task normally handled by the managing director who was away, the staff member simply located the process documentation, followed it and the crisis was over by the time the managing director appeared in the office.

I highly recommend reading Michael Gerber’s book, even for large companies. It was a real eye-opener for me and now we document every process Operations Support does. Our documentation is simple and effective, a well indexed word processing document with plenty of screen shots and photographs.

If you decide to create a procedures manual, I have a few pointers:

  • The aim of documenting the procedure is so that pretty much anyone could pick up the document and complete the process, so write accordingly. Consider a glossary if jargon or abbreviations are commonplace
  • If possible have someone who isn’t familiar with the process try out the documentation - you’ll soon find out if there are any bits that need further explanation
  • As in out video camera example above, the point of the documentation is that it’s followed. There really is not point having it if it’s not used on a day-to-day basis. Consider having check lists to help verify that the process has been carried out
  • Make sure the procedures are available to all the staff members that need them. Obviously you need to be careful with some areas of the company, for example accounts. Print copies of the procedures and keep them up to date, so that you are not reliant on the computer being available. Laminating is a good idea if there is a chance that the sheets could get mucky, as I did with the rally car book
  • Involve your development team in the documenting process. Make sure they understand they are part of the process and they have a say in it. All you are doing is making it easier to get things done, there’s no performance measurement involved

When Things Go Wrong and Office Space

I’ve just got back from a skiing holiday in Les Houches, near Chamonix in France. We were there last year too and it’s a great, quiet resort for families. If you ever go there check out Le Creposaure opposite the Bellevue lift - very friendly, excellent food and good value for money.

Les Houches, France. Peaceful, beautiful skiing

Les Houches, France. Peaceful, beautiful skiing

The weather was generally good, but we had one afternoon where the cloud came down and left us with a visibility of 15 metres or so. We were quite close to the cable car so took the opportunity for the children to experience skiing in these conditions and also teach them about what to do, i.e. keep sight of the person in front, shout if you lose sight of them or fall. I’ve done a bit of mountain walking so know the basics on keeping safe and share the despair of the mountain rescue teams when they have to risk their own necks to find ill-prepared groups of people who think they are on a Sunday afternoon stroll only to find the weather changes and they need a map to find their car. As nice as the picture is, skiing takes place on a mountain and the same rules apply - weather can and does change very quickly.

Just as we were about to go we discovered a very distraught lady who had become separated from her husband and friend. She had fallen and then couldn’t locate the other two, didn’t know quite where she was or where to get back down. They had one phone and one piste map between then, neither of which was in her possession, although the phone wouldn’t be much use in this situation. I can only imagine the panic her husband was feeling.

So what has this to do with software development? Things go wrong on a mountain as well as in software development. With most outdoor activities there is planning for things going wrong - a life jacket on a dinghy, first aid kit in a walkers rucksack. Participants in these activities often spend a fair bit of time and money organising for unexpected events or mistakes. But we don’t always do this with software development. So today’s blog entry is to plan for things going wrong. Put processes in place that the whole team are aware of to allow quick recovery from the problem, even if it’s “if this happens contact this person on this number”. As you come up against new problems use the Five Whys to get to the root of the problem and address that. And if you go skiing in a group make sure everyone has a mobile phone on them, charged up and turned on. All you need is an old phone with a pay as you go SIM card in it, but double check that it will work abroad.

The bad weather gave me time to watch some old films I haven’t seen in a while, one of which was Office Space. There is an IT connection and for anyone who has worked in a cubicle it rings very true. It also serves as an example on how not to manage, and certainly how not to lead. I cringe every time the cup carrying boss appears at a cubicle and asks “What’s happening?” and, without pause, delivers some form of instruction or comment. Pure horror!

Backing Up

I really hope this is a topic you can ignore, but I’m going to cover it anyway.

In the late 1990’s I was involved in a major project for a prestigious motor manufacturer. Having very good cashflow they weren’t adverse to spending a bit of money, so I was horrified when I found out that the source control server, with 6 months worth of design and development work on it, firstly wasn’t being backed up and secondly wasn’t in the server room but in the development team’s office situated under an air conditioning pipe that had developed a leak.

Let’s have a look at some data loss scenarios and how they could be recovered from, assuming the appropriate backup policy was in place:

Developer checks in the wrong code
Roll back to the previous version in the source control system. No loss of work.

Developer loses or corrupts checked out code
Revert to the previous night’s backup, loses up to one day of work.

Developer machine corrupt
Re-image the developer machine, get the latest source from the source control and restore the previous night’s backup, loses up to one day of work.

Source control server corrupt
Restore the source control from last night’s or later backup. Checked in code since backup may reside on developer’s machines. Worst case scenario is that each developer loses one day of work each, although this is highly unlikely.

Office destroyed
Build new source control server and restore the source control content from the last off site backup. Build new developer’s machines using image of developer’s machine held off site. Get latest source control on to developer’s machines. The amount of work each developer loses depends on how often backups are sent off site, but this could be as little as one day.

This last scenario is drastic but does happen. To be honest if the office has been destroyed there will be other factors to consider, but with the right backup strategy and a trip to the computer retailer you could be up and running really quickly.

With backing up across the Internet now available and very cheap, it’s possible to build a backup strategy that offers maximum protection with the minimum of fuss. Backups are only important to people when things go wrong, so generating them must be as effortless as possible.

Here is our backup strategy:

  • Source control exists on a server in our office. Code is checked in as soon as possible provided it compiles
  • The source control repository are backed up across the Internet to Data Deposit Box. The Data Deposit Box software runs on the server and detects changes to the repository, extracts, compresses and encrypts them, then securely transfers them to their secure data centre where they are stored in encrypted form
  • Source code changes not checked in are backed up at the end of the day to a file server in our office. The developer’s machine has backup software that backs the files across the network and then shuts the machine down. This backup also includes Outlook PST files
  • Other files such as documents and images are held on network file servers never on individual workstations. Documents and selected other files are backed up to the Data Deposit Box servers using the same technique as for the source code repository
  • A disk image of a developers machine has been taken and is kept on a file server
  • Copies of virtual machines are kept on the file server and backed up from developers machines weekly
  • File servers are backed up completely to external hard drives, which are stored off site
  • USB memory sticks are used to hold backups of this blog, software and licence information for developers products and the latest release code for our products. These are backed up to a files server and tend to go everywhere with me
  • Software installation CDs are kept in a fire safe in the office

I believe this is a pretty comprehensive backup strategy and with the use of Internet backup I’m confident that we could be up and running in a different office in a matter of hours if total disaster did strike.

Key Non-technical Aspects of Good Software Development

In this post I’ve thought about some of the non-technical aspects outside of the normal development flow that support good software development. Their adoption doesn’t guarantee a successful software product, but they do help.

  1. Solves a problem the user of the software has, whether it’s maintaining a list of their DVD collection or processing the accounts of an international company.
  2. The user doesn’t have to substantially alter their process to accommodate the software. There is a limit, however. If the process the user is following is substantially flawed then I wouldn’t expect the software to be that flexible. Sometimes for simplicity the software has to impress a process on the user otherwise it offers too much choice - a bit like trying to choose a toothbrush. Any application has to tread this fine line between too much flexibility and being too rigid. I believe as software designers we need to assess that flexibility make a decision and ensure all potential users of the application are aware of this. As a result your application may not appeal to as many people, but those it does will be much happier with it.
  3. The software is designed for real users, not all and sundry so has the features required to perform a task, not what the software designer thinks might possibly be useful.
  4. The software designers and the development team understand and are passionate about the business and process that the software is aimed at. This is really important and is often overlooked. If the designers and developers don’t have knowledge of the business, there is likelihood that the software will miss the real needs of the user, and will offer a raft of functionality that is of little or no use to the vast majority of users of the software. Word processing software is a case in point. Most people want to just type and be able to format what they type. I agree features like mail merge and style sheets are very useful, but why would anyone want software to AutoSummarize a document they have been working on? If the company developing the software are actually users of the applications they produce, they will know what works and what doesn’t and, most importantly, the functionality required to get the job done as efficiently as possible. To help this get the development out of the office and into the environment their software supports. Don’t look at it as a day wasted, it’s a day invested as the experience will substantially boost their knowledge of the business.
  5. Usability studies. There’s only one way to really evaluate software and that’s to watch people use it, either visually or electronically. Don’t rely on what people say they do, rely on what they actually do - it could well be different. Early prototypes, which won’t have the full functionality behind the scenes, are a good way of testing new applications or functionality. If possible use recording software on the computer or a video camera. Using a video camera also allows the user to be interviewed as they go along, crucial if they get stuck as it gives an insight into their thought process. It never ceases to amaze me the different ways people use software to achieve the same result. We released a beta version of Restoration Manager (link) for a cover CD-ROM on Practical Classics magazine. When the software started for the first time, it asked the user to specify some preferences, one of which was date format. This was achieved by a combo box with a handful of different formats to satisfy the European and US markets. However, despite the fact I knew you had to choose a date from the list, and every time I tested this part of the application I did this, the readers of Practical Classics had other ideas and decided to type in a date format, which caused the application to fail, but with a nice message box giving you the option of emailing the failure direct to us. Over the first weekend that the magazine was on sale, hundreds of potential users did just that. Quite frankly I was distraught, the biggest promotion the application would have and it fell at the first fence. We quickly produced an update and set up an autoresponder so anyone reporting the problem would instantly have a solution. On the bright side, however, it did prove the software was being used and we still get the occasional error report from the magazine CD-ROM 2 years after it appeared in the newsagents.

He or She Who Shouts Loudest Isn’t Always Right

I’ve seen this so many times. A design or requirements document is produced for a system and shown to a number of people. And one person doesn’t like it, so they shout loud and long. Often this someone in a senior position and who won’t use the software in any case.

The most damaging case I’ve experienced was in a meeting with a photocopier manufacturer, who wanted to expand their system to handle rental of fax machines and had employed the consultancy I worked for to carry out a feasibility study. Early on in the meeting one of the participants suddenly blurted out “we can’t do this, it’s against the business model” and went into a five minute rant and stormed out. Being slightly worried about the political implications of this event I asked what position the they held in the organisation. It turned out to be the secretary to the sales director and not someone who could determine the future direction of the company.

My point is quite straightforward. When evaluating feedback look at every comment and, initially, ignore the source so that the outwardly passionate comments don’t swap comments made by others, who may be just as passionate, but not so vocal. In the cold light of day you would value the comment of someone that uses the software every day if it conflicts with comments from someone that is a casual user, but pays your wages. In practise this is hard to do, but there is something you can do to make a decision based on quantifiable data: usability studies. A mixed group of users, different systems, a video camera and with websites a product like crazyegg will provide additional analysis. A usability study takes some setting up, for a start there needs to be two user interfaces to test, but it’s better to make a decision now that creates a superior user interface that people will use than have to either have a product that people don’t like (and will be reluctant to use) or have to release a revised UI in a short space of time.

Creating Software Prototypes

It’s often said that people don’t know what they want until they see something, then they realise they don’t want that.

If it’s a software development project then finding this out at user acceptance testing is far too late in the development cycle. Enter the prototype. A survey in Rapid Prototyping and Software Quality: Lessons from Industry by V. Scott Gordon and James M. Bieman carried out in 1991 revealed that prototyping can lead to better designs, better matches with user needs and improved maintainability.

Accordion Hero started as this prototype

Accordion Hero started as this prototype

If you’ve not come across prototypes before, they are a cheap, hacked, dirty (in terms of not worrying about coding standards) and disposable representation of what how the software will look and what it will do. The prototype is not a full working system - it can be a series of screens without any functionality, or can mimic some functionality with hard coded values. For example a list could be populated values, but these would be hard coded not derived from the database.

The First Golden Rule of Prototypes

Don’t use the same code for the real development of the application

Why? It introduces potentially poor quality code into your application. I’ve seen it many times, and six or seven years on, some poor developer new to the company and application is really struggling to understand code simply because it was prototype code and didn’t confirm to the standards. In addition it may be inefficient and just plain ugly and inadvertently may form the standard for the application.

The Second Golden Rule of Prototypes

Don’t make it look too good

Why? People that don’t develop software generally have no idea what goes on behind the scenes to make an application work in the same way I have no idea how a car is manufactured. In the same way I can see a concept car at a motor show and expect to be able to buy it from the dealer the next day, users of a system see screens and expect the application to be up and running in no time at all. The more perfect the prototype looks and behaves, the greater this expectation.

One of the first website I developed was for the local primary school. I took along a design containing a section of text from their prospectus. The aim of the meeting was to agree on a design, but having understandable text diverted their attention away from the layout. Interestingly the school picked up on several grammatical errors in the text and were horrified when the source was revealed.

The Third Golden Rule of Prototypes

Be aware of feature-creep

Feature-creep is the blight of any software development project and can be added by the development team or users. One of the dangers of prototyping is that the users and development team start to think more about the application and the surrounding processes. This can lead to features being added that have little benefit, sometimes at great cost. When additional features are requested look at the cost-benefit of adding the feature - there’s little point in spending four weeks developing a function that saves one person 10 minutes a year, unless there’s a substantial risk if the work carried out in the 10 minutes goes badly wrong!

If I sound negative about prototypes that really isn’t the case. I believe it is a beneficial tool that can lead to a much better application, provided it’s managed correctly and the three golden rules are followed.

Gunning Fog Index for Software Development

Software Development Metrics

In an earlier post we looked at measuring software development and finished by listing metrics suggested by Steve McConnell in Code Complete. Here’s the list again.

  • Lines of code
  • Work hours spent
  • Number of times routine changed
  • Cost
  • Defect location
  • Defect severity
  • Defect originator
  • Number of lines affected by a defect
  • Time to correct a defect
  • Number of attempts to fix a defect
  • New defects resulting from corrected code

Here’s a few examples on how the metrics can be used, assuming that defects are spotted in system testing by the test team and not part of development:

Number of defects / number lines of code (often multiplied by 1,000)
Indication on the quality of the code released to system test. The defect could be due to the interpritation of the requirements or interpritation of the technical design, but this metric can be used to judge the effect of implementing code reviews or a change to the technical design layout or content.

Number of time routine changed
High value may indicate insufficient or changed functional requirements, poor quality technical design or coding. Again this metric can be used to judge the effect of implementing code reviews or a change to the technical design layout or content.

Number of attempts to fix a defect and Time to correct a defect
A high value may indicate insufficient information on the defect, creating of new bugs when fixing (unless this is being recorded in New defects resulting from corrected code) or could simply be a hard defect to correct. These metrics can help measure the impact of changing the information provided by the test team on each defect, although to have a balanced view it’s necessary to know how much more time is spent by the test team in adding the additional information.

Defect location
This is identifying the location in the code of the defect and can be at a high or low level as you want to record, possibly identifying a poor technical specification or interpretation or a complex part of the application.

Defect originator
The important factor with this metric is not to start a witch-hunt for the developer, but determine why if they are producing a high number of defects. It could be they are working on a more complex part of the system, or they require additional training. The good thing is having used the metric to determine the problem, the metric can be used to see if the situation responds to the changes you make.

Be careful comparing metrics across two different projects. There is a golden rule - no metric or combination of metrics can compare projects of different complexity, without clarification. Whilst defects per thousand lines of code could be used to compare two projects, it takes no account of the complexity of either project, hence the need for clarification. Metrics such as lines of code and work hours spent should never be used to compare projects with the slightest difference.

Software Development Metrics

In an earlier post we looked at measuring software development and finished by listing metrics suggested by Steve McConnell in Code Complete. Here’s the list again.

  • Lines of code
  • Work hours spent
  • Number of times routine changed
  • Cost
  • Defect location
  • Defect severity
  • Defect originator
  • Number of lines affected by a defect
  • Time to correct a defect
  • Number of attempts to fix a defect
  • New defects resulting from corrected code

Here’s a few examples on how the metrics can be used, assuming that defects are spotted in system testing by the test team and not part of development:

Metric Combination Possible Measurement & Inference

Be careful comparing metrics across two different projects. There is a golden rule - no metric or combination of metrics can compare projects of different complexity, without clarification. Whilst defects per thousand lines of code could be used to compare two projects, it takes no account of the complexity of either project, hence the need for clarification. Metrics such as lines of code and work hours spent should never be used to compare projects with the slightest difference.