Newly-learned programming language practice
June 15, 2007 2:37 PM   Subscribe

Suggest programs to write in a newly-learned language.

I’m a competant programmer, and something of a language collector. I’ve seen some various blog posts and comments from people describing particular practices they use for learning a new language. Many of them describe implementing simple, common algorithms or processes, such as Fibonacci, or a simple echo client/server.

Can you suggest some particular examples?
posted by ijoshua to Computers & Internet (17 answers total) 23 users marked this as a favorite
 
Well, Hello World is the first one you do. After that, yes, fibonacci is a good one (or factorial) because it demonstrates you can do recursion. Bonus points for doing an iterative and a recursive version.

I think probably you would do well to pick up a book about programming job interviews and pick out any 5 exercises. Those questions are meant to demonstrate competence in a language, so if you could implement those algorithms in your language, you're probably competent enough to get a job doing it. I'm blanking on any specific examples, but I used Programming Interviews Exposed to prepare for my most recent interviews.

Also, one of my internship bosses recommended looking at TopCoder for examples of little programs you could try writing that would demonstrate you knew your stuff in a specific language.
posted by crinklebat at 2:44 PM on June 15, 2007


Various sorting algorithms, (quicksort, bubblesort, etc.)? Maybe a basic mad-libs game?
posted by monkeymadness at 2:44 PM on June 15, 2007


Trying to make a nice compact quine is usually pretty fun.
posted by Matt Oneiros at 2:46 PM on June 15, 2007


Best answer: If you haven't seen it already, 15 Programming Exercises for a New Language looks like what you want.
posted by ukdanae at 2:55 PM on June 15, 2007 [6 favorites]


It's a bit tricky to suggest anything without knowing what language you are talking about. Yes, CS is CS, the language doesn't matter. But it does matter when you are learning a language. I'm currently studying erlang and the projects I would try in erlang to learn its strengths & weaknesses are not the same ones I would use to learn lisp.
posted by chairface at 3:03 PM on June 15, 2007


Best answer: I've found that Project Euler is a great way to learn a language. Start from the begining, build up a library of routines to help you out (a lot of problems need simaler tools to solve them) and stop when you are spending more time trying to figure out how to solve the problems than how to make the language do what you want it to.
posted by aspo at 4:02 PM on June 15, 2007 [3 favorites]


Seconding Project Euler.
posted by minedev at 4:08 PM on June 15, 2007


Write a syntax checker for that language in that language.
posted by pracowity at 4:16 PM on June 15, 2007


I usually implement the game of Mancala w/ a simple AI, and a maze generator/solver. These are both pretty easy but yet exercise a reasonable subset of language.
posted by mto at 5:44 PM on June 15, 2007


Thirding Project Euler.
posted by musicinmybrain at 6:37 PM on June 15, 2007


Part of learning a new language involves thinking, but part is just typing exercise ('familiarity').

For the second: compute an n-player bowling score from a list of integers (=pins-down-per-ball-flung), knowing the length of the list. It's tricky without being very difficult or interesting.

I also second maze generator/solver.
posted by hexatron at 6:47 PM on June 15, 2007


Every new language I picked up I wrote a simple version of Conway's Game of Life. Can be as simple or as complicated as you like it and is a good way to get into the guts of the language like data structures etc...
posted by puddpunk at 8:30 PM on June 15, 2007


Best answer: If you haven't already seen this ask mefi question, there are some answers in there.
posted by molybdenum at 10:58 PM on June 15, 2007


Implementing Dissociated Press will force you to learn the data structure primitives of the language, and you get to use the phrase "Markov Chain", which is always kind of cool.
posted by IvyMike at 1:38 AM on June 16, 2007


Best answer: The Ruby Quiz of the Week has lots of fun, smallish problems. The Perl Quiz of the Week, too. Few of them are so specific to their languages that it doesn't make sense to solve them in another. This riddle list includes lots of problems suitable to be solved by code.
posted by Zed_Lopez at 2:04 AM on June 16, 2007


"A language that doesn't affect the way you think about programming, is not worth knowing." - Alan Perlis
posted by CautionToTheWind at 4:12 AM on June 16, 2007


For a more complex project, and if you are learning the language with an eye towards practical applications, I might suggest an RSS aggregator. I've also had some fun writing interpreters for some of the Python HTML templating languages, which has a nicely functional aspect (in that you have an input, some context, and an output, and you don't necessarily have to deal with HTTP and so forth per se).

But to echo chairface, it will probably depend a great deal on what the language itself is good at.
posted by whir at 11:22 AM on June 16, 2007


« Older I don't know where I'm going but I'm on my way   |   I need a bamboo forest in my apartment or my brain... Newer »
This thread is closed to new comments.