Take the 2-minute tour ×

A long time ago, my college professor defined a term which meant the number of source lines between a variable definition and its usage.

The lesson basically argued that the closer the two values are, the easier it will be to maintain over the long run.

My Google-Fu has been weak.

What is the term that describes this relationship?

share|improve this question
Variable definition to first use ratio? –  alex Feb 21 '10 at 23:11
When you find out, tell me. I didn't know we needed a term for this. Maybe your professor needs to find better things to do with his time. –  John Saunders Feb 21 '10 at 23:11
You can call it n for now ;) Seriously though, if there's a word for this I would like to know it. –  Sampson Feb 21 '10 at 23:12
Interesting concept. Typically I declare a variable at the time of usage. –  Chuck Conway Feb 21 '10 at 23:29

2 Answers 2

up vote 2 down vote accepted

I came across this concept for the first time whilst reading Code Complete 2.

I think the term you're looking for is 'span' in that book, which is explicitly the number of lines between references to a variable. In my interpretation, a variable declared and used on consecutive lines would have a span of 0.

The concept is reusable for other references to the variable too to give a wider measure of maintainability - the span between declaration and first use may be 0, but if the variable is then used again 100 lines later that's still pretty nasty.

share|improve this answer
All of these things are related, but not what OP is asking for –  BlueRaja - Danny Pflughoeft Feb 21 '10 at 23:22
modified to improve the focus, cheers –  Brabster Feb 21 '10 at 23:40
Yep, page 305. Thank you Brabster –  EvilTeach Feb 22 '10 at 14:09
@brabster Do you play othello? –  EvilTeach Mar 16 '10 at 21:11
Never played it - why? –  Brabster Mar 16 '10 at 21:27

Found on this page http://www.ppig.org/papers/11th-douce.pdf , on page 6 of the document it talks about Object Relation Measure, or ORM, and gives the definition and way to calculate it. I think this is what you might be looking for.

is it Code spatial complexity ?

share|improve this answer

Your Answer


