The next step….

Ever since I discovered Python in 2013, I have been coding in my own little world, mostly trying out ill-fated grandiose ideas that were light-years ahead of my capabilities.  It was if I could “graduate” from Codecademy, then just Google and Stack Overflow my way to writing a financial management application!  I struggled to figure out to learn the most I could about the capabilities of Python and simultaneously bring my complex ideas to life. In the past year I’ve come to realize I haven’t progressed very far in learning Python beyond what it can do for my simple little text importing needs.  Until recently, I had no idea what to do next.

Enter the “Code Challengers!”

It seems to me that in the past couple of years, several sites have sprung up to not just teach coding, but give learners a chance to practice, with the encouragement of both fellow learners and experts in an online community.   I’ve checked out Codewars, Codefights, and Freecodecamp and am impressed with the positive, uplifting “vibe” of these communities.  These brought to my attention a missing ingredient in my learning:  connecting with other people who on the same journey as me, so I may have opportunities to both receive and give help and encouragement.  This, of course, includes being willing to share my code with others and accept criticism — a critical component in learning anything.

Why has it taken me so long to take this step?  One word: Fear.

I follow some Python developers on Twitter, and many of their tweets might as well be in Chinese to me, given my ability to understand them.

I look back on all these years I’ve been dabbling in Python in my (limited) free time, and my code still looks to me like the Python equivalent of a toddler’s crayon drawings. All it does is push text around!  I couldn’t imagine anyone on, say, Stack Overflow or Reddit giving me the time of day.

Yet as 2018 progressed, I kept nagging myself:  “You gotta get your code out there!  Show it to people!  Get feedback!  You’ll never get anywhere..remember those articles you’ve read about how coders can’t just be great programmers, they must also know how to communicate and work with others effectively?”

Finally, on June 26, I took a major step forward in my Python adventure:  I posted the latest incarnation of my CSV file reader on GitHub, Tweeted a link to it, and asked for feedback.

I expected a few polite “likes”, maybe a comment or two like “well, it’s a start..good luck…”.

Instead, I received an invitation to join the PyBites Slack community, and share my code there, which I did.

Within an hour, it generated a whole new discussion thread, in which I received a lot of positive feedback and gratitude for sharing.  It was a fresh boost of inspiration to push forward with my “Py Ed”, even reviving my hope of coding as a profession some day.

Many thanks, Bob and Julian.


A recap of the adventure so far

Since it’s been so long since I’ve posted, here’s a recap of all the twists, turns and detours of my Python Adventure so far….

It all began in the summer of 2013 with a Codecademy Python course.

I read that web development is an important and possibly profitable skill to learn, so I tried a tutorial  but found it to be just a little over my head. After deciding to learn desktop GUI building, an attempt to complete an RSS reader project taught me how to cope with and learn from unexpected problems in coding. Then along came my grandiose idea of designing my own Microsoft Access-like application for managing my finances, using SQLite and a Python GUI, not stopping to ask myself why, if web development was over my head, coming up with my own graphical database app was not.

Soon, real-world responsibilities intruded into my Python adventure, so I took a detour to learn how to use Python to wrestle text data into Microsoft Access at my job.  To further hone my practical skills, I worked on the Real Python course , learned about GitHub and virtual environments, started using PyCharm on a Linux virtual machine as my development setup, and committed to Python 3 over Python 2. Soon, along came a quick look at unit testing courtesy of Dive Into Python.

I wrestled with the learning much time should I spend improving my existing code as I learn how to accomplish tasks more cleanly and efficiently, versus learning new things? Inspired by a little Tkinter-based contact database I ran across, I thought up what I thought was a simple yet powerful idea for my own Access-like graphical database. I learned about imports and how to set a location for Python to look for modules to import , then came a detour to brush up on my SQL knowledge. After much work, I found Tkinter to be frustrating to use for table-like GUI objects, so I switched to Pyside Qt for my GUI. The necessity of actually tracking my finances while waiting to finish my Python GUI app for tracking my finances led me to put my financial data into LibreOffice Base because it was open source, available, and quick, though with some annoying drawbacks.

Months went by.  I then came to realize it didn’t make much sense to spend so much time, in effect, trying to re-invent Microsoft Access, so I decided to give web development another try, with the Real Python web development course but it soon fell by the wayside because what I was learning, though fascinating, was time consuming and not of immediate practical use to me.

In April 2017, I discovered GnuCash, a professional-quality, well-established, open source financial management tool, in the same class as Quickbooks.  This was a fantastic discovery for my finances, as it made tracking income, expenses and bank accounts a breeze.  On the other hand, it was the final nail in the coffin of the central quest chronicled in My Python Adventure: my own financial management application.  It was also the end my of emphasis on learning experiences over practicality.  As is obvious from reading through this blog, there are simply too many demands on my time for me to be able to devote the necessary hours to learning how to build applications that have already been built, and way better than my present skills could achieve.  Going forward, my Python projects will be smaller, simpler and useful to me personally.  I believe this philosophy will prove the best way to keep me inspired and growing in my skill level, and holds out the best hope of providing me the building blocks for something greater in the future.

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.

Thank you. Danke. dziękuję. спасибо. धन्यवाद. Merci. Dank u. Gracias.

2014-02-17 MPA countriesAs you all can see, the title of this blog is “Thank you” in the native languages of the top ten countries in which this blog’s viewers live. That’s because I am thankful for every one of you. Really.

This blog has only existed for a month, yet the response I have received from it has been far beyond what I expected in such a short time. I am truly amazed. I’m sure part of this is the fact that I’m an old-timer who still remembers a world without the Internet, so perhaps there’s a sense of childlike wonder in me that still hasn’t died. Actually, I hope it doesn’t.

No thank you would be complete without a huge shout out to the Google+ Python community, to which I owe most, if not all of my viewership. My appreciation of Google+ has grown alongside my Python learning, to the point where the days when I scoffed at it as just another Facebook wannabe are long over. It has been a joy to find instant, international communities of people who share my interests and whose courtesy and sociability seem to be above average when it comes to internet conversations.

Finally, I want to close off this one-month anniversary post by again thanking those who are listed to the right in the ever-growing “Friends, Helpers and Inspiration” section. I wouldn’t have come this far without you.

Thank you for sharing in the adventure.

A Snake, a Rodent and an Epiphany

A month or so ago I saw this RSS reader project at Mouse vs. Python. It was the first GUI-based Python tutorial program I ran across that had a real-world (though simple) use. I guess I’m still fascinated by actually being able to program and code a graphical interface. Yes, I’m used to Microsoft Access and VBA, but that’s still a graphical piece of software being used to build graphical objects. With Python, I can sit in front of a dark, boring command-prompt window, enter some monospaced, arcane spells in Tkinter, wxPython, or what have you, and conjure up colorful windows and widgets like a sorcerer. I’ve been eager to partake of this magic since cranking out my first post-Code Academy project (a.k.a., the Python equivalent of “See Jack Run”, literally), and here was a chance to see a “real” Python based GUI app in action, and study and tinker with its code. Therefore, once I saw this, I couldn’t wait to get in front of my laptop and take it for a spin.

Little did I know a coding epiphany was on the way. Actually, two.

As can be seen from Mike’s code, this app requires a add-on toolkit called “feedparser.” I had a devilish time getting that thing to function. It seemed to install OK, using “easy install”, yet it stumbled over the “import” statement, giving me an error along the lines of “line 154 – no module named request.” I don’t remember it exactly, and since I didn’t know then I’d be writing about the experience, didn’t save the exact error message.

Regardless, like a good coding newbie, I didn’t panic and cry for help…I Googled it first. Well, as I recall, the only hit that even seemed to approximate my situation was a Python forum in Chinese. Dauntless, I ran it through Google Translate and did my best to decipher the somewhat broken English it spat out. Still no help. I started to get frustrated. All I wanted to do was try this cool RSS app, and here I was, spending most of a day on an uncooperative dependency that was tripping up the code on its very first line. “This isn’t what I planned!”, I growled to myself.

Exactly. Because that, folks, is what I realized is a major part of a coder’s life: confronting and solving unexpected problems, and learning (even against my will) in the process. Sometimes my biggest coding project will be something unexpected that interrupts the project I’m really excited about, and I will have to digress.

I realized that if I can’t handle such digressions, then I won’t be able to handle being a coder.

And guess what? I handled it.

You see, I recalled that there was another popular method for installing Python packages: something called “pip”, which one of my earlier tutorials had told me I needed, and therefore, I had installed it.  So, just for kicks, I went to my command prompt and typed: “pip install feedparser.”

That did it! Now the code was off and running, and a great big RSS reader GUI window materialized before my eyes! All I had to do was click the “Get Feed button…”

Crash. Another error. Now the code told me it needed an object called “RSS”, which was not defined. So, I searched and searched through the code, and couldn’t find it. I tried lowercasing “RSS” in the offending statement, and other random, clueless thrashing about, to no avail. Alas, I was beaten. So I broke down. I asked Mike for help.

He was kind and patient, suggesting I re-check the code I’d copied and pasted from his blog. And there, lo and behold, was an entire chunk…the ‘RSS’ class definition..that I had neglected to copy and paste! I’d probably let my cursor get ahead of my scroll wheel, or something like that. I pasted it in, and..eureka! There was the RSS article list and summary on my left, and a glorious in-app web browser in the big window on the right! I did it! I’m magic! (or, at least, I was able to get Mike’s magic to obey a wizardly newcomer).

So, here was the second epiphany: sometimes, after giving a challenge my best effort, I need to know when to humble myself and get help. Thankfully, in the Python world, there are plenty who are ready to do so.

How the adventure began..

A regret that has haunted my adult life off and on is not majoring in computer science when I was a college student ( a longer time ago than I care to admit).  I took my first computer programming class when I was in middle school and loved it, but as a college kid, the word “hard” followed by “work” was not in my vocabulary.  If an endeavor did not come instantly and naturally easy to me, and stay easy, then I’d conclude it was not for me. In other words, I was lazy. A computer science degree required calculus, a class which I tried for two weeks in my sophomore year, then promptly dropped because it scared me so much.  And that was the end of any formal pursuit of a technical career. Nevertheless, as the years went by and I found myself drawn to using various available software tools to manage data at my workplaces, I started to feel like there was a frustrated techie stuffed inside the average Joe Office Guy I’d become.

Sometime last summer (2013), I ran across some articles about the explosion in the need for programmers, especially for web development, and a corresponding rise in the availability of free online resources to learn programming.  Suddenly that old youthful enthusiasm for telling computers what to do sprang back up.  Through these articles, I found Code Academy and promptly jumped right in to their Web Fundamentals and Python tracks.  It’s great for beginners because the lessons, writing the code and running it are all self-contained on the site.  The user doesn’t even need to install Python on their PC.  It’s also a good way to figure out if coding is really for you, without too much sweat.  If you come away from a Codeacademy course excited and wanting more, as I did, then great!  If you come away “meh”, then at least you haven’t wasted too much time.

Thanks to Code Academy, I was able to develop my very first app: a little program that calculates a runner’s pace and average miles per hour, and stores a run history in a database.   Of course it will never compete with Runtastic (the app I use on my mobile phone to track my running), but at least it allows me to show off the fact that I learned something.