Re: Lahman, how ya doing?
- From: "H. S. Lahman" <h.lahman@xxxxxxxxxxx>
- Date: Thu, 19 May 2005 20:17:11 GMT
Responding to Hansen...
So it's not just me! I've been starting to notice that C++ seems to make it harder than it has to be to do things that must be common in OOP.
C++ is generally regarded as the most technically deficient of the popular OOPLs. A major reason was the that performance and low-level machine control were primary design objective. That results in a lot of compromises. Given the design goal, it is not bad. However, the prices one pays are that a higher skill is required to use it properly and there are a lot more opportunities for foot-shooting.
It didn't take me long to realize that a generic pointer can only hold any variety of classes if they were all derived from a single base class (e.g. the recipient of an event, or the object to read data from), but you can't invoke methods unique to a derived class with a pointer to the base class. I suppose there's dynamic typecasting techniques to get around that, but it just seemed easier to let my base class keep accumulating virtual member functions as derived classes gained their own functions.
Actually C++ provides dynamic_cast for this. It exists as a mechanism to deal with an external stream of arbitrary objects where one needs to determine the nature of the object in hand to access its specializations.
However, I regard that as one of C++'s deficiencies because too many people abuse it to navigate from superclass to subclass during routine collaborations. Subclassing relationships are not navigable for collaboration because there is only one instance in hand to navigate.
If one needs to access the subclass specializations (and the object is not supplied externally), then there should already be a direct relationship path to the subclass that can be navigated. That path will provide type safety and whatnot. If that relationship is not properly implemented and instantiated, then that is a design fault.
************* There is nothing wrong with me that could not be cured by a capful of Drano.
H. S. Lahman hsl@xxxxxxxxxxxxxxxxx Pathfinder Solutions -- Put MDA to Work http://www.pathfindermda.com blog: http://pathfinderpeople.blogs.com/hslahman (888)OOA-PATH
.
- Follow-Ups:
- Re: Lahman, how ya doing?
- From: Gregory L. Hansen
- Re: Lahman, how ya doing?
- References:
- Re: Lahman, how ya doing?
- From: H. S. Lahman
- Re: Lahman, how ya doing?
- From: Gregory L. Hansen
- Re: Lahman, how ya doing?
- From: H. S. Lahman
- Re: Lahman, how ya doing?
- From: Gregory L. Hansen
- Re: Lahman, how ya doing?
- Prev by Date: Re: Lahman, how ya doing?
- Next by Date: Class Design Question
- Previous by thread: Re: Lahman, how ya doing?
- Next by thread: Re: Lahman, how ya doing?
- Index(es):
Relevant Pages
|