views:

189

answers:

8

At some point in our lives we're put in the situation to learn a new language (either by job requirements or just passion). Personally, I'm trying to learn Objective-C coming from a background of several years coding php. My problem is that I'm bored with your average starting programs (most of them coming from maths; eg: Fibonacci).

What are your first algorithms and programs you write when learning a new language?

I'm thinking we could make a list of interesting problems to be solved and that would make the learning curve at least more entertaining.

Later edit: My question is about fun things (and also useful), but not like Code Kata or other very boring math stuff (I've done many of those already)

Later edit [ 2 ]: I found this today and the problems there seem fun to do.

+3  A: 

Try to develop something proper, a project of some kind; solving algorithmic problems really only teaches you to apply the algorithm, not really a lot about the language your using.

Deciding on a useful project then deciding on a language and then 'doing it' will cover many of the bases you need to learn a new language.

DRL
Well, the problem here is around "useful project" :) I wrote this question trying to find fun things (useful as well) to code while learning a new language.
Bogdan Constantinescu
+1  A: 

Just as an idea: Look at the problems of the The Computer Language Benchmarks Game.

When you've done a snippet, you can compare your solutution to the provided one.

mkluwe
A: 

Try to solve these challenges using your new language. What's it all about:

In software we do our practicing on the job, and that’s why we make mistakes on the job. We need to find ways of splitting the practice from the profession. We need practice sessions...

Ando
A: 

I sometimes use the exercises from the first few chapters of Structure and Interpretation of Computer Programs.

Pete Kirkham
A: 

You can also try to understand or improve existing open source projects as suggested in this so question. Even though the answers are cocoa biased it should be a good starting point.

This way you can dive in to the level of your choice (understand, debug, improve) and in direction of your interest (UI, specific library, etc, etc...).

EDIT: When I said starting point, I meant that you can browse repositories for objective-c code, for example sourceforge

Unreason
+1  A: 

Whenever I pick up a new language, I try using it to solve the problems at SPOJ. They basically support every mainstream language out there (as well as a few esolangs like Intercal and Whitespace). The problems are mostly from various ACM and similar format contests around the world and so can be quite hard, and perhaps be too CS/math for everyone's tastes. The tutorial problems are quite doable in any language.

I would also recommend adding that language's tag to your SO interested tags list. Many SO questions involve small snippets of code, and trying to answer them and looking at the other answers can be very enlightening.

But as soon as I've got the basics right, the strategy I choose is to try my hand at a very small project. Usually this a simple game, GUI app or a tiny webapp. This is valuable since there are some things you cannot learn by only doing small isolated blobs of code.

MAK