Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: What makes good code? (also, winner of the programming challenge)

Author: Scott Gasch

Date: 12:21:30 02/23/05

Go up one level in this thread


I hate to ramble about this topic but we are not doing gymnastics at the
olympics where we need judges.  There are pretty clear emperical ways to define
a good program: it should do the job, be fast and be small.  Readability,
clarity, reusability, approach... these things are nice when you are writing
code at work or hacking on your chess engine.  But the question here was "solve
this problem" not "solve this problem using method x (and by the way make nice
readable, reusable code)".

If you agree about the goals of a good program then how to measure is simple:

1. We can verify that it does the job easily enough -- compile it and run it
2. We can emperically measure size by compiling all entrants with the same
compiler and settings and comparing the amount of code generated.  Counting
lines of C or characters in a file is ridiculous.
3. Because small is not always fast, the last phase is to time the execution of
each entrant.

The balance between 2. and 3. is debatable but I don't know why we talk about
reusable code or debate people's algorithm choice.  (of course this assumes
people are coding in the same language... I don't know how to pick in a pool of
submissions where some people used C and others used Perl... other than to say I
_truly_ appreciate a clever Perl script (and could not, personally, think of one
to solve the problem) but Perl loses on metrics 2. and 3.)

Scott



This page took 0 seconds to execute

Last modified: Thu, 15 Apr 21 08:11:13 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.