Component

From Java4c

(Difference between revisions)

Revision as of 04:55, 25 February 2011

Components and modules, re-using

A software should consist of more as one component. Each component should be able to describe, program and test independently of the application which uses it. A component may be able to use in several applications. Then it is reuseable.

Modules are the finer granularity inside components or inside the core of the application. Each module should be able to describe, program and test independently too. Modules may be one C/h-file or a package in Java or some related files.

A class in ObjectOrientation is the more finer granularity inside modules. A class in the C-programming is a logical coherence between one data structure and related subroutines. One class may be presented exactly with one source-file.

Dependencies between components, modules, classes

If another class is used inside a class, it depends of it. Formally it depends of the signature of the methods of the class. Really the functionality depends of the functionality of the called methods.

For a independently test of a class it may be necessary to abstract of the functionality of a related class. The behavior of the related class can be replaced by a simulation or emulation.

The same thinks are valid for modules and components, only more complex.

There are horizontal and vertical dependencies: If a class/module/component can be created, described and tested independently of another class/module/component, it is deeper in vertical or parallel in horizontal layer. If a class/module/component needs another, it is above in vertical layer. It needs means, in the real application it is associated to it and calls some methods there. For the independently test all needed classes/modules/components may be able to replace.

Interfaces are dependency-breaker

It is a problem if Module_A needs some methods from Module_B and in the other direction too. Both modules are parallel in layer, but there are not able to develop and test independently. In C the implementation of Module_A includes the headerfiles from Module_B and vice-versa.

Personal tools