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:

  1. Relations between components/classes in the system must be based on interfaces. No direct calls to components/classes should be make.
  2. Class or component could implement as much interface as needed to expose several behaviours.
  3. 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.
  4. If pluggable architecture is too complicated you might consider using Factory to create objects from class instead of creating them directly.
  5. Use reflection and attributes to create abstract oriented programming. AOP as system infrastructure enable very good de-coupling between system components (especially infrastructure services).
  6. Try not to move or to use DB structure in classes that not part of DAL (data access layer).
  7. Try not to use by ref/ref parameters in methods. ref parameters create strong coupling between classes.
  8. 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.
  9. 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.
  10. 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.

 

No Comments