7

I think everyone has their own program or set of features beyond "Hello World!", that they use when trying out a new language.

Mine is a guessing game:

I'm thinking of a number 1-10, guess what it is!
Guess: 3
Nope, too low!
Guess: 7
Nope, too high!
Guess: 5
Yes, You win!
Play again (Y/N)? N

What do you write?

1
  • 2
    Is this an answerable question? I mean, by definition there are no wrong answers, if one does not accuse the users answering of lying
    – keppla
    Jul 22, 2011 at 7:05

9 Answers 9

16

It usually goes like this:

  1. Hello World
  2. Hello [user inputted name]
  3. A few problems from Project Euler
  4. A linked list
  5. A simple blog engine (either terminal or web-based, depending on what language)
  6. And from there I dive into a project that I want to work on (but don't care if the design gets mangled as I learn my way through a new language).
7

Whatever I needed to write in the new language in the first place.

4

I'll often try to write a Tetris clone. It touches on a bunch of things, including performance, UI, and synchronization/timers/etc.

Any language that can't make that simple is just a toy.

4
  • How do you define "simple"? Say, I'm learning C or C++. Writing a Tetris clone as the first project wouldn't be very obvious/straightforward, but neither of those languages is a toy.
    – Adam Lear
    Sep 14, 2010 at 17:23
  • It'd be obvious and pretty straightforward once you understand how Windows or Qt or whatever does things. (That'd be a prereq for any low- or mid-level language: knowing how to use the underlying system. Even some high-level languages require that.) And Visual Studio (and AFAIK most other IDEs) will create a bare-bones C or C++ app for you, so you can basically just work on the code to run the actual game.
    – cHao
    Sep 20, 2010 at 19:59
  • not even hello world? Just right into Tetris? Man...you're a far more ambitious programmer than I am, that's for sure. Jul 22, 2011 at 21:58
  • 2
    "hello world" is overdone (just about every book about the language already includes it!), and doesn't give a decent language any real workout. I don't really get a feel for the language til i've done something non-trivial with it (which requires that i go and figure out "ok, this is how you do timers...this is how you watch the keyboard"...etc.)
    – cHao
    Jul 23, 2011 at 15:21
4

Basically, I redo the first year of CS:

  1. The first 40-50 Project Euler problems to learn number processing.
  2. Some command-line utilities to learn text processing.
  3. A program that involves a large graph search (e.g. a Klotski puzzle solver) to learn data handling and optimization techniques (and possibly GUI).
  4. An interpreter for a language I already know to learn everything else.
0
1

My very short list

  • hello world
  • You said [something user said]!
  • (Big jump) An IRC bot
  • Whatever else I'm interested in/paid to write
1
  • Hello World
  • RSS Reader (This one usually hits a lot of the high points without having to worry about storage or having a data source...feeds are everywhere)
  • Blog Engine (Now I bring in data persistence, since I have everything else down.)
2
  • I like the RSS idea. Do you do more web programming than stand-alone, just out of curiousity?
    – Michael K
    Nov 3, 2010 at 17:51
  • I do a little bit of everything, but it's mostly services/backend and web with some mobile development thrown in.
    – Ryan Hayes
    Nov 3, 2010 at 19:25
0

I like to do some I/O exercises(both file system and console), then a text adventure game, because it helps me understand the way data structures are used in that language (it really helped when I was working on Lisp). They're also fun to make.

0

I Google for a tutorial on the language and follow that, usually. If there isn't one somewhere on the language's website then that's not a great sign. More often than not, I've looked up some examples before even downloading the language toolkit in order to get a feel for what to expect (there's so many languages popping up that you can't hope to try them all, so best to stick to languages with features you find interesting).

-1

followed by a very simple prime number generator, then whatever is on my mind at the time.

Not the answer you're looking for? Browse other questions tagged or ask your own question.