🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: pl.comp.objects
Article #13538

Re: Asercje i "Design by Contract"

#13538
From: A.L.
Date: Sun, 20 Nov 2005 15:08
27 lines
1548 bytes
On Sun, 20 Nov 2005 12:40:34 +0000 (UTC), " Aneta"
<aneta_ra@WYTNIJ.gazeta.pl> wrote:

>witam 
> 
>Czytam sobie ostatnio "Programowanie zorientowane obiektowo 2-wydanie" 
>Meyera i poznaje tajniki Eiffela ;} Kwestia natomiast dotyczy pewnych 
>mechanizmów opisywanych w tej książce w kontekście Javy. Wg opinii Java 
>dobrze zaimplementowanych asercji i "Design by Contract" nie ma. 
>Ale czym rózni sie np javowe: 
> 
>if ( thisClassAssertsOn && !(x >=0) )  
>         throw new AssertionFailed("X ujemne, rowne " + x);  
> 

Skad ci sie to wzielo?... Assertions w Javie robi sie tak:

public class FooBar
{
  public void m1( int value )
  {
    assert 0 <= value : "Value must be non-negative: value= " +
value;
    System.out.println( "OK" );
  }

A.L.
Technical Details
Message-ID: <6c31o1tdmvr143vecpdjoivn0asrg6lsr4@4ax.com>
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!newsfeed.gazeta.pl!news.nask.pl!news.nask.org.pl!newshub.sdsu.edu!newsfeed.news2me.com!newsfeed2.easynews.com!newsfeed1.easynews.com!easynews.com!easynews!sn-xit-03!sn-xit-08!sn-post-01!supernews.com!corp.supernews.com!not-for-mail
References: <dlpqs2$joq$1@inews.gazeta.pl>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!newsfeed.gazeta.pl!news.nask.pl!news.nask.org.pl!newshub.sdsu.edu!newsfeed.news2me.com!newsfeed2.easynews.com!newsfeed1.easynews.com!easynews.com!easynews!sn-xit-03!sn-xit-08!sn-post-01!supernews.com!corp.supernews.com!not-for-mail
From: A.L. <alewando@kapturek62.com>
Newsgroups: pl.comp.objects
Subject: Re: Asercje i "Design by Contract"
Date: Sun, 20 Nov 2005 09:08:11 -0600
Organization: Posted via Supernews, http://www.supernews.com
Message-ID: <6c31o1tdmvr143vecpdjoivn0asrg6lsr4@4ax.com>
References: <dlpqs2$joq$1@inews.gazeta.pl>
X-Newsreader: Forte Agent 2.0/32.652
MIME-Version: 1.0
X-Complaints-To: abuse@supernews.com
Lines: 27
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit