Functional design |
Functional design is a design pattern (computer science) used to simplify the design of computer Software. A functional design assures that each modular part of a computer program has only one responsibility and performs that responsibility with the minimum of side-effects on other parts.
=Advantages=
Systems with functionally-designed parts are easier to modify, because each part does only what it claims to do. Since program maintenance is more than 3/4 of a successful system s life, this feature is a crucial advantage. This also makes the system easier to understand and document, which also simplifies training. The result is that the practical lifetime of a functional system is longer.
The advantage for implementation is that if a software module has a single purpose, it will be simpler, and therefore easier and less-expensive to design and implement.
In a system of programs, a functional module will be easier to reuse because it is less likely to have side-effects that appear in other parts of the system.
=Technique=
The standard way to assure functional design is to review the description of a module. If the description includes conjunctions such as and or or , then the design has more than one responsibility, and is therefore likely to have side-effects. The responsibilities need to be divided into several modules in order to achieve a functional design.
=Similar patterns=
Low-Coupling / High-Cohesion pattern is a related pattern. Functionally designed modules tend to have low coupling.
=Critiques and limits=
Every computer system has parts that cannot be functionally pure, because they exist to distribute CPU cycles or other resources to different modules. For example, most systems have an initialization section that starts up the modules. Other well-known examples are the interrupt vector table, and the main loop.
Some functions inherently have mixed semantics. For example, a function move the car from the garage inherently has a side-effect of changing the car position. In some cases, the mixed semantics can extend over a large topological tree or graph of related concepts. In these unusual cases, functional design is not recommended by some authorities. Instead, try polymorphism (computer science) and inheritance (computer science)|
|