itm / wsn-device-drivers

Drivers for Wireless Sensor Network Devices
Other
6 stars 4 forks source link

Split up the AbstractOperation in a Container and the Operation #30

Closed mlegenhausen closed 13 years ago

mlegenhausen commented 13 years ago

An Operation currently contains the operation itselfs and the whole lifecycle. The lifecycle of an operation should separated. This reduces the code and can make the AbstractOperation not anymore necessary. So you can create a operation by only implementing an interface instead of extending a class.

This will introduce a OperationContainer, OperationContainerFactory, OperationContext (for accessing the container from the operation, e.g. for canceling an operation).

ghost commented 13 years ago

Sounds like having three classes instead of one. Is the drawback that AbstractOperation has to be extended so significant that the new complexity is justified?

mlegenhausen commented 13 years ago
  1. Implementing is always better than extending.
  2. I take away complexity and functionality away from the operation developer that he has normally not worry about. Things like State, Timeout management, Threading. Cause these things are implemented in the AbstractOperation.
  3. Easier testing of an operation.
  4. Calling a sub operation produces a smaller memory foodprint, cause the things like State, Timeout and Threaded are not needed when doing such a call.
  5. Separation of concerns: The workflow of an operation is then separated from the functionality a operation delivers.
mlegenhausen commented 13 years ago

Maybe this issue can moved to a release 0.5 cause it will have multiple API changes.

mlegenhausen commented 13 years ago

Cause this includes some really heavy refactorings in all dependend drivers it is moved to a later release. Other things has now more priority.

mlegenhausen commented 13 years ago

Cause this has only internal API changes this issue can move to the release 0.4.