ObjectBuilder method or loose code

  • Thread starter Thread starter Andy B
  • Start date Start date
A

Andy B

I have a complex object that is made up of 17 other objects and 2 dynamic
dictionary collections. Would it be safe to say that I should possible make
some sort of ObjectBuilder method in the main/root object to help contain
the creation code? Or should it be broken up into smaller parts before the
main builder method puts it all together? I know with something this huge,
just putting out in loose code isn't a wise idea. What do you think? If you
need a general object structure layout, I can give it.
 
Andy said:
I have a complex object that is made up of 17 other objects and 2 dynamic
dictionary collections. Would it be safe to say that I should possible make
some sort of ObjectBuilder method in the main/root object to help contain
the creation code? Or should it be broken up into smaller parts before the
main builder method puts it all together? I know with something this huge,
just putting out in loose code isn't a wise idea. What do you think? If you
need a general object structure layout, I can give it.

Without more information, it's hard to give any useful information.

Alun Harford
 
What more info do you need? Let me know and I can see about getting it here.
 
Andy said:
What more info do you need? Let me know and I can see about getting it here.

Well it sounds like you're saying you have a design issue. There wasn't
much more information, and software design is too large a subject for a
newsgroup post.

Alun Harford
 
First thing first.. Do u have the full idea about the architecture of the
object factory??? if so, look at the following points
1) Objects that are tightly coupled
2) Which objects that you wanted to be loosely coded
3) What are the communication channels that are in pipe line for the
existing objects

Many more.. but to understand your current situation, i guess you have to
explian more

HTH
 
Not for sure if I want to use an object factory or not. I guess I wanted to
make some methods of the main object class that would help create the object
itself. There is a point at which I can't cut down on lines of code because
of the way the object is built, but cutting down as much as possible would
be good. When I ran a few test cases last night on the object, It took about
100 or so lines of code to create the object with some initial values that
were valid. I was mainly thinking of something like this for some examples:

//Create the main object
Contract Contract = new Contract();

//Add a word or 2 to the dictionary. This would cut down on some lines of
code in the loose code because the dictionary object is created, a word is
added and
//it is verified to be added just in case it failed. Probably around 10-20
lines of code down to 1.
Contract.AddToDictionary(Word, Definition); //not actually implamented yet.
Just used as a prototype example.

//Another good example is below. Cuts down on another 10 or so lines of code
Contract.AddEvent(Title, PerformanceFee, Length, Date, StartTime, EndTime);
//creates an Event and adds it to the Contract object.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top