Re: Refactoring and commenting
- From: Andreas Røsdal <andrearo pvv ntnu no>
- To: games-list gnome org
- Subject: Re: Refactoring and commenting
- Date: Tue, 12 Dec 2006 22:04:58 +0100 (CET)
On Mon, 11 Dec 2006, Alan Horkan wrote:
On Sun, 10 Dec 2006, Robert Ancell wrote:
I recently refactored part of Gnomine as trying to modify it for Bug
#307245 was very difficult. Part of the refactoring included adding
comments on some confusing sections (very little of the codebase seems
to be commented). As I now know the gnotravex codebase quite well I
plan to do some fairly heavy refactoring on it soon.(it is a 2000 line
single file that is crying out to be split into two or three parts).
What is the Gnome Games community position on refactoring/commenting?
I am particularly interested as I chose gnotravex as the first game to
make changes to due to it's relative simplicity. However the code is
quite complex and would potentially turn off future coders and
patchers. I think lowering the bar to new developers is a timeworthy
The lack of reponse so far probably shows no one else sees any problem
with well written, clearly commented code either, how could they?
Refactoring of code to increase the quality of the code is ofcourse very
welcome. Adding updated comments, and reorganizing code into smaller and
more organized modules is also a good idea. So I fully agree that
refacoring of some parts of the codebase would be very useful.
The new games implemented in Python illustrate many areas which are
improved, compared to some of the old games written in C in gnome-games.
Since the Python games are object oriented, code can be organized into
reusable modules more easily. Object orientation also gives access to more
powerful concepts such as inheritance, encapsulation, abstraction and polymorphism.
It is much easier to make platform-independent code in Python than C.
(Java is even better at this, though.) There are some obscure bugs on
gnome-games in Bugzilla about compilation errors on exotic C compilers on
operating systems that I will never be able to get access to.
Python is much easier to read and understand than C in many cases, eg.
there are no pointers, and code is automatically indented correctly etc.
I could propably write down a much longer list of why I suggest that
Python is ideal for games in gnome-games. So for any new large refactoring
projects, or rewrites of exising games, I would strongly suggest doing
things in Python. I wonder how long it would take to rewrite Gnotravex in
Running your compiler in a stricter mode and with more
warnings might show other ways to "clean" the code.
Which additional compiler-flags do you think would be useful?
Perhaps -Werror, to treat all warnings as errors during compilation? That
would prevent new warnings from being introduced into the code.
Getting a unit-testing framework in place for gnome-games as we've
discussed before is also something that I'd like to prioritize. As well as
trying to remove most of the critical bugs reported in bugzilla...
] [Thread Prev