[#7055] More on VC++ 2005 — Austin Ziegler <halostatue@...>

Okay. I've got Ruby compiling. I'm attempting to get everything in

17 messages 2006/01/05
[#7058] Re: More on VC++ 2005 — nobuyoshi nakada <nobuyoshi.nakada@...> 2006/01/06

Hi,

[#7084] mathn: ugly warnings — hadmut@... (Hadmut Danisch)

Hi,

22 messages 2006/01/10
[#7097] Re: mathn: ugly warnings — Daniel Berger <Daniel.Berger@...> 2006/01/10

Hadmut Danisch wrote:

[#7098] Design contracts and refactoring (was Re: mathn: ugly warnings) — mathew <meta@...> 2006/01/10

Daniel Berger wrote:

[#7118] Re: Design contracts and refactoring (was Re: mathn: ugly warnings) — mathew <meta@...> 2006/01/12

*Dean Wampler *<deanwampler gmail.com> writes:

[#7226] Fwd: Re: Question about massive API changes — "Sean E. Russell" <ser@...>

Hello,

23 messages 2006/01/28
[#7228] Re: Question about massive API changes — Caleb Tennis <caleb@...> 2006/01/28

>

Re: Design contracts and refactoring (was Re: mathn: ugly warnings)

From: Mathieu Bouchard <matju@...>
Date: 2006-01-12 19:07:59 UTC
List: ruby-core #7121
On Fri, 13 Jan 2006, mathew wrote:

> *Dean Wampler *<deanwampler gmail.com> writes:
> > Let me suggest an XP-style alternative; make thorough unit tests
> > required and make sure they "document" - and test! - the design
> > "contract".
> Unit tests are not an alternative. They are an additional requirement.

I find unit-tests to be often decomposable like this. Start with something 
like this:

  raise if Blah.new(666) != Blah.new(666)
  raise if Blah.new(747) != Blah.new(747)
  raise if Blah.new(242) != Blah.new(242)
  raise if Blah.new(69)  != Blah.new(69)
  raise if Blah.new(37)  != Blah.new(37)

then generalize it ("equality is defined based on the arg of .new"):

  for x in [666,747,242,69,37] do
    raise if Blah.new(x) != Blah.new(x)
  end

then extract a contract from it:

  class CheckedBlah < Blah
    def self.new(x)
      r = super(x)
      raise if r != super(x)
      r
    end
  end

so now all Blah object creation may be checked throughout actual uses of a 
program and not just unit tests. The unit test now reduces to:

  for x in [666,747,242,69,37] do Blah.new(x) end

so for many unit tests, all you have to do is just do things and discard 
the results, and the contract will do the job of checking.

 _ _ __ ___ _____ ________ _____________ _____________________ ...
| Mathieu Bouchard - t駘:+1.514.383.3801 - http://artengine.ca/matju
| Freelance Digital Arts Engineer, Montr饌l QC Canada


In This Thread