Complete.Org: Mailing Lists: Archives: freeciv-dev: November 2003:
[Freeciv-Dev] Re: Python?
Home

[Freeciv-Dev] Re: Python?

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: "Brandon J. Van Every" <vanevery@xxxxxxxxxxxxxxxxxxx>
Cc: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: Python?
From: Raimar Falke <i-freeciv-lists@xxxxxxxxxxxxx>
Date: Sun, 23 Nov 2003 10:42:57 +0100

On Sat, Nov 22, 2003 at 03:19:33PM -0800, Brandon J. Van Every wrote:
> From: Raimar Falke [mailto:i-freeciv-lists@xxxxxxxxxxxxx]
> > To: Brandon J. Van Every
> > >
> > > Some people argue that only aggressive test suites can save you from
> > > errors.  I am not sure.  I do write a lot of test suites for my own
> > > code, but I am typically a lone wolf developer and in control of my
> > > source pool.
> >
> > And do they catch all/all most all/most errors?
> 
> Yes, they do.  But I should be clear: my codebase for my game, Ocean
> Mars, is C++.  I haven't integrated Python because that project is
> currently on hold. 

But you are suggesting it for freeciv?

> I don't think that's relevant; what is relevant is
> I'm a micro-incremental developer, a source control fanatic.  A "really
> horrible bug" for me is something that takes 2 days to solve, and that
> rarely happens.  I rarely have any bugs in my source pool at all.
> That's what you can do when you're a lone wolf and a test / source
> control fascist.  It wouldn't matter what language I use.
> 
> Here are some links about type safety in Python:
> 
> "Strong Typing vs. Strong Testing"
> http://mindview.net/WebLog/log-0025

Interesting. IMHO it isn't strong testing OR strong typing but
both. Why should you drop one if you can have both. In freeciv we have
strong typing, extra checks at runtime (assert) and some kind of
testing (running and comparing autogames).

I'm not "test infected" but I know some people which strongly are. I
would have no problems adding more tests to freeciv iff they help to
find the real bugs. Per had brought this subject in the past. But I
think that we have not many easy bugs which unit tests can found. Most
of the bugs we are interested in are quite complex.

An example is PR#6094
(http://rt.freeciv.org/Ticket/Display.html?id=6094). You have to
 - bribe/conquer the city of an enemy
 - the enemy has to has a certain wonder
 - you have to capture a ship
 - you have to try to move a ship
 - during the same turn
 - with path-finding.
I would like to catch such bugs automatically with (unit) tests but I
think that testing for such conditions is extremely resource hungry
(read exponential number of cases). So the only thing we can do is to
add asserts in the code and run autogames and additionally let the
code be banged by the players.

> the Aspects package, which allows design by contract.  i.e. if you
> *really* care about solving type saftey issues, you need more than a
> statically typed language's compiler checks.  You need to specify what
> you want.
> http://www.logilab.org/projects/aspects/project_view

http://www.splint.org/manual/html/manual-301_files/image003.gif sums
this up quite nicely. Design by contract is just another point in this
graph. You can choose how much you go toward a formal
specification. The reason that there are no annotations in the freeciv
code is that I think that it clutters the code a lot. The same can be
said comparing a C program and an aspected Python program where
aspects are used to implement design by contract which is then used to
implement stronger type checking: the C program will look less
cluttered. It is build in the language.

        Raimar

-- 
 email: rf13@xxxxxxxxxxxxxxxxx
  Microsoft does have a year 2000 problem. I'm part of it. I'm running Linux.


[Prev in Thread] Current Thread [Next in Thread]