How to Write a Program/Before you start

Before you prepare to start writing a new program using your text editor (or IDE), remember this:

Rule 1: Don't write that Program! edit

The world is full of bad code, we don't need your bad code! Therefore the first rule is Don't! Look for programs that do, or almost do what you want them to and use / modify them.

Remember what Eric S. Raymond wrote in The Cathedral and the Bazaar:

So, did I immediately launch into a furious whirl of coding up a brand-new POP3 client to compete with the existing ones? Not on your life! I looked carefully at the POP utilities I had in hand, asking myself ``Which one is closest to what I want? Because:

2. Good programmers know what to write. Great ones know what to rewrite (and reuse).

While I don't claim to be a great programmer, I try to imitate one. An important trait of the great ones is constructive laziness. They know that you get an A not for effort but for results, and that it's almost always easier to start from a good partial solution than from nothing at all.

Some good sources for finding already-written software include:

  1. Software directories such as Freshmeat or the Free Software Foundation's Free Software Directory
  2. Open Source Software Development Hubs ("Forges") such as SourceForge.
  3. Generic web search engines such as Google search.
  4. The package repositories of various Linux distributions, and other distributions or operating systems.
  5. Collections of packages for various languages or platforms such as Perl's CPAN (the "Comprehensive Perl Archive Network").

Normally searching using a good search engine (by trying several keywords) and on Freshmeat would be enough. If you still want to be sure, you can try asking whether anyone can point you to such a program in a relevant channel in a popular Internet Relay Chat (IRC) network such as Freenode or different kinds of Internet forums.

If you were able to find a program that almost does what you want this way, you may wish to move on to the How to Write a Program/Enhancing code

Rule 2: Think about what you want the program to do before you start. edit

Writing the wrong program is the most expensive mistake you can make. So let us consider How to Write a Program/Requirements analysis

Program a computer you can unplug edit

[1]

  1. C2:ProgramComputersYouCanUnplug