In continuation of my latest post regarding easily maintainable systems, I will start by writing about the benefits of Functional Design.
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. Functionally-designed modules tend to have low coupling as concrete side-effect and more importantly, they scale much better than other types of designs.
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.
Systems with functionally-designed parts are easier to modify because each part does only what it claims to do.
Since maintenance is more than 3/4 of a successful system’s life, this feature is a crucial advantage. It also makes the system easier to understand and document, which simplifies training. The result is that the practical lifetime of a functional system is longer.
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.
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.
To perform Functional Design is quite easy, you can start by defining packages/namespaces based on Use Cases as can be illustrated by the following package definition:
The package above would then contain all the classes which makes up the concrete use case implementation. In the case of a Flex application it would contain at least the Command and Event, but depending of the lines drawn in architecture – possibly the forms and UI objects as well.
This should be seen in contrast to having the Command in a namespace called Commands and the Event in a namespace called Events.
Functional Design has one limitation, and that is that you need an underlying set of baseclasses which implement all your Boilerplate code and thus faciliate that your concrete namespaces dont need to be to highly coupled to other parts of the system on the same level.