home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!mcsun!sun4nl!media03!pkr
- From: pkr@media03.UUCP (Peter Kriens)
- Newsgroups: comp.object
- Subject: Can functions be objects?
- Message-ID: <2840@media03.UUCP>
- Date: 22 Jul 92 08:29:06 GMT
- Organization: Mediasystemen, Netherlands
- Lines: 49
- X-Newsreader: Tin 1.1 PL4
-
-
- Functions as objects
- I started using OO with Smalltalk about 6 years ago. After
- making a million of mistakes I finally have the feeling
- that today I create reasonable efficient OO models and
- designs.
-
- Lately I am involved in projects where C++ is used. This
- projects confront me with designs which I find very
- awkward. I know C++ requires a different design attitude.
- Classes are much cheaper and because of the static typing
- you need much more of them. I realize this creates a more
- complex design.
-
- However, I get the uneasy feeling that I am missing
- something because everybody else seems to find function objects
- which I regard as bad. Even in the book of Rebecca Wirfs-Brock
- I am confronted with an Inquiry, a Deposit and a Withdrawal object
- in the ATM. In a design I am reviewing I find a XX_Create, XX_Delete
- and a XX_Edit object.
-
- My personal feeling is to immediately reject these kind of objects
- because they feel like they were found from structured analysis
- instead of object oriented analysis. They could be there because
- people need an abstraction mechanism to collect together a group
- of functions, and that is what they call a class.
-
- I feel strongly that an object should play an active rol in the
- problem domain. The Inquiry or Withdrawal are not tangible things,
- but just services executed by "something". By definition, the Inquiry,
- the Withdrawal etc. will be closely tied together, because they will
- use the same kind of input/output devices and basic services.
-
- Seperating these into a seperate class makes the communication pattern
- needlessly complex. And the fact the the person who wants to understand
- the program needs to understand more classes, will increase maintenance
- cost.
-
- Why I post this question is to find out if these kind of
- objects are commonly regarded as good OO, and that I am
- standing alone, or that I am right.
-
- Are there things I am missing? Can "functions"
- be objects?
-
- Peter Kriens
-
-
-
-