home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c++
- Path: sparky!uunet!munnari.oz.au!metro!extro.ucc.su.OZ.AU!maxtal
- From: maxtal@extro.ucc.su.OZ.AU (John MAX Skaller)
- Subject: Re: Should I use a generic object which all others inherit from
- Message-ID: <1992Nov20.133441.27425@ucc.su.OZ.AU>
- Sender: news@ucc.su.OZ.AU
- Nntp-Posting-Host: extro.ucc.su.oz.au
- Organization: MAXTAL P/L C/- University Computing Centre, Sydney
- References: <3762@news.cerf.net> <1992Nov17.190821.18348@informix.com>
- Date: Fri, 20 Nov 1992 13:34:41 GMT
- Lines: 62
-
- In article <1992Nov17.190821.18348@informix.com> cshaver@informix.com (Craig Shaver) writes:
- >In article <3762@news.cerf.net> hlf@nic.cerf.net (Howard Ferguson) writes:
- >>I am working on the early stages of design on an embedded C++
- >>project. One of the decisions which we will have to make in the
- >>near future is whether to make all of the objects inherit from
- >>onie generic object at the top of the tree or to go for the forest
- >>approach.
- >>
- >
- >You have some of the benefits of OOP in mind, such as inheritance, reuse,
- >and information hiding. Then if you are willing to take small dings in
- >performance go all the way and use the tree approach as pioneered by
- >Smalltalk.
-
- Please do NOT do this. This approach requires dynamic type
- checking which cannot be done in C++ (yet). IMHO the object model
- of Smalltalk is totally inappropriate in C++. You should do exactly
- the opposite, IMHO. C++ now has multiple inheritance (MI), use it.
-
- >I recently saw a review of the toy code that comes with the
- >borland compiler. The article's author commented that the tree type
- >libraries were "passe" because of templates. What a stupid thing to say!
-
- I dont agree and neither does Borland (I assume) since they
- provided an updated version using templates. The original 'object'
- version is one of the worst pieces of code I've ever seen (sorry
- Borland, twas the best that could be done with only single inheritance
- and no templates I suppose).
-
- >
- >One of the big wins of OOP is reuse. By using an inheritance structure
- >you can reuse existing code and do incremental development.
-
- By using a 'tree' structure you can only do 'layered development'.
- To do proper 'incremental' development you must use mixin techniques,
- which require abstract virtual bases.
-
- >Related and
- >unrelated classes can be used in the same context where a similar protocol
- >is enforced.
-
- Absolutely not in C++. C++ unlike Smalltalk is strongly typed,
- the only support for 'protocol' based reusability is with templates.
- (My tagged pointer proposal extends this considerably).
-
- >
- >I have to think some of the people involved with C++ have no idea what the
- >basis of OOP really is. They are simply using C++ as an improved C.
-
- Nothing wrong with that. C compatibility is one of the principal
- guidelines of the standardisation people. Using C++ as an ADT language
- is a good use of C++ in my opinion, that is, as C with user defined
- types.
-
- If you really want dynamic object orientation, C++ is probably
- not the best language to use. Why not use Smalltalk in the first place?
-
- --
- ;----------------------------------------------------------------------
- JOHN (MAX) SKALLER, maxtal@extro.ucc.su.oz.au
- Maxtal Pty Ltd, 6 MacKay St ASHFIELD, NSW 2131, AUSTRALIA
- ;--------------- SCIENTIFIC AND ENGINEERING SOFTWARE ------------------
-