After all, if you want to be a programmer, eventually you will have to write code that will be used by other people, and if it's a PITA to maintain (because when writing it you didn't care about cleanness and safety and were just having fun), it's worthless.
I think _why had a lot of great ideas about pedagogy, and experimentation is a great way to internalize "best practices" because you truly understand why they are good (not just because somebody else told you so).
But, when I first started coding, I wrote it for myself and because it was fun! Why was it fun? Because the code made things happen! Not because it was clean.
Clean code makes writing large projects by yourself and with other people easier. It doesn't necessarily make coding more fun.
Mistakes are good, to some extent, but not in everything. Would you tell someone that unsafe sex is ok, and that one should learn its danger by doing the mistake, catching a STD, and then not doing it again? Would you tell someone that building a bridge without double checking pressure contraints and simic conditions is ok, that one will learn by one's mistakes when the bridge will fall apart? Hmm, so there are some limits to this "learn by your mistakes" thing, right?
In coding, the same. It is ok "to write dangerous or “crappy” code" (Why quote) in personal projects, not in those where life are at stake, eg. airport traffic control or medical software. It is ethically not ok to write dangerous code in these case, and I would say it is the same when your code will have to be read, used, debugged by others. I admire people taking risks, too, like I admire someone eating 50 eggs in 1 hour, but I would not always advise my friends and relatives or coworkers to take those risks. Sometime, most of the time, the reward is not good enough.
I appreciate "Why" writting skills, he is or was an impressive guy, but taking to the letter every of his tweets should not be mandatory on HN, I believe.
Thanks for explaining why and where I'm wrong, if it is the case.
Your example is a little bit over the top. I might have generalized too much but I think that in the context of the discussion you get the point I was trying to convey. There are always exceptions to every rule, of course. I believe my comment still stands, most of the time.
You shouldn't learn to write maintainable software by rote. You just mechanically learn what to type, and how to type it, without ever learning why. Which is important. Knowing why certain constructs are hard to understand prevent you from doing the same spaghetti in perfectly-sanctioned style. Knowing how people read unfamiliar code is important, and teaches you which parts of the style-guide-mandated documentation are best kept short (for someone scanning your file to see what-does-what) and which parts long (to describe the edge cases).
Honestly, the best way I've found to write software is to start with a complete proof-of-concept mess. That way there's minimal friction during the get-it-right phase. Then I factor out the actual 'hard work' code from there into a reusable component, and turn the rest into the start of my test harness.
You really should not be using (or maintaining) code written by beginners, should you?
Getting beginners to experiment with their own code is a very natural way of teaching them what is good and what is bad, and why exactly it is good/bad - since they're the ones who'll have to maintain it.
Also, unrelated, but "having fun" is an amazing metric for good code. If some coding activity is boring as hell you're probably 1) on the wrong job or 2) using the wrong abstractions.
Give http://www.paulgraham.com/icad.html a read and come back enlightened.
It's the same as saying "but why are you so sure your science will remain science a couple years from now?". Sure, there is constant progress and change, but we have to know what is at our disposal right here, right now.
Did you read the text I pointed you to?
And I did read that text. In fact, I had read it earlier.
If coding isn't fun, please stop doing it. The last thing you need is to sacrifice your career to something you don't like doing.
Or maybe it just seems so to me, because I'm really really stupid and have to work hard to grasp even the easiest concepts :-)
Yes, of course. You push the boundaries, move on, and at the end of the day, we have to maintain the stinking pile of "experiments" you left us with. Ugh.