home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!cs.utexas.edu!rutgers!cmcl2!psinntp!psinntp!searchtech.com!johnb
- From: johnb@searchtech.com (John Baldwin)
- Newsgroups: comp.lang.c++
- Subject: Refs to paper, how not to expose class implementation
- Keywords: type opacity, abstract data typing, messages
- Message-ID: <1992Jul22.230329.1912@searchtech.com>
- Date: 22 Jul 92 23:03:29 GMT
- Organization: Search Technology, Inc.
- Lines: 74
-
-
- Hello, netters!
-
- I referred to a certain paper recently and now I somehow cannot find
- it. I don't remember the title nor the author --- just the content.
- Hopefully, someone here will recognize it and be able to provide me the
- reference.
-
-
- -------------------------------------------------------------------------
- SYNOPSIS OF ARTICLE:
-
- The general idea was that some classes, by their very nature, contain
- certain information which the user must know it contains. But often these
- classes are implemented in such a way as to expose too much of their
- implementation.
-
- For example:
-
-
- class SomeType {
- public:
- .
- .
- bool setStartTime(const Time& input);
- bool setEndTime(const Time& input);
- .
- .
- bool setSomeCondition( OtherType somevar );
- .
- .
- private:
- .
- .
- Time startTime;
- Time endTime;
- Foo someCondition;
- .
- .
- };
-
-
- The proposed approach was to overload operator<< () and provide some
- additional typing to differentiate similarly-typed values. So instead
- of writing:
- myObj.setStartTime(begin);
- myObj.setEndTime(finish);
- myObj.setSomeCondition(neverOnSunday);
-
- ...which requires knowledge of the protocol of "set" methods for every
- class, one would write:
-
- myObj << StartTime(begin);
- myObj << EndTime(finish);
- myObj << neverOnSunday;
-
- -------------------------------------------------------------------------
-
-
- Does the above synopsis sound like a paper you've read in the last
- year or so? If so, please EMAIL to johnb@searchtech.com. Please don't
- flood the net with responses or inquiries. If there's sufficient
- interest, I'll post the reference if/when I get it.
-
-
- THANKS!
-
-
-
- --
- John Baldwin johnb@searchtech.com
- Search Technology, Inc. uupsi!srchtec!johnb
- 4725 Peachtree Corners Cir., Ste 200 johnb@srchtec.uucp
- Norcross, Georgia 30092
-