Thinking through

Well, that took some time.

One of the things that I estimate takes up about 90% of my time when coding is the process of just thinking about what to do, or rather whether what I’m doing is the “best way possible”. And inevitably once I do “accomplish” something, I look back on it and say, “This took me that long to do? Hmm.”

I would say that in general, I have the sort of mindset that, given enough time, it should be possible to get though any problem, as it’s just be a matter of:

  1. Stating the problem.
  2. Figuring out what is needed to tackle it.
  3. Choosing the tool(s).
  4. Solving the problem.

…Well it’s never that simple, but generally I find that I can get through something a lot easier if I just understand, in a complete sense, what the problem is talking about. From there, I can then take out my AST, or use such and such pattern to accomplish that task. If I do see something that I don’t know about, I look up the concept behind it, and try to understand it as simply and completely as possible, so that when I need it, it comes to me (or I can re-derive it in case I forget).

For example, take the discrete Fourier transform:

DFT

Mhm… I know some of these words

Now I’ve seen DFT libraries before and could’ve just used one of those but hey, I like to reimplement things to understand them so why not. As the caption implies, I did indeed know some of it but not the whole thing – not in the sense of “I know what this does”, but in the sense of “what do each of these individual parts mean, and how do they fit into the equation as a whole”. In terms of math, I’d say that I do have some experience with high-level concepts, but when I don’t get the chance to use them, I forget the techniques (one reason why I had to relearn all the good things about matrices when practicing graphics programming).

So, I ended up at Better Explained, which has a page specifically on the Fourier transform explaining all that good stuff up there – about Euler’s formula, about a way to think about it that doesn’t involve memorizing the problem, etc. And once I was done reading through the thing I felt like I could implement this by putting the function in a different format, or use one of the many optimizations available for it. Such is the power of knowing something completely.

Of course, not everything comes in a neatly packaged, ready made page like that. In that case, it can be frustrating to try and find something that has, say, no documentation, or something where the concepts are all textbook style and any greater insight has to be figured out by yourself. In those cases you’d probably have to resort to the human trick of finding patterns in what you are learning – mnemonics, analogies, you name it. Or you could be that one guy who:

  • Loves that specific subject
  • Has the knowledge to draw useful analogies between complicated concepts and easy to understand ones
  • Has the patience to write about it/make a video about it/make a neat GIF about it
  • Has the sense to make it interesting

If you are that guy, you are the best. If not, no biggie. In any case, either you find you way, or you stumble through whatever you’re doing in a half daze, copy-pasting that stackoverflow answer you saw – the top-voted comment should be good enough. Either that, or you download the complex library and use the function DFT(Complex* arr, int direction). And you’d better hope that you’ve understood what you’ve copied/used, or else the Bug Fairy will leave runtime errors under your pillow.

Advertisements
Posted in Uncategorized

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: