Is it poor design to create objects that only execute code during the constructor?

Posted by Curtix on Stack Overflow See other posts from Stack Overflow or by Curtix
Published on 2010-05-24T23:00:19Z Indexed on 2010/05/24 23:01 UTC
Read the original article Hit count: 213

In my design I am using objects that evaluate a data record. The constructor is called with the data record and type of evaluation as parameters and then the constructor calls all of the object's code necessary to evaluate the record. This includes using the type of evaluation to find additional parameter-like data in a text file.

There are in the neighborhood of 250 unique evaluation types that use the same or similar code and unique parameters coming from the text file.

Some of these evaluations use different code so I benefit a lot from this model because I can use inheritance and polymorphism.

Once the object is created there isn't any need to execute additional code on the object (at least for now) and it is used more like a struct; its kept on a list and 3 properties are used later.

I think this design is the easiest to understand, code, and read.

A logical alternative I guess would be using functions that return score structs, but you can't inherit from methods so it would make it kind of sloppy imo.

I am using vb.net and these classes will be used in an asp.net web app as well as in a distributed app.

thanks for your input

© Stack Overflow or respective owner

Related posts about object-oriented-design

Related posts about object