I believe that the best way to learn a new language is by diving into an actual problem. This begets its own problem though: that of what to actually work on. I'm curious how other people source good first problems. I feel like I have the programmer's equivalent of writer's block right now.
A couple of years ago, I interviewed for a Bay Area company that provided me with a great programming problem that I've been using for years to prototype with new languages.<p>Write a Rate Counting Proxy Service for a REST API that does the following:<p>* Stores state of requesting IP and a count of API calls made.
* Makes appropriate tradeoffs to limit I/O per request.
* Highly concurrent
* Maintains counts offline when shutting down/starting up.<p>I was asked to do the assignment in Java, despite not really knowing a lot of Java. It was a fun weekend project and I've continued to use it as a good "learning project" in other languages.
Here's what I did.<p>When I was learning C++ and Win32 API, I would implement small applications that would draw some graphics, because I loved graphics programming.<p>When I was learning java, I would go to freelancing sites like elance (and the now dead rentacoder), read project descriptions, design solutions and implement them.
They'd be all kinds of projects - from CRUD web apps to custom compilers for some exotic languages.
I'd never bid on any of those projects. For me, they were just real world problems that someone had and I figured that if I could solve their problems, I'd become proficient.<p>When I was learning python, I had also developed an interest in scientific computing. So I'd implement algorithms related to graphs, trees, linear algebra, machine learning, etc.<p>Initially, I found that if I couldn't come up with a clear roadmap of <i>how</i> to implement something, I'd dismiss it quickly as too tough and search for an easier project whose implementation roadmap lay inside the circle of my existing knowledge.<p>But then I realized that that's the wrong way to learn new things. The way to learn is to persist with tougher problems and expand that circle of knowledge. It requires some self discipline to stay the course because it can be frustrating, but in the end I feel that's what improved me as a developer.
Port some small but non-trivial projects from a language you know to the one you want to learn, e.g. Clojure, since you said you are learning it. It won't be the same as writing a new project in Clojure from scratch, but will still help.<p>And then, because there may be a tendency to use, in the new language, the style / idioms of the previous language you know (and ported the project from), put your code up somewhere and ask for reviews of it by people experienced in the new language.
Finding a problem is easy. Finding an easy problem that you can solve is hard.<p>For example, many folks might (or used to) think that building out a simple GUI with 3 buttons in C++ was easy (until they saw the code and didn't understand most of it compared to building an integer loop that adds 2 numbers).<p>IMO, go for something simple like advanced math functions. The basics almost always exist in most languages, so try out something like a rate calculator, etc.
My experience: C has a spartan standard library compared to other languages like Python. Even something like getting a scheme going for decent memory management can take a lot of work. I found it to be a good way to get my head round using pointers, now I don't find them so scary.<p>Just curious, is there a particular language you were thinking of learning?
Out of necessity.<p>Apart from being a software developer, I am also an amateur musician. A year ago I bought a Windows Phone and couldn't really find a good tab/note viewer application. So I decided to build one, released it free of charge and even open-sourced it.<p>Today, it reached 500k downloads and received much love from the folks all around the globe.