The bumpy road to a killer app

As the vehicle known as my brain continues its bumpy ride on the twisting, turning, hilly road to Python knowledge, I see how the vehicle itself can be as challenging to navigate as the road. I have come to the conclusion that learning how to learn is as important as learning itself. At times trying to figure out a coherent learning process is itself even more difficult than the subject I’m trying to learn. Case in point: how to design a coherent, efficient Python application, when I’m still trying to figure out how best to use the parts that make up such an application.

I’m only beginning to understand how to group related code into classes. I want to design my app right from the ground up, yet I don’t believe I know everything I need to know in order to do that. Each chunk of code starts off as an experiment. I start off with an example, say, a Tkinter widget from a tutorial. I copy and paste the example code into my app and tweak it and test it until the widget (for example, a listbox) does (mostly) what I want. I then move on to the next widget. Yes, I know all about unit tests, but how will I know how to write a test for something that I don’t even yet know how it works? If I don’t fully understand how to make my code properly modular, I’m not going to know how the pieces fit into the whole until I go through some trial and error.

Before I know it, my code is piling up into one huge file. It’s ugly, It’s confusing to look at. PEP 8 is weeping and PyCharm is wagging its finger at me reproachfully. But..the code works! I say to myself, “This is is ugly and confusing to look at. There’s a lot of repetitive stuff. I should re-arrange this into classes, or at least put the functions into some kind of order, other than the order in which I was able to successfully Google the way to make them work.” So I cut, copy, paste, re-arrange, and the code looks a lot better, but…I broke stuff. So I think, well forget this mess. I’ve learned so much since I started I can see how this whole thing is wrong from the ground up. Let me start over with a whole new code file. So, I start copying and pasting chunks of code into a new file, but so much of it is the same I wonder why I’m complicating things by creating a whole new file for stuff that’s mostly the same as the old one.

For the better part of two days I nearly tore out (what’s left of) my hair trying to figure out why the function I wrote to update the contents of a list box could no longer find the list box, no matter what order I put my “defs” in. Answer: I’d put the box and the function into a class, but left off the “self.*” in front of them. Now my class has more “selfies” than a pair of lovestruck teenagers on Facebook, but now at least I have the satisfaction of having done the code right, and far fewer squiggly lines and harsh-colored alerts from PyCharm.

By the way, I still like PyCharm. It’s like a pain-in-the-butt accountant at tax time, pestering me to get everything documented, every receipt in order, every pay stub lined up just right, punctuating his admonishments with dire warnings of the consequences of an IRS audit. I complain and grumble at first, yet once the IRS refund check arrives I tell all my friends about my wonderful CPA.

Since I completed DataTools (formerly “CsvChamp”), I have felt bogged down and directionless. Scenarios like the above will come, but to get past them I now believe I need a specific goal to strive for, some kind of “killer app” that will keep me engaged and focused and excited enough to push through the bumpy areas of the road. As I’ve shared before, I’ve wanted to design some kind of data-centric GUI based application. I think it’s time for some fresh inspiration in that direction.