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=0.6 required=5.0 tests=BAYES_05,INVALID_DATE autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,791ecb084fdaba75 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 1994-10-04 16:56:03 PST Path: bga.com!news.sprintlink.net!howland.reston.ans.net!swiss.ans.net!cmcl2!thecourier.cims.nyu.edu!thecourier.cims.nyu.edu!nobody From: dewar@cs.nyu.edu (Robert Dewar) Newsgroups: comp.lang.ada Subject: Re: Types with physical dimension Date: 4 Oct 1994 10:56:44 -0400 Organization: Courant Institute of Mathematical Sciences Message-ID: <36rqfc$km7@gnat.cs.nyu.edu> References: NNTP-Posting-Host: gnat.cs.nyu.edu Date: 1994-10-04T10:56:44-04:00 List-Id: strong typing is like anything else, fine in moderation, but dangerous to health if overdoses are encountered. there is a common tendency in Ada programming to assume that since strong typing is a GOOD THING, it must make sense to use it as much as possible. This leads to programs which thousands of different integer types and conversions all over the place. For my taste that actually decreases reliability, since (a) it makes the code less readable (b) once you get in the habit of freely breaking type barriers by writing conversions, then the value of the type barriers is diminished. I much prefer a style in which different integer types are used only when it is very rare that the need for conversions will arise, or when the necessary conversions can be nicely abstracted. Similarly, if setting up an abstraction requires writing a huge amount of code, which might itself have errors, then the mere fact that you can use the abstraction neatly when you are done may not leave you ahead (this is an instance of the common behavior of spending your time building tools to increase your productivity, spending all your time on this is NOT a good idea :-) Obviously everyone knows that strong typing is helpful (says he after spending a frstrating half hour finding a bug in an idiotic little C program -- left the & off in a call to sscanf, resulting in unimaginable and hard to debug chaos). But that doesn't mean "the more strong typing tne better". Good software engineering is the art of choosing the right abstractions, and structures, and it is not the case that it is always preferable to raise the level of abstraction as far as possible -- it needs to be at just the right level. The units case is an interesting one. Sure there are are programming situations where providing some automatically type checked units checking makes sense, but there are also situations where the attempt to provide such checking is precisely abstraction overkill. It's a nice example that way, because it lies somewhere near the borderline, and you need the skill to make the right cut on this border.