views:

315

answers:

5

I always believed that when starting to learn a new programming language programmer must create certain projects to get a better understanding of the language and/or frameworks. Personally for me it was with php (guestbook, DB abstraction, templating engine), ruby (on rails, twitter like website, active record plugin, simple gem) and objective-c (cocoa, todo-list, twitter client).

I'm wondering what are the must-program projects for other programming languages like Java, C++, Python, etc? Maybe you had other path learning languages?

+1  A: 

The Python Challenge is good fun and encourages the use of interesting language and library features. http://www.pythonchallenge.com/

tarn
+3  A: 

For Java I think something like a inventory system would be OK because it covers most of the stuff like the object oriented concepts, GUI, Database programming etc. It is smart enough to begin with

In C++ I guess something related with performance might be great. Suggesting you to develop a simple image processing application in C++. You will get a good understanding about pointers and memory management

Chathuranga Chandrasekara
+2  A: 

Sadly, it's been a while since I've learned a new language.

But when I was learning new languages all the time, I had a simple strategy: My first program was your basic "hello, world", something that just displays a message and exits. My second program was Life. (See, e.g. http://www.math.com/students/wonders/life/life.html)

In more recent days my next effort became some simple database program, though I never came up with a standard one. But something to read to and write from a database.

I think it's a good idea to write the same program in different languages. That way you already know the problem and the principles behind the solution, so the only new thing you're dealing with is the implementation language.

Jay
Interesting point. But doesn't approaching same problems with same solutions defies the "there-is-more-than-one-way-to-do-it" paradigm? After all, each language carries it's own philosophy. Diesn't it?
Eimantas
Sure. But when I'm learning a new language, the first thing I want to learn is the basics. How do I do i/o? How do I read a file? How do I call a subroutine? Etc. My first C++/Windows program looked a whole lot different from my first Fortran program because, yes, the design philosophy behind them is very different, i.e. object-oriented and GUI vs procedural and TTY. I didn't intend my "already know the solution" comment to be taken that far. What I meant was, when I'm writing my first program, I want to be thinking about how the language works, not wrestling with the functional requirements.
Jay
+7  A: 

ProjectEuler

The first 20 or so are nice small problems that let you experiment with languages basic execution control stuff. Gives you a good feel for how a language operates in the 'small'.

Joshua
+2  A: 

I usually like to do some games for a couple of reasons.

  • They tend to be more enjoyable to implement cause hey they are games after all.
  • They have clearly defined rules so you don't spend a lot of time figuring out the spec instead of writing the program
  • They tend to have a nice medium level of complexity. Hard enough to not be trivial and simple enough that you can do them in few hours or days
  • They tend to be independent. I.E. you don't need a database backend for chess unless you really want to - unlike a more real world app like a blog where a database is basically mandatory.
  • With a lot of games you can stick with a text only or ASCII art UI which tends to simplify things when learning a language

Start with something simple like hangman, master mind or towers of Hanoi. Then you can move up to a more full game like poker/monopoly. With a game like that you can then add arbitrary features like saving games to a database if you want to experiment with the language's data access framework.

Joshua
Hangman is exactly the sort of thing I would do -- see my earlier post. Monopoly seems like a fairly complex game to program for a throw-away practice problem. Maybe you devote a lot more effort to a practice problem than I would. Or maybe I'm overestimating how much effort it is. Oh well.
Jay
Monopoly is on the high end of games I would do for practice. Though if you only have an text based UI, I only bother making a real UI if I want to practice the UI framework, its not bad with maybe 20-30 major rule you want to worry about. Plus if your pressed for time or what not you can always arbitrarily discard rules. The main thing I like about it is that an OO approach works nicely with it and makes it simpler. Almost any way I try to write it I end up with at least a player and property class. In something like hangman I tend to write procedurally since its so simple.
Joshua
Hmm, brings to mind an interesting thought: With most modern languages being OOP, perhaps a good practice problem is one that exercises multiple objects that have actual methods and aren't just data containers, and that includes some sub-classing. That way you practice a little about how the "object stuff" works in this language.
Jay