Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!.POSTED!not-for-mail From: supercalifragilisticexpialadiamaticonormalizeringelimatisticantations Newsgroups: comp.lang.java.programmer Subject: Re: Arithmetic overflow checking Date: Thu, 21 Jul 2011 06:28:52 -0400 Organization: supercalifragilisticexpialadiamaticonormalizeringelimatisticantations Lines: 14 Message-ID: References: <015aeb15-57db-48ab-9cd4-77f8448b632f@w24g2000yqw.googlegroups.com> <2rydnez7l-H5BYnTnZ2dnUVZ_vGdnZ2d@earthlink.com> <4e278a67$0$309$14726298@news.sunsite.dk> <1SSVp.69032$_I7.18660@newsfe08.iad> NNTP-Posting-Host: h1MICDOSuUTFyvkTQ7BjNQ.user.speranza.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@aioe.org User-Agent: WinVN 0.99.12z (x86 32bit) X-Notice: Filtered by postfilter v. 0.8.2 Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:6332 On 21/07/2011 6:05 AM, Arved Sandstrom wrote: > I agree, with caveats. The larger issue is the proper treatment of > numerical quantities in business applications. Leaving aside currency, > which there is _some_ awareness of in terms of appropriate things to do, > the expression of other numerical quantities in Java is typified by the > use of unconstrained primitives, with haphazard and inconsistent bounds > checking scattered over the code. Maybe it's just me, but wouldn't a > better approach to a numerical data type be to write its own class, > which is responsible for its own invariants (*) (**)? ... Why don't you > write a proper class for your data type? In four words: Lack of operator overloading. Math on non-primitive types is *painful* in Java.