I’m a bit perturbed right now. I went back to Django project I hadn’t worked on in two weeks and could not get my Pycharm interpreter working properly. I’d updated from the Community Edition to the Professional Edition during that time, which I’m not sure had anything to do with it, but this failed session brings me to another source of frustration with things that I need to get off my chest.
There are 3, maybe 4 ways that one might need to interact with a Django app in Pycharm. The first, being the Python console itself. The second, the regular command terminal. Third would be the various run configurations that one can setup. And four would be the Django console that Pycharm Pro enables. My issue is that each of these has their own environment variables settings! Maybe it’s just my inexperience showing through here, but I tend to use several of these when I’m working. I have a run configuration for the test server running, then the Django console for migrations and tests, and a terminal window that’s actually running the Django shell, so that I can muck around with code while I’m figuring things out.
I don’t know if I’m an idiot or what, but it just seems extremely ineffective, and I have got to be missing something.
Last weekend I finally got around to reading Two Scoops of Django, and it was very interesting. I wish I had picked it up earlier. I think I first started really delving into the Django framework about 3 months ago or so, and I’ve really enjoyed tinkering around with the models and ORM. I’ve done a bit with the forms and views, but I’ve spent a lot more time trying to draft out some data models for various projects and get a feel for how things work. I’ve fallen into my trap of getting too caught up in tools in order to actually deliver anything yet, but I’ve got two projects that I am primarily working on. I’ve been very disciplined about spending at least an hour or more each day on one of them.
Part of me thinks I should just focus on the one at the exclusion of the other, just to focus and plow through. “Starting is easy, finishing is hard,” as Jason Calacanis says. The other voice in my head is telling me that as long as I’m pushing forward on one of them or the other, it doesn’t matter, since the skills I’m learning on each will translate to the other. The last few days have seemed like my wheels are spinning though, as it seems I spent more time sharpening my ax than I did actually cutting down trees. I spent what feels like two whole days just trying to figure out how to setup cookiecutter-django the way I wanted it, another day or two trying to figure out why pipenv doesn’t work properly in Pycharm, and then another trying to figure out how to get Celery to work. Yesterday it was all about how to properly clone a 3rd party Django app so that I can make some modifications to it. And I’ve spent hours trying to figure out how to do my tests, what needs testing and what doesn’t. Endless hours on Medium reading everything I could find related to any of the above.
But as long as I can sit down and work on something, I tell myself I’m making progress and becoming an actual developer. I’ve talked about discipline previously, and that discipline is paying off with my day job as well, whether it’s Powershell scripts, or more Python API wrappers. The hardest thing about it for me is the solitary nature of what I’m doing. Not having a team or partner with these projects is the hardest, cause it ultimately means that I have no one to bounce ideas off of in real time. Best I can hope for is to dump something out on StackExchange and hope that someone gets back to me. Most of the time, just explaining the question sufficiently enough for someone else to understand it spurs the kind of subconscious creativity that leads to a solution.
There’s been many false starts already, but I’m starting to get there.
Currently, with a fintech app I’m working on, I’m trying to determine how I expand a cryptocurrency wallet app designed for Bitcoin and other assets that use it’s RPC interface. The asset that I’m working with is a fork of a privacy coin with the un-shielded send functionalities disabled. So I’ve got to figure out the simplest method to update all the calls in this library so that they’ll use the shielded commands for this asset while retaining the existing commands for the legacy assets. So far, I’ve decided to try adding a boolean field to the currency model and add an if clause to the Celery tasks to choose between the two based on the boolean. It requires modifying code in each of the various function. While it’s simple, it seems to violate one of the core principals of Django, which is don’t repeat yourself (DRY). It seems to me that there is another way that I can add a decorator or something to each of these functions — maybe a strategy pattern — to do that bit of logic in a way that would make it easier to implement. Maybe even without having to fork the 3rd party app in the first place.
We shall see.
I’ve really gotten into programming lately. Like really started delving into in a way I haven’t done. I’ve been messing around with scripts and basic programming for some time, but I’ve never been able to complete a large project. I usually put some bits an pieces together to cobble for a function or small library, but my skills were never such that I could really put the larger pieces together. I’ve spent time looking at various libraries on GitHub or wherever, and just been floored by not only the size of the projects, but just the sheer complexity.
One thing I’ve learned over the years — not just with programming, but skills in general — is that the things that got me here aren’t necessarily the things that will get me too the next level. I’ve learned this most painfully at my current job, where the skills that enabled us to be a fairly decent small IT service shop weren’t the skills that were going to be able to scale and get us to the next level of excellence. It’s one of the main reasons that I finally decided to go back to school to finish my degree. I’ve always been self-taught, and been able to get along with whatever needs getting along, but that same self-directedness has resulted in a bit of lack of discipline in several regards.
One of the main reasons I felt like I needed to go back to school was because my projects would always get to a certain point where I wouldn’t be able to figure out how the various components should fit together. I remember thinking that I needed to learn ‘design patterns’ and that I needed the tutelage of someone who could help me understand how to put the various components together. I was always good at being able to understand the syntax and structure of a language well enough to be able to do some calculation or basic function, but being able to take that same logic and put it into the larger set of data structures and external libraries and inputs, outputs that I needed to make something work — that’s always been where I’ve hit a wall and walked away from a project for the next starting point.
I can’t say I learned a lot about design patterns per se during my college career, but what it has done is forced a lot of other things that I hadn’t considered, like test-driven development, for example. But one thing has happened in the intervening months and years that I’ve been finishing my degree — I’ve kept programming. It has become a habit — a practice — and I feel the changes in my brain, affecting how I think about problems. And things have begun falling together. I recall specifically looking at a piece of code on someone’s blog and seeing a class’s create function declared as a class function. It clicked. I’d understood the difference between class and instance-based methods for some time, but I never really understood why to use them. Same with a class passing self as a parameter to another class function. These were just two solutions to problems that I had been struggling to figure out for some time. Things are just starting to click in that way.
I’ve made a habit out of programming, and I recently found myself coming back to one of these aforementioned abandoned projects. Looking at it now with the benefit of a year and a half of additional skills, I’m not so overwhelmed, and I’m thinking I know enough to take it a little further to the point where it will actually work.