Path: csiph.com!x330-a1.tempe.blueboxinc.net!aioe.org!.POSTED!not-for-mail From: Roedy Green Newsgroups: comp.lang.java.programmer Subject: Re: About using assertion Date: Mon, 09 May 2011 09:01:59 -0700 Organization: Canadian Mind Products Lines: 23 Message-ID: References: <09cb7d90-9b79-473e-9869-4476c5a0191a@w24g2000yqb.googlegroups.com> Reply-To: Roedy Green NNTP-Posting-Host: RCd/Ul4tyxGUBII8WGwa5g.user.speranza.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@aioe.org X-Notice: Filtered by postfilter v. 0.8.2 X-Newsreader: Forte Agent 6.00/32.1186 Xref: x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:3863 On Mon, 9 May 2011 08:24:16 -0700 (PDT), Robert Klemme wrote, quoted or indirectly quoted someone who said : >Having said that I'd say that argument checking is probably more >important than assertions. Assertions should not be used to validate user-provided data. They need to be in effect all the time. Assertions about detecting bugs in the program, mis use of a method. Assertions, even though they hide it he body of method, are documentation on just what sorts of thing the method can do. in a simple case, you might assert that a SQRT method can only handle non-negative numbers. -- Roedy Green Canadian Mind Products http://mindprod.com How long did it take after the car was invented before owners understood cars would not work unless you regularly changed the oil and the tires? We have gone 33 years and still it is rare to uncover a user who understands computers don't work without regular backups.