August 1, 2009
@ 02:59 PM

Reacting to a comment left by Frans Bauma, Ayende recently wrote about “Maintainability”

Maintainable is a value that can only be applied by someone who is familiar with the codebase. If that someone find it hard to work on the codebase, it is hard to maintain. If someone with no knowledge of a codebase find it hard to work with it, tough luck, but that doesn’t say anything about the maintainability of a code base.

I usually agree with what Ayende has to say, but not this time. First I hope that by “someone who is familiar with the codebase” he doesn’t refer to the person that actually wrote the code – since if the person who wrote the code can’t understand what he/she wrote than the code base is doomed anyway.

In the wider-sense “someone who is familiar with the codebase” is just part of the picture – a code base is only maintainable is a reasonably professional developer can get to a point where she is familiar enough with the code to be able to maintain it. This doesn’t imply that the time it takes to be productive with the code base is zero – but the lower the time it takes to get up to speed means the more maintainable is the code.

In any event, for a codebase to be maintainable, it has to show several quality attributes .For the most part I agree withthe definition of Maintainability in ISO 9126:2001 Software Engineering Product Quality*

6.5 Maintainability
The capability of the software product to be modified.  Modifications may include corrections, improvements or adaptation of the software to changes in environment, and in requirements and functional specifications.

  • 6.5.1 Analysability - The capability of the software product to be diagnosed for deficiencies or causes of failures in the software, or for the parts to be modified to be identified.
  • 6.5.2 Changeability - The capability of the software product to enable a specified modification to be implemented.
    NOTE 1 Implementation includes coding, designing and documenting changes.
    NOTE 2 If the software is to be modified by the end user, changeability may affect operability.
  • 6.5.3 Stability - The capability of the software product to avoid unexpected effects from modifications of the software
  • 6.5.4 Testability - The capability of the software product to enable modified software to be validated.
  • 6.5.5 Maintainability compliance -The capability of the software product to adhere to standards or conventions relating to maintainability.

Naturally, being a standard it has the “compliance” thingy which is usually only relevant for large organizations and project but for the most part the different aspects mentioned above are the parts you need to take care of when you want someone besides yourself to make changes to the software.

The view of Maintainability Ayende uses is problematic esp. when we consider that (successful) software will spend most its life in maintenance and not in development (you can read Robert L. Glass’s excellent “Software Maintenance is a Solution, Not a Problem” paper in this regard). Assuming someone maintaining the code will always be familiar with it is expecting the same developer(s) to stay at the same project for as long as the project will live (which is not likely) and/or assuming the project will have a short life (not something I’d want from my projects)

So don’t forget that other people will have to maintain your code and they probably won’t live the code-base as you do or as they say in “Code for the maintainer” in the C2 wiki

“Always code as if the person who ends up maintaining your code is a violent psychopath who knows where you live. “ :)


* ISO 9126 is a multi-part standard for QA. I think ISO9126:2001 is good quick reference for quality attributes ( i.e. something you can look at when you try to elicit quality attributes for an architecture). I, personally think the other parts of the standard are pretty useless but that's another story :)
 
Sunday, August 02, 2009 8:55:13 PM (GMT Standard Time, UTC+00:00)
I think a better term for the aspect of maintainability you are talking about is solubility - the ability for a given codebase to be understood by a developer not familiar with it ( I think I first saw the term on Scott Bellware's blog a while back). Code that is not readily soluble can be easy to maintain once you understand it, but code that is hard to maintain usually has poor solubility as well ( 6.5.1 seems to grasp at this but I do not think it expresses the concept well or completely).

Having looked at the NHibernate codebase before, I have to agree that it is diabolical to understand what is going on at times ( especially anywhere inside the session implementation ), and therefore the codebase exhibits lower solubility than one might expect. However, given the complexity of the concepts involved, is it not fair to expect more than a passing familiarity with the problem domain, and the architectural principles used in the solution, before being able to maintain something so complex?

Monday, August 03, 2009 7:36:02 AM (GMT Standard Time, UTC+00:00)
Neal,
I didn't refer specifically to the NHibernate codebase - I talked about the principle
As I mentioned maintainability is comprised from several aspects and what you call Solubility is one of them.
In order to understand complex system and get up-to-speed it is sometimes required to *gasp* add some documentation that help understand the architectural concepts, main parts of the solution etc.
In any event, I don't think it is fair to look at a code base maintainability level from the perspective of a passer-by. Someone who want to maintain a piece of code need to spend the time getting familiar with it. The question is how much time is needed for a reasonable developer to get there...

Arnon
Sunday, August 09, 2009 11:53:44 AM (GMT Standard Time, UTC+00:00)
Just for clarification, ISO 9126 is being superceded (bit by bit) by the ISO 25000 series. ISO 25010 will be the new quality characteristics model document. I believe it has come out of working group committee status and is now up for initial comments by the ISO membership.
Comments are closed.