Developing reuse oriented code.
One of development architecture goals is to create code
that might be use later on in the enterprise. Here some
point that might help you create reuse oriented code:
-
Relations between components/classes in the system must
be based on interfaces. No direct calls to
components/classes should be make.
-
Class or component could implement as much interface as
needed to expose several behaviours.
-
Using pluggable architecture highly recommended.
Pluggable architecture not just eliminate dependencies
between classes it also enable changing components in
the system without recompiling the system.
-
If pluggable architecture is too complicated you might
consider using Factory to create objects from class
instead of creating them directly.
-
Use reflection and attributes to create abstract
oriented programming. AOP as system infrastructure
enable very good de-coupling between system components
(especially infrastructure services).
-
Try not to move or to use DB structure in classes that
not part of DAL (data access layer).
-
Try not to use by ref/ref parameters in methods. ref
parameters create strong coupling between classes.
-
Pass Value objects between system components. Value
objects are classes with simple data types and just
getters. Value objects break off coupling between
classes and enables using given classes in any system
that could provide given value object.
-
Value object principle is working on forms as well.
Forms that receive value objects can be operate from any
system that can provide the needed value object.
- Use MVC 2, front controller and application controller to disable direct calls from pages to business logic and data layer classes. Those patterns enable managing application flow from outer system file thus creating forms without any call to other system forms. Such forms can easily be used in other systems.