Is this kind of design - a class for Operations On Object - correct?

Posted by Mithir on Programmers See other posts from Programmers or by Mithir
Published on 2011-11-24T06:50:36Z Indexed on 2011/11/24 10:21 UTC
Read the original article Hit count: 386

In our system we have many complex operations which involve many validations and DB activities.

One of the main Business functionality could have been designed better. In short, there were no separation of layers, and the code would only work from the scenario in which it was first designed at, and now there were more scenarios (like requests from an API or from other devices)

So I had to redesign.

I found myself moving all the DB code to objects which acts like Business to DB objects, and I've put all the business logic in an Operator kind of a class, which I've implemented like this:

First, I created an object which will hold all the information needed for the operation let's call it InformationObject.

Then I created an OperatorObject which will take the InformationObject as a parameter and act on it.

The OperatorObject should activate different objects and validate or check for existence or any scenario in which the business logic is compromised and then make the operation according to the information on the InformationObject.

So my question is - Is this kind of implementation correct?

PS, this Operator only works on a single Business-wise Operation.

© Programmers or respective owner

Related posts about design

Related posts about design-patterns