Hacker News new | past | comments | ask | show | jobs | submit login

He never argued that .each is a horrible looping construct. He calls it a horrible _first_ looping construct, that is to say that its bad for teaching to beginners. Your last paragraph says nothing that contradicts the article in any way. In fact, you beautifully summarized that portion of the article:

> Well, sure, if you're teaching someone programming for the first time it's probably better to start with "for".

That said, I was inclined to agree that idiom has simply picked up a new meaning. That's usually where I fall in debates about changing language. However, your straw man argument almost made me change my mind out of spite.




I just spent the last two weeks learning the Ruby language (but I come from other programming languages).

I'd argue that learning .each vs. normal looping has numerous benefits. First, this is the way most people loop most things in Ruby. More importantly, however, teaching .each enabled me to be more openminded towards learning "yield" and blocks.

In a way, without having learned about .each first, and coming into Ruby with my preconceptions (or no conceptions), I would have been confused. I would have been writing Ruby as if I were writing Python or C, without really understanding the benefits of writing Ruby as Ruby ought to be written.


Learning a new language requires that you adapt your way of thinking. Idioms are a way to familiarize with the spirit of a language.

Starting to teach languages avoiding what makes the language so special is counter productive. As soon as your students know a basic way to program, they won't be inclined to learn the "good way".


I'm not sure how else to say this, but taking things out of context still does not make them wrong. This is about teaching the concept of programming. If you're learning a particular language, yes, use the idioms. If you're teaching someone how to code, teach concepts that cross languages.




Consider applying for YC's W25 batch! Applications are open till Nov 12.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: