Thursday, October 8, 2009

Coding Frustration

First, the reason I posted this is because I can't actually comment on the post by Jeff Atwood here:
Coding Horror

What I would like to comment on as well is finding your bugs, or not even so much as bugs as problems in your pseudocode. I'll be the first to admit that more often then not I would rather sit down with the idea in my head and just code it up, and to be honest at this point in my programming career I have been able to do that quite easily. The problem comes when you start hitting harder and harder blocks of code that you need to build and generate.

I know there's been a few times I've been banging my head on a wall trying to get a particular piece of code to work. When I finally have "given up" and go to another engineer to explain the problem, MID SENTENCE I stop and say "wow I'm retarded" followed by, there is the problem, and most of the time the other engineer didn't even get a chance to say something.

What does that tell you? Recall that sometimes learning things requires more then once sense? I have found that occasionally hearing the pseudo code that I've written can often times improve my understanding of the problem I'm trying to solve, or even the implementation I'm using to solve it.

In fact, sometimes even attempting to blog about the problem brings about different ways of looking at the problem, take a look at my problem where I wanted to grab filenames from selected files!

Windows Selected File Names pt I Posted: Thursday May 28th
Here my solution was to take any particular selected file and simply append it to the clipboard. The problem with this one is it ran the script the same number of times that there were files, this isn't a very efficient way to solve this.


Windows Selected File Names pt II Posted: June 8th
Here my solution required a "copy" to the clipboard, then right clicking on one file and running the script. I still believe there are too many steps, but it's more efficient (I suppose for smaller files but larger sets) to simply copy the file to the clipboard then using the clipboard contents extract the filenames from the path.


Windows Selected File Names pt III
Someday I would like to have a pt III that shows how to use the "currently selected items" that I KNOW has to exist in windows and simply right click and that will determine the filenames, in my opinion that will be the best way to do it.


I had been mulling part 1 over for a while, and finally when I got a working solution, I wrote it up, and not 11 days later I managed to find another (and better IMHO) solution and get it working.

Give it a try next time youre having problems debugging or finding a good algorithm, use another sense.

Let me know how it works out!

No comments:

Post a Comment