tags:

views:

477

answers:

3

I am interested in trying a few code-golf problems, but of a fairly easy level as I'm only a year old in terms of programming. Simple things, but that will make me think. I am comfortable in JavaScript and PHP at the moment.

+12  A: 

I don't think you'll learn all that much from code golf as the goal there is to write incredibly short, concise programs. This is almost always accomplished by writing them in a way that would otherwise be considered very, very poor (difficult to read, no error handling, etc.).

I think a better approach would be to solve a bunch of these projecteuler problems. That's what I usually do to play with a new language.

Michael Haren
I beg to disagree. Golfing has taught me a lot of things about a language I now use almost daily. After all you're forced to look at every possible language feature to evaluate whether it may be applied to make code shorter. While that's not usually your goal in normal development you *do know* those features then, you can just as easily change your goal. Project Euler has a pretty narrow scope as well and solving many of those problems isn't very fun or instructive with language that don't have built-in arbitrary-precision arithmetic, for example.
Joey
There is so much more to software than the 15-level details of order of operations. I'd encourage beginners to look more into writing clear, testable code--with good design and obvious intent. The intricacies of boxing or quadruple ternaries can be entertained after a base of fundamentals is established
Michael Haren
+8  A: 

Anarchy Code Golf has a long list of problems to solve. Those marked post mortem will show the source code. Javascript and PHP are there.

But you must understand that using Code Golf to learn to develop software is like playing Scrabble to learn to write novels. You use the same tools, but the process is totally different.

Carlos Gutiérrez
I'm not still at the learner/beginner stage with these languages, so I want the challenges as a way of making me think about using the languages in different ways, doing things I wouldn't usually do. Mostly for fun, not learning :) I appreciate the advice, though.
A: 

Look also at http://codekata.pragprog.com/

Miro A.