jnh@ecemwl.ncsu.edu (Joseph N. Hall) (11/21/89)
In article <1862@netxcom.DHL.COM> kcr@netxdev.UUCP (Ken Ritchie) writes: >Newsgroups: comp.object,comp.lang.c++,comp.lang.smalltalk >Subject: DIRECT REFERENCE CONSIDERED HARMFUL >In article <28.UUL1.3#913@acw.UUCP> guthery@acw.UUCP (Scott Guthery) writes: >>Do you then wonder what the OO version of [Edsger Dijkstra's] famous "Go To >>Considered Harmful" will look like? >Get out your JOOP vol.2, no.1 (May/June 1989) and see pages 34-40. >"VARIABLES LIMIT REUSABILITY" -- sounds like a dire pronouncement! >Allen Wirfs-Brock and Brian Wilkerson provide a very convincing argument >against using direct reference to variables -- recommending, instead, that >methods ALWAYS be implemented for evaluating/changing state variables. >AWB & BW say "Direct references to variables severly limit the ability of >programmers to refine existing classes." > This is one of areas in which I think C++ has some real glitter as opposed to its usual dull, difficult-to-uncover gleam. The programmer can implement inline accessor methods for non-virtual classes and suffer little or no performance hit as a result. The compiler doesn't even have to do much heavy thinking ... On the other hand, I'll admit that the current AT&T implementation of inline has a plethora of silly restrictions. Of course, eventually more OOP systems will be able to optimize across modules and determine which references can be statically bound and which can't. v v sssss|| joseph hall || 4116 Brewster Drive v v s s || jnh@ecemwl.ncsu.edu (Internet) || Raleigh, NC 27606 v sss || SP Software/CAD Tool Developer, Mac Hacker and Keyboardist -----------|| Disclaimer: NCSU may not share my views, but is welcome to.