Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!cs.utexas.edu!yale!cmcl2!lanl!beta!drich From: drich@klaatu.lanl.gov (David O. Rich) Newsgroups: comp.object Subject: Re: Object-Oriented Metrics Message-ID: Date: 19 Feb 91 18:05:09 GMT References: <2040@media01.UUCP> Sender: news@lanl.gov Distribution: comp Organization: Los Alamos National Laboratory (LANL) Lines: 40 In-reply-to: pkr@media01.UUCP's message of 19 Feb 91 11:59:58 GMT In article <2040@media01.UUCP> pkr@media01.UUCP (Peter Kriens) writes: 3. References to other objects If you get the feeling that you have to write too many get/set messages to get access to other objects instance variables, you usually try to put the methods in the wrong place or your class layout is wrong. Minimizing access to instance variables of other objects could be another metrics. Yes, in fact this particular "metric" is one of the key factors in the Law of Demeter. "Assuring Good Style for Object-Oriented Programs," K. Lieberherr & I. Holland, Northeastern University, IEEE Software (September 1989). 8. Conditionals on the class If you end up having a design where decisions are made which depend on the class, you probably are doing something wrong. (Like (a isKindOf String) ifTrue: [ ] ifFalse: [ ]). I agree with you on this point. The interesting thing is that I've been involved in some pretty heated discussion with people who argue the exact opposite on this point. The argument is usually in the form of "static binding" is better than "dynamic binding" since static binding means a programmer knows exactly which method he/she is calling and that code written under this assumption is more readable (i.e., decisions that are made depending on the class only makes the code more readable since it is clear what is going on). Dave -- ============================================================= David Rich | Military Systems Analysis Group (A-5) Email: dor@lanl.gov | Mail Stop F602 Phone: (505) 665-0726 | Los Alamos National Laboratory FAX : (505) 665-2017 | Los Alamos, NM 87545 <><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>< "...in the abundance of water, the fool is thirsty..." =============================================================