Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!tut.cis.ohio-state.edu!rutabaga.cis.ohio-state.edu!edwards From: edwards@rutabaga.cis.ohio-state.edu (stephen edwards) Newsgroups: comp.software-eng Subject: Re: Reusability considered harmful??(!!) Message-ID: <88643@tut.cis.ohio-state.edu> Date: 19 Feb 91 21:21:21 GMT References: <6108@stpstn.UUCP> <87829@tut.cis.ohio-state.edu> <6248@stpstn.UUCP> <1991Feb11.103100.112@skyler.mavd.honeywell.com> <88431@tut.cis.ohio-state.edu> <867@caslon.cs.arizona.edu> Sender: news@tut.cis.ohio-state.edu Reply-To: stephen edwards Organization: Ohio State University Computer and Information Science Lines: 65 In article <867@caslon.cs.arizona.edu> dave@cs.arizona.edu (Dave P. Schaumann) writes: > >Now I see the crux of the reusability issue. What we need is well-defined >interfaces between code. Horray! You're not the only one who believes this is a crucial issue. >The sine function is a good example of this: you >pass it a floating point value, and you get a floating point value back. Yikes! Wait a minute ... I thought you said well-defined interfaces were crucial. Saying "sine" takes a float and returns a float is about as ill- defined as an interface can be! (A sad statement, since you're right that it's that way in most languages.) In fact, if we're this lax with our interface definitions, the sin(x), cos(x), sqrt(x), square(x), .... all have the _same_ interface. A simple syntactic interface description does not constitute a "well-defined interface." Semantics are crucial. >Naturally, the more polymorphic your language is, the more powerful this idea >will be [ ...] Polymorphism can be a useful tool, but it adds _nothing_ to a purely syntactic interface description. >When you have polymorphism, you don't even need to specify what kind of data >elements you have. Nope. This just doesn't fly. Basically, any operation (e.g, sin(x), or push(y, stack) to follow on your stack example) has certain semantic requirements on the operations available for its arguments and the behavior of those operations. These are _semantic_ restrictions that are part of (inherent in) the interface of sin(x), etc. If you operation is polymorphic, you can't put an object of "just any" type into it, you can only put in objects on which the necessary operations (required by sin(x), or whatever) (a) are defined, and (b) meet the required semantic restrictions. Languages which do not allow you to express these requirements simply do not allow _fully defined_ interfaces. Polymorphic systems which do not enforce such constraints on parameters simply do not ensure conformance to a _fully defined_ interface. Of course, the latter point may be moot if the fully defined interface can't even be described in the language under question. >We already have languages with various combinations of these features [...] >What we really need now is to learn how to use these features [ ... ] We may be farther away than you indicate. >Ultimately, I believe that it is the discipline of the programmer, as much >as any language feature or advance in theory that makes the difference in >how reusable (and modifiable, and debuggable...) the code is. Ah, with this I cannot disagree. Even though well-defined interfaces are crucial, simply the capability to describe (and enforce) such interfaces is not enough to make software reuse a success. These capabilities are merely enabling steps, and it will still require disciplined programmers to use such capabilities effectively. -- Steve Stephen Edwards U.S. mail: 372 Jones Tower e-mail : edwards@cis.ohio-state.edu 101 Curl Drive home phone: (614)-293-0842 Columbus, OH 43210