Our understanding of something depends on our ability to form a mental representation, which serves as a working model.
The concept of a thing being understood is termed the target system and its mental representation is termed a mental model.
The completeness and accuracy of a model depends on the users information and experience.
The content and formation of a mental model hinges on cognitive structures – the way in which knowledge is stored in human memory – and cognitive processes – how the knowledge is manipulated during the formation and use of mental models.
Mental models are formed after observation, inference and interaction with the target system and they change constantly as more information is acquired.
A number of descriptive models about how programmers go about understanding programs have been proposed, mainly based on observation.
Top-down Comprehension
The basis of this model is that the understander starts by comprehending the top level detail of the program and gradually works down to low level details.
The structure of knowledge is viewed as being organised into distinct domains linking the problem and program domains.
Program comprehension involves reconstructing knowledge about domains and the relationships between them.
Beacons
Brooks investigates a more problematic driven approach to the maintenance task.
In his model, the comprehension process is an iterative process of hypothesis verification and modification where existing knowledge provides expectations to derive the initial hypothesis. He calls these hypothesis forming expectations beacons.
Beacons can also be considered as tangible aspects of the program which aid the maintainers orientation throughout the program.
Internal program beacons consist of:
- comments including data and variable dictionaries
- variable, structure, procedure and label names
- declarations or data devisions
- interline comments
- indentation or pretty printing
- subroutine or module structure
- I/O formats, headers and device assignments
External program beacons consist of:
- users’ manual
- program logic manuals
- flowcharts
- cross reference listing
- published description of algorithms or techniques
Bottom-up Comprehension
Bottom-up comprehension involves the programmer successfully recognising patterns in the program. These patterns are interactively grouped into higher level, semantically more meaningful structures.
The process for putting together small units of information into larger units is called chunking. The chunking process is faster for experienced programmers because they recognise the patterns more quickly.
Opportunistic Model
Using this model, the understander makes use of both top-down and bottom-up strategies.
According to this model, comprehension hinges on three key complimentary features:
- knowledge-base – representing the expertise and background knowledge that the maintainer brings to the understanding task
- mental model – the programmer’s current understanding of the target program
- assimilation process – the procedure used to obtain information from various sources such as code and documentation
During maintenance the assimilation process enables the maintainer to obtain information about the system. This information then triggers the invocation of the appropriate plan from the knowledge base to enable a mental model to be formed.
Plans
There are two types of plans:
- the rules of programming discourse – similar to the semantic knowledge of software engineering and will be part of the knowledge base of the maintainer
- program plans – stereotypical action sequences such as a high level functional description of a loop
If plans are well implemented, they can provide the maintainer with a high level of understanding of the program under maintenance.
Over time plans become de-localised, interleaved, merged or nested with other plans and thus their benefits for maintenance can be reduced. This can lead to incorrect assumptions being made about the way a program functions.
Related posts:
- An Introduction to Program Comprehension
- What Not To Do When Maintaining Software Applications
- An Introduction to Reverse Engineering
- Static and Dynamic Program Slicing
- Software Evaluation – Experiments
Bookmarking
-
Stumble | Digg | del.icio.us | RSS

