home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!utcsri!skule.ecf!torn!nott!cunews!revcan!software.mitel.com!kim!kim
- From: kim@Software.Mitel.COM (Kim Letkeman)
- Newsgroups: comp.lang.pascal
- Subject: Re: BP/TP OOP is missing something...
- Message-ID: <KIM.92Nov18082550@kim.Software.Mitel.COM>
- Date: 18 Nov 92 13:25:50 GMT
- References: <dmurdoch.282.722020256@mast.queensu.ca>
- <1992Nov17.200839.342@news.clarkson.edu>
- Sender: kim@Software.Mitel.COM
- Organization: MITEL Public Switching, Kanata, Ontario, Canada
- Lines: 51
- In-reply-to: kooijman@sun.soe.clarkson.edu's message of 17 Nov 92 20:08:39 GMT
-
- In article <1992Nov17.200839.342@news.clarkson.edu> kooijman@sun.soe.clarkson.edu (Harry Kooijman,Peyt314a,3808) writes:
-
- | It is this couple of extra lines that make the difference between
- | using objects or not. With explicit calls to the
- | constructor/destructor I can write exactly the same code without
- | objects, and loose all the object overhead.
-
- TP makes you determine the explicit timing of the construction and
- destruction of an object, but does not change the amount of overhead
- it takes to use an object. If automatic construction and destruction
- were implemented, the same level of overhead would still exist. But
- you wouldn't know about it because the code was executed for you.
-
- In either mechanism, not using objects always eliminates object
- overhead. But, of course, the overhead of passing many parameters to
- many small functions in a library can easily outstrip the minor
- overhead associated with encapsulating the functionality into an
- object.
-
- | What if you are adding a vector in a subroutine declaration list,
- | write the constructor, and use it, but forget to destruct it (an o
- | so easy and common bug): you start loosing heap. What if you forget
- | the constructor (worse!) ? If you have only a couple of vectors to
- | worry about you will probably not make this mistake. However if you
- | are dealing with 15 vectors and 15 matrices in one routine it
- | becomes a different matter. And that's why automatic construction
- | and destruction takes me further.
-
- Forgetting to call constructors and destructors is a classic problem,
- but relatively easily debugged. All the complaining seems to be about
- local objects being constructed and destroyed as the object goes into
- and out of scope, which means that the code to construct and destroy
- the objects would typically be only a few lines apart anyway.
-
- Manipulating large numbers of vectors and matrices in local scope has
- got to be pretty rare. And using them in a way that requires constant
- allocation and deallocation is so inefficient that I would expect
- steps to be taken to keep them in scope at all times (i.e. global) and
- just reuse the objects.
-
- In other words, lets not worry too much about all these "one one
- hundredth of one percent" type problems. TPW is a very productive
- language because it is simple to use and yet very powerful. Making it
- into yet another C++ just defeates the purpose of having two separate
- languages.
-
- I'd hate to only have a choice between one incredibly complex language
- and another slightly different looking but equally comlpex language.
-
- --
- Kim Letkeman kim@Software.Mitel.COM
-