The notion of abstraction is extremely important for writing good programs or designing good systems. Basically, the idea is that you want to avoid getting hung up on the details: you want to separate the things that change from those that
In Excel spreadsheets the easiest example of abstraction is the use of names. You can define a name to refer to a particular range: for example, you could define
VATrate to refer to cell
D3 on sheet
TaxCalcs. By using a name for this, you have abstracted away two levels of detail:
- The actual VAT rate to use; instead you use the value in cell
- The actual cell that contains the value; instead you use the name
Using abstraction usually has advantages for maintainability, and we can see several of them in this example.
- A formula that reads
=B26*(1+VATrate)is much easier to understand than either
- If you want to change the rate of VAT that you are assuming, it is much easier to change the value of a single cell than it is to go through all the formulae in the workbook looking for places where 17.5% is used, and changing them all individually.
- If you want to change the layout of your sheet, it is much easier to change the definition of the name
VATratethan it is to change all references to cell
D3, or to make sure that you drag and drop the cell or cut and paste it in such as way as to preserve all the references.
There are other ways of making use of the advantages of abstraction, but the use of names is the most common in Excel.