CS253: Software Development with C++

Spring 2018

Helper Classes

See this page as a slide show

CS253 Helper Classes

Helper Classes

If your class has to do several things, then it may help to break it down into smaller classes.

We didn’t evolve to do object-oriented programming. Our brains aren’t designed to do this sort of thing. They’re not very good at it. Therefore, keep each class simple & managable.


Consider a container that is a hash table using filesystem storage. It may be useful to create a smaller class that stores a single item in the filesystem. Now, create a hash table class that stores the filesystem objects.

You can debug each class separately, and each class does only one thing. The filesystem class doesn’t know anything about hashing, and the hash table class doesn’t know anything about filesystems.


“I can understand this class just fine. Is it too complex for you?”

Gosh, aren’t you masculine.


“Having two classes will increase overhead.”

May I see your profiling data? Oh, you don’t have any? Yeah, I thought so. Your intuition is a poor guide, here. Also, having separate classes will decrease program development time and maintenance costs.


“You expect me to write two classes!?”

If you separate the functionality, two classes are easier to write than one overblown monster of a class.

If you’re afraid of writing classes, then look for a new profession.
Practice saying, “Can I supersize that for you?”

User: Guest

Edit History Source

Modified: 2018-04-24T16:53

Apply to CSU | Contact CSU | Disclaimer | Equal Opportunity
Colorado State University, Fort Collins, CO 80523 USA
© 2018 Colorado State University
CS Building