.net - How Many Objects Inside of a Class is too Many? -


i'm new concepts of oo programming - programming in general still student. i'm working intern in department has me coding new structure base applications come. believe have idea behind oo down create "basic building blocks" , expand, expand , expand, until arrive @ complex object (for time being).

i need put these "advanced" objects 1 how many many? can have 100 objects inside of bigger object if requires these "parts".

i hope question makes sense everyone. i'm sure answer not going definite answer either need rule of thumb go by. i'd hate have 100 objects inside of 1 big 1 if there better design/programming technique.

thank you.

edit 1: thank responses i'm still little unclear. marked answer felt can continue have but...

let me continue human example. human composed of many parts (or objects) , each part made of parts, way down single cell.

human --> arm --> hand --> fingers --> thumb --> bones --> bone cells

human: ojbleft_arm, objright_arm, objleftleg, objrightleg, objbrain, objheart, objleft_eye, objright_eye.... point? how many objects inside human object many? human object going considered massive since human complex. break down arm , leg objects objlimbs stores them?

i guess question: if don't want many objects, how avoid them?

100 objects inside single object isn't strictly inappropriate, it's indicative there might better way it. consider grouping similar objects composite objects functionality similar usage in final "superobject". rule of thumb, number of objects refer in class (rough) estimate of complexity of object; 100 indicate complexity that's high. note can reduce effective complexity grouping objects composite objects, thereby increasing overall object count reducing direct reference count within "superobject".

edit in response op's edit , question: key grouping expected usage , problem domain. consider human example; appropriate breakdown of object model dependent upon usage data model going put to. key here recognizing you're not trying represent possible objects or underlying reality; you're creating representation that's appropriate expected usage. example, if modeling human cardiologist, might appropriate have human object, under have heart object, circulatory system object, etc.; under heart object might have left ventricle, right ventricle, etc.. however, dentist, model still have human @ top, human have teeth collection @ next level; teeth might include objects canines, incisors, etc.

the key point here underlying object (human) same; representation different. cardiologist doesn't care (much) teeth, , dentist doesn't care ventricles of heart. usage defines representation. case, have determine usage is, , usage can (hopefully) define clear path representation.


Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -