Skip to content
cgendreau edited this page Apr 9, 2013 · 6 revisions

Current Rules

  • All processors shall be Thread-Safe after creation. To ease this requirement, processors should avoid state variables and setters.
  • One instance per configured processor should be used. Singleton is not enforced to allow different creational pattern.
  • All processors shall allow to process JavaBeans as defined by the AbstractDataProcessor abstract class. This feature allow to accommodate all different user model classes.
  • All processors shall have at least 2 constructors. A default constructor and at least another one allowing to configure the field name(s).
  • All processors shall have a process function that allows to process the data without JavaBeans. This method will be faster and should be used internally by the processBean(...) function.
  • All processors shall have a matching unit test class.

Questions

Why objects like ProcessingResult are passed in parameter instead of a return type?

Simply because those objects can be optional and to also allow the calling class to decide to create or not new object on each call.

Why 2 processing functions per processor?

All processors shall offer at least 2 processing functions. One that uses the JavaBeans and another one that doesn't use them. The JavaBeans allow to give a good abstraction to all possible user models but this comes with a cost. They require more resources (memory, CPU) than a simpler processing function. To allow the processors to be used at a bigger scale, the different processors shall implement the logic inside a non-JavaBeans function. This function is then used internally by the processBean(...) function.