Identifying a Group of Core Methods

A strategy for defining a class

The definition of the class BagOfStrings could be fairly involved, as it certainly has quite a few methods. For such classes,

  • Do not define the entire class all at once and then attempt to test it.
  • Instead, we should identify a group of methods central to the purpose of the class to both implement and test before continuing with the rest of the class definition. Such methods are core methods, and sometimes we will refer to a group of core methods as a core group.

By leaving the definitions of the other methods for later, we can focus our attention and simplify our task.

Get hands-on with 1200+ tech skills courses.