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!
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.
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:
- Software directories such as Freshmeat or the Free Software Foundation's Free Software Directory
- Open Source Software Development Hubs ("Forges") such as SourceForge.
- Generic web search engines such as Google search.
- The package repositories of various Linux distributions, and other distributions or operating systems.
- 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 differnet 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.
Writing the wrong program is the most expensive mistake you can make. So let us consider How to Write a Program/Requirements analysis