Interface Design by Bill Venners
Keep methods, objects, and packages focused
Interface Design |
Contents |
Previous |
Next
Is this where I talk about method naming? If so, "Vigorous writing is concise." would
be a good quote for short method names. Use the names in Collection package, perhaps compare
the names of Enumeration and Iterator. Maybe here is where I talk about naming in general. -->
Being One Thing
-
Guideline: Keep objects focused.
-
Objects should be one thing.
-
What does it mean to be an object?
-
Being an object means offering a bundle of services.
-
All objects of the same class offer the same bundle of services.
-
The bundle of services offered by an object should be focused (cohesive).
Good Writing and Good Business
-
This is good writing: Paragraphs should be about one thing. Essays/
Papers/Chapters/Books/Poems/Web Pages should be focused on one thing.
-
This guideline is not about computers, its about communicating
with people.
-
Designers communicate semantics to clients, so clients understand
how to use the object.
-
Designers are writing -- communicating to clients (humans) through
documentation and code.
-
It is easier to understand something that's about one thing.
-
Also good business: Objects should do one thing and do it well.
-
It is easier for programmers to create objects that are
focused narrowly on particular vertical service niches, as opposed
to trying to create one object that tries to be everything
to everybody.