By Alex Allain
Some of the most important lessons I learned in college came from one professor, Michael Mitzenmacher. Now,this was a guy with a lot of papers to his name, tenured at Harvard,working on some pretty darn complicated computer science theory (I took hisalgorithms class). So you'd expect that I'd learn something important. But asit turned out, the biggest lessons I learned from him weren't on the topics hetaught. I learned a secret that helped me learn much more effectively.At one point when describing the problem sets in the class, he gave some advice that stuck with me:
Don't suffer from Math Major syndrome
So, what you ask, is Math Major syndrome? Well, think of it thisway--if you are studying a hard problem, what's your first tendency? To getlost in thought? To start at it, mulling over ideas in your head, waiting fora flash of insight? If so, that's math major syndrome. It's the idea that youcan (or have to) solve problems entirely through a brilliant flash of insight,without doing any actual work.
The alternative is quite simple:
Hard problems become easier by working through them with diagrams, effort and patience
In other words, don't just wait for answers to come to you--go out and findthem. Don't just use what's in your head--use paper, or the computer, or awhiteboard, to draw out the ideas, try experiments, make the patternsvisible rather than waiting for a flash of insight.
I remember really learning this lesson during the first problem set--I'dstarted it when it was handed out, but the night before it was due I still hadone problem left. I spent hours on that problem, but I spent it drawing outequations, working through possibilities. Each one ended in failure, until Ihad a flash of insight in the middle of writing out an equation. If I hadn'tworked through (and discarded) all those possibilities, I'd have had no hope ofsolving that problem.
So how do you apply this principle in practice?Program Program ProgramIf you're learning to program, you should be programming. Work practice problems while youread tutorials--in fact,you're probably better off in most cases working practice problems thanyou are reading about programming. (You will need to read, but withoutpractice, that reading means nothing.)
In fact, if you're just learning to program, then I suggest that you stopreading this article right now and go write some code (or get yourselfset up with a compiler andthen go write some code). But not something you know how to solve--try towrite a program that is just a little bit scary or hard. You should feel justa bit scared that you won't be able to do it.Draw it OutA second corollary to the principle is that you're better off using paper thantrying to imagine everything. In fact, I can't say enough about the importanceof drawing diagrams. A lot of things in programming sound very abstract ordifficult to describe in words, but they can be quickly shown with a picture.Computer memory, for example, can be thought of as a long block of cells(almost like in an Excel spreadsheet). Drawing out each piece of memory inyour program (when dealing with pointers or data structures) can really helpvisualize what is going on. You can also write out recursion manually byshowing each recursive call with its arguments and return value.
But even simpler concepts become clear when you draw them or work through themstep by step--having trouble understanding a complex piece of code? Write outthe different variables and how they are modified. For example, the booleanexpression ! a
View the Original article
Нема коментара:
Постави коментар