Localisation of Functionality

Localisation of Functionality is a principle of software development.


 * Functionality related to data should be implemented with the data.

The principle is designed to achieve the goals


 * Reduce the repetition of code (Dont Repeat Youself).
 * Make it easier to find where functionality is implemented.
 * Reduce the complexity of implementation.

Do It Yourself
There are two primary examples of the Localisation of Functionality principle,


 * An attribute being read or updated to a database.
 * An attribute being diplayed and edited on the screen.

In both cases the attribute is one of many attributes being stored in the database or stored in the screen.

GUI Widget Update
For a widget on the screen the normal flow of processing should allow for the field value being modified on screen being connected to the updating of the attibute in the object, by local functionality alone.

The exception is where the attribute update is effected by other attribute values in the object (e.g validation).

The connection between the widget and the attribute may be via a message for the whole object, but the code that sets and retrieves the value in the message should be local to the widget and attribute, so that there is no hand written code involved in the transfer of data.

Table Column Update
The situation is similar for column reading and update. Although the saving of an object to a table row may be proceed as one action, the code related to one column should be localised to the attribute.

Against the Controlling Outer
The controlling outer says that functionality related to the object should control the behaviour of the idividual components. This approach leads to the duplication of functionality. Small text

Links

 * Meta Programming
 * Symbolic Logic:Programming:Object Relational Mapping