Defining a Class

I am relatively new to c#. I understand what a Class is but I am unsure about how small/large a class definition should be. For example I have an application in mind which I am about to start working on. This application will take a series of rules which have been defined within a ms database and given a transaction name and it will execute these rules in a predefined sequence defined within the database. Database rules can be input rules, output rules, logic rules, constant rules, menu rules etc.. and each database rule can consist of 40-50 field definition. When a particular transaction is selected then the sequence of rules for that transaction will be load up into arrays or containers and the transaction will execute from these arrays. The transaction will have if/then/else logic , error checking, database input/output.

My Questions is:
 do I define just 1 class called "transaction"        and get this the class members to perform the database I/O , array/container processing, error checking etc. etc.. or should I break this down into much smaller classes ? Appreciate if someone could point me towards some reading material which would help me understand what should be contained within a class ?

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Joshua LucierstudentCommented:
That database doesn't sound like it's normalized very well if it has 40-50 fields per record.  There's two ways of doing this.  You can have a class called query accept a query, or you can create a 'model' of classes to match your database architecture.  From these you can extract the query.  There are often model architecture libraries out there that will do this for you.  I'm not an expert with c#.  If you want to create your own model, I would use one class per table ('object').  If this is a nosql database, there will be a much different approach.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
anarki_jimbelSenior DeveloperCommented:
First, regarding "not normalized DB".  We have tables with up to hundred fields, and just believe me - it is well normalised. Depends on a scale and complexity of an application. Anyway, it's irrelevant to the question.

it is not easy to tell what class structure you need, Definitely, you need more than one class. First, I'd have classes that are responsible for connecting to DB, retrieving results, etc. Other classes would be "model" classes as was suggested above, to keep data.
Jaime OlivaresSoftware ArchitectCommented:
Your question is very broad but I would suggest to find what element are common to all rules, there you will define your parent class. That may reduce the property count at the child classes, which seems to be too much.

Regarding the operations mentioned (database I/O, array processing, error checking), you can implement some helper classes if those operations are complex, by passing a reference to the 'parent' class.
pclarke7Author Commented:
Thanks for all comments
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.