4 ms·
This is more a description of "how to type in code that appears to solve today's problem". But that's not programming, that's code monkeying. To learn how to
by jrockway 16y ago
This is more a description of "how to type in code that appears to solve today's problem". But that's not programming, that's code monkeying.
To learn how to write real programs, you need to read real programs. Is Emacs bugging you? Open the source and see how it works. Web server crashed? Read the source and fix the bug. Not sure how to configure cron? Take a look at its config parser!
Many "programmers" spend their entire life treating everything as a black box. Take a look inside the box! That's how you really learn to program.
- jshen 16y agonice strawman. If you have a real concrete goal, and your web server crashes, you'd try to fix it just like you say.
- helium 16y agoActually, I don't believe that was what DHH meant. Everyone is going to write a spaghetti mess starting out. The only way to learn from that is to write more and more code(that you'll need to maintain) and teaching yourself what well designed code is and why it matters.
- BrandonM 16y agoDefinitely this. I got a BS in Computer Science and started along the path of Software Engineering while working towards my Masters. Learning some good fundamentals helps, but my code was still a mess. Writing code that you'll actually have to look at again is the best way to become a good programmer.
- awakeasleep 16y agoYou could disagree with anything if you tried to. But can you see any merit to the 'need a goal to guide your learning' point of view?
- shadowsun7 16y agoThat wasn't the point of his counter-argument. That a stance has some merit does not raise it above criticism.
- jacquesm 16y agoTo tell someone new to programming to open the emacs source and start reading it is not really friendly. I'd start with something considerably lighter than that, but I do agree that reading code is a really important part of really learning how to program (well). As for 'code monkeying' not being programming, I disagree with that, programming is the creation of specific instructions in order for a computer to reach a certain goal and I couldn't care less what the goal was or the way in which you arrived at your program. I'd definitely not go so far as to demean anybody that got in to coding that way, just like not everybody can be Michaelangelo we can't all be Peter Norvig. From Excel to LISP and everything in between, it's all programming.
- JoeAltmaier 16y agoNo, I agree. Looking at a large program can be a college education. Looking at toys is what the article complained about: you learn how to make toys.
- jacquesm 16y agoYou can't begin to understand something the size of emacs before you've taken a bunch of steps in between, and looking at 'toys' makes you understand how toys are put together as well as gives you the skills you need in order to appreciate what makes stuff tick one 'level' up from there. When I was a kid my 'toy' programs would be a few hundred lines of assembler or basic, rarely beyond that. Then the first time I hit a thousand lines (a score editing program) I realized that my old techniques didn't work any more and I discovered structured programming. This worked well for a while until the limits of organization for a single file were reached and I had to start splitting up the code in to large chunks that 'belonged' together in separate files and so on. And that's just the organizational stuff, never mind the actual code or data structures. To throw someone in on the deep end of that and saying 'Swim!' is not going to work except for a very few people that are genius level. The GGP might be one of those but for the rest of so (let's say ordinary mortals) that's not how you learn the fastest. Of course, once you're ready for a 'big' program (say 50K lines and up) it really will be a great step forward, once you've mastered to read (and work on) a program of that size it will be a huge achievement. I've never met someone that learned how to code out of the gate by studying emacs though. And don't underestimate how much you can get done with 'toy' bits of code, libraries are so easy to tap in to that a few hundred lines will go a long way if all you want to do is solve some problem. Check out some of the more involved 'R' programs that float around here for good examples of that.
- run4yourlives 16y agoDHH is saying "do" rather than "try". You can memorize every line of the emacs code base, but unless you have a problem with emacs itself that you'd like to solve, it isn't going to get you far. On the other hand, if you can't find a web-app to manage projects that works for you, and you decide to code one, you will learn much, much more.
- jrockway 16y agoI disagree. I would say I've learned about 40% of what I know about programming by typing stuff in and seeing if I like it. The other 60% I've learned by reading other people's code and stealing the techniques I like. For example, I learned C by myself when I was in middle school. The memory management technique I developed independently was "the library allocates, the application frees". No errors in valgrind, and my app works. Then I started reading other people's C code, and switched my technique to "the application allocates, the application frees". Now C is a lot easier to write! Assuming that you're the smartest person on Earth only gets you to a local maximum. To get to the global maximum, you have to interact with other people. The way you interact with programmers is with source code.
- run4yourlives 16y agoI think you've possibly hit on a fundamental difference between learning styles that people have. I've learned probably 95% of all my programming from doing. I do take issue though with the idea that the learn by doing crowd is somehow less accomplished. It smacks of baseless elitism.
- dlo 16y agoIsn't thinking that others have little to offer to you a form of elitism as well? It seems neither option is particularly humble.
- spiffytech 16y agoIt's not that others have little to offer, it's a different style of learning. Just like some people are visual or auditory learners, some are kinesthetic learners. Seeing other people's code does little for me because I miss all of the reasoning that went into it's creation. However, when I've fought through the same problem myself, I understand very thoroughly the traps, pitfalls, and solutions the task entails. When I reach this level, I can read other people's code and clearly see why they did what they did, and how it's better or worse than my method. I have to take a crack at the problem myself first, though, in order to learn well. Reading other people's code is, for me, a way to refine and reinforce my techniques, not to learn entirely new things. I learn much less effectively when I try that.
- InclinedPlane 16y agoLearning to program well is a complicated bootstrapping process. You can't start out writing full-fledged, high quality apps (because you won't have the skills), nor can you start out by reading production code (because most of it'll just go over your head).
- angrycoder 16y agoJust curious, how much bigger did it make your e-penis to type out programmers in quotation marks? At the end of the day, it takes all types to make software. Those who build the boxes, those who peer into the depths and improve or maintain the boxes, and those who use the boxes all work together to make great software.