Composite Objects

Another OO lesson:

When working with complex objects, try to view them in groups of behavior. Don’t view it as one gigantic object, split it into behaviorial groups. You can then take advantage of so called ‘lazy’ or ‘late’ instantiation. For example, you might have an “Insurance Policy” object. You don’t want to retrieve and build the entire object every time. That would cause poor performance and memory overhead.
Instead have a minimum set of properties that are always retrieved and then group the remaining into separate objects. For example, coverages, underwriters, auditors, etc. You can then break those subgroups into smaller late instantiated objects as well.

A little extra though now will save you a great deal of performance pain later!

Advertisement

About JohnHowell

I am a professional software developer with over 20 years of experience. I currently specialize in Microsoft technologies such as VS, TFS, C#, VB.Net, WCF, WPF, WW, etc.
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s