From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f43e6,9f84d7b6d2cd2e3c X-Google-Attributes: gidf43e6,public X-Google-Thread: ff6c8,9f84d7b6d2cd2e3c X-Google-Attributes: gidff6c8,public X-Google-Thread: 119d25,9f84d7b6d2cd2e3c X-Google-Attributes: gid119d25,public X-Google-Thread: 103376,9f84d7b6d2cd2e3c X-Google-Attributes: gid103376,public X-Google-Thread: 10db24,9f84d7b6d2cd2e3c X-Google-Attributes: gid10db24,public From: dewar@cs.nyu.edu (Robert Dewar) Subject: Re: Reuse News Brief - 96-07-26.txt [1/1] Date: 1996/08/09 Message-ID: #1/1 X-Deja-AN: 173141412 references: <4tlnfn$h4q@ns1.sw-eng.falls-church.va.us> <839542173.1185.2@earth3.demon.co.uk> organization: Courant Institute of Mathematical Sciences newsgroups: comp.lang.ada,comp.sw.components,comp.objects,comp.software-eng,comp.edu Date: 1996-08-09T00:00:00+00:00 List-Id: Jeff said "Cool idea. And I reuse an awful lot of code. But remember that Ariane reused code. Moral: Document the limits of the component ?" The other thing is that you have to be careful to make sure that you have properly parametrized the new use. It is easy sometimes to slip up on this, and then code reuse can have the same hazards as cut and paste in an editor -- very useful, we could not do with out this feature in an editor, but we have all made cut-and-paste errors. One lesson here is that in building reusable components, it is worth giving some thought to the interface in terms of making it harder to make this kind of error. Perhaps someone can come up with a nice example, here is a trivial one: Print_Msg (S : String; N : Natural); -- Prints first N characters of string S. Print_Msg (S : String); -- Prints string S The second interface is clearly better, since the first has the risk of copying a call, and replacing the string without adjusting the count.