Complete.Org: Mailing Lists: Archives: freeciv-dev: April 2000:
[Freeciv-Dev] OO model for Freeciv? (was: #define $#@$%! template)
Home

[Freeciv-Dev] OO model for Freeciv? (was: #define $#@$%! template)

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] OO model for Freeciv? (was: #define $#@$%! template)
From: Reinier Post <rp@xxxxxxxxxx>
Date: Thu, 27 Apr 2000 09:50:53 +0200

If I dare say this as someone who has contributed very little code:
Freeciv sceams for an OO language.  It's all objects with attributes
and methods; there is quite a lot of code dealing with the problem of
object identities; inheritance and templates could be put to good use,
I also feel that the existing Freeciv object model has some flaws that
might be easier to correct if the code was in an OO language.  But
generally, I've found the existing C code easy to use, thanks in part
to the 'cleanup' patches that improve the logic every now and then,
mainly supplied by David Pfitzner.

> I don't know what platforms people are running freeciv on these days, but if
> switching to C++ would mean that some of these platforms would no longer be
> able to compile freeciv, then that is a good enough reason to stick with C.

As far as I know, Freeciv compiles and run on every variant of Unix with X,
using the GUI libraries of Xaw+Xpm or GTK+ libs, all of which are in C,
so you'd still have to carry a lot of C glue code.

It also compiles and runs on MS Windows, Amiga, and OS/2, at least the
client; not all of the clients require X.  I'm not sure whether or not
the Macintosh port is operational.

Porting Freeciv to an OO language may not be worthwhile, but would it
be worthwhile to create and maintain an OO design document for Freeciv?
It could describe the code in abstract terms of classes, attributes
and methods.  This description can be linked to the actual code:
the LXR interface we already have can be extended to draw diagrams of the
objects and functions present in the code, using GraphViz or some such
system, and the documentation can be hyperlinked to/from these diagrams.
Or perhaps there is a better way of doing this.

-- 
Reinier Post



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