View this PageEdit this PageAttachments to this PageHistory of this PageHomeRecent ChangesSearch the SwikiHelp Guide
Hotspots: Admin Pages | Turn-in Site |
Current Links: Cases Final Project Summer 2007

Sum2001 Midterm Review: Design Critique

for sure 2 and 3 have this problem: the object names are verbs, not nouns. They aren't "objects" at all, they're "actions" ... tsk tsk .. ;-)

Great! The OO police will be after this guy for sure. What else? And how about 1? -Lex Spoon



1. When talking about, and naming, classes for an object-oriented
system, it's bad form to talk about it in Computer Science terms; in
this case, your "friend" is referring to a LinkedList, which may not
be understood by whomever he's presenting it to at his job. OO class
names, and discussions regarding OO projects, should maintain a domain
within the "real world," using commonly understood words. This makes
it easy to explain to someone who doesn't understand the nerdy
terminology, but at the same time allows the nerds to implement
whatever it is (conceptually) easily. A better name might be
MapCollection, or
ACollectionOfVisualDirectionsToPlacesThatSomeoneMightWantToTravelToIfTheyLikeToDriveOnTheMappedRoadsToGetToTheirDestination.
2. There are two things wrong with this class. Number one,
ProcessMap is a verb-oriented name, since it performs processing of
the Map; good object oriented form dictates that class names are
nouns, while the messages that classes understand are verbs. Alan Kay
puts this on his DynaPalmPilot as something to roll over in his grave
about. Furthermore, the description of what the class does is very
ambiguous–"basic processing" reveals absolutely no information about
what specific services this class will provide, or what data it needs
to hold. Alan Kay whips out the DynaPalmPilot again.
3. Well, I don't know about you, but I can't tell heads from tails
about what a MapManager might do. The name suggests that this class
will be the grand moff, his vassals being every other class in the
system. This is bad design, as having one overseeing class can hurt
resuability, since everything else depends upon it. At this point,
Alan Kay throws the DynaPalmPilot to the ground because he's so
frustrated trying to write out letters on the stupid little rectange
area they give you.

Great! On 1, what other reason(s) is it bad to use MapLinkedList instead of MapCollection? And what elso is going wrong in #1? #2 and #3 look great.

Hrm. Perhaps because they might want to change the implementation later, using something besides a linked list. This would mandate changing the name of the class, additionally causing every other class that does anything with MapLinkedList to have to be updated to work with MapHeap (or whatever the new class might be called).

BTW, PalmPilot's are personal computers, but they've got a ways to go before being Dynabooks. Dynabooks are "dynamic" – they are programmable. They are also a new form of media (though maybe that aspect has been added only in later years.) At any rate, few would really want to implement and explore, say, a stock market model, on a Palm Pilot. Even a Palm Pilot with Squeak on it. The little gray area is probably tolerable, but the "big" gray area above it is too small. -Lex Spoon

Yeah, I didn't really mean that Palm Pilots are Dynabooks; the phrase just amused me in the context of what else I was writing about.

About #1. Another problem with the class name MapLinkedList is the alternate meaning of the word "map." Besides being a noun, it can be a verb as well. So, "MapLinkedList" could be a verb class name (a no-no). Also, "mapping" a linked list is something that you can do to a linked list... So, "MapLinkedList" could be interpretted as "a class to map linked lists" but that's not the purpose of this class at all.


Good point, Brian, possibly the name is misleading. The problem I was getting at is simply that you shouldn't worry about such low-level details. At the design phase, simply "collection" is all you need to know; linked-list is overkill. It's the wrong issue to be thinking about, and who know's, maybe it turns out to be the wrong data structure anyway. -Lex Spoon

Link to this Page