views:

125

answers:

7

Put simply, what are some good practice applications that anyone who considers him/herself a programmer should write.

A: 

Everyone should write microcode at least once to see how the code on the screen actually makes bits of machine move.

Preet Sangha
By 'code' I mean applications, not actual languages.
Glenn Nelson
A: 

Towers of Hanoi and 9 Queens are always fun :) You could write a program to solve Sudoku puzzles as well.

Dismissile
A: 

The two best practices are deciding on naming conventions (and sticking to it) and commenting. This means you can ALWAYS go back to old code and know whats going on (or anyone who needs to look at it for that matter).

Sydenam
+3  A: 

A compiler.

I found this to be qualitatively different than any other program I'd written before, or since. The input is so varied, the output is so strict, and the transformations in the middle are so specific, that there's no faking anything.

Ken
+1, Most definitely. One could never appreciate the code they write as much as they could if they didn't know how it worked under the hood. (IMHO)
Jeff M
6502 assembly here I come. +1 for the idea.
Glenn Nelson
Unless, of course, you're implementing a LOLCODE compiler.
James Dunne
Hai, can haz stdio?
Glenn Nelson
+1  A: 

Conway's Game of Life perhaps? You can go very basic or very far with it.

Jan
+3  A: 

You could possibly write a compiler, or your own scripting language. You'll learn more about how programming languages work, and you will of course learn a lot about your language of choice while creating the compiler.

I wouldn't expect every programmer to know how to write a compiler, but I expect if I gave a programmer 2 weeks, they'd come back with something that mostly works.

mellowsoon
A: 

Not sure about Towers of Hanoi - achieves much as it is a staple of so many books. I like the Sudoku suggestion though. Never coded any but it is something I've thought about.

To the list, I would add:

A simple parser

20-30 years ago I would have included a simple Threaded Interpreter Language implementation (eg. like Forth) but that is probably less important these days.

I do a lot of geometry work, so I'd probably be biased towards some geometry algorithm. Perhaps point-in-polygon. As well as requires floating point comparisons and the handling of pathological conditions (eg. Coincidences in data alignment).

winwaed