I tried writing a couple of updates for my blog as I worked on my 2019 learning project, but once I'd written them they didn't seem worth sharing; there just wasn't a lot worth saying about the process. Now that I'm done, I wanted to share a few thoughts on how it went.
But first, a quick recap:
I wanted to try learning something new while I was on a break from work over the holidays. I decided to focus on web development, so my learning project consisted of:
- A reading list of articles and tutorials about HTTP, SSH, networking, and Linux/the command line
- A tiny web app to build with Python and Django
The reading list went fairly well, and I learned some context for things I already knew about using the command line, plus a bunch more that I didn't know, a lot of basics about HTTP that were helpful, and a little bit about how networking and wireless signals work. I dipped in and out of the reading list depending on how I felt, but it was a good amount to get done across two weeks without it consuming all my time.
For the practical part of the project, I started by working through the tutorial in the Django docs. The tutorial is well-written and easy to follow, and I felt following it exactly gave me a good introduction to how things work in Django, while picking up some Python syntax along the way.
After that I read through a couple more tutorials, as I found going over the same concepts with different sources (this applies to my reading list, as well) often helped me understand them better, as they were repeated in different words, or different authors shared different analogies for understanding concepts, and a particular one would help the idea click in my brain.
I hadn't started my holidays yet, but was getting a head-start on familiarising myself with Django. I made another project to sync data from Trakt and Toshl to Exist. This project helped me practice the following:
- Working with APIs
- Creating models and migrations
- Creating Django management commands and running them from the command line
- Creating a cron to repeat my management commands automatically
- Working with dates and datetimes
- Setting up a new Django project
As I worked through setting up this project, I created a long text file full of all the steps required to set up a new Django project. I used tutorials I'd already followed, some new tutorials, the files I already had in other projects like the original Django tutorial I worked through, and my command line history to piece together everything I needed to do. Since then, I've found this text file invaluable for helping me remember all the steps for getting started, such as installing Django, installing MySQL, changing my database settings, creating initial models and applying migrations, setting up the Django admin, and creating a superuser so I can log in to the admin.
When it was time to actually go on holiday, I had a tiny web app idea in mind that I wanted to complete over the next two weeks. I called it "Meals", and it simply listed different meals I knew how to cook, and let me filter them by category (e.g. dinner, lunch, snack) and tags (e.g. "salad", "pasta", "fruit").
Working with my step-by-step list, I was able to get the project started fairly easily. This project gave me a chance to practice:
- Creating another project from scratch
- Models and migrations, including many-to-many foreign keys
- The Model-View-Template structure of Django projects
- Django model queries and filters
- Django template filters
- Matching URL patterns with Django and passing parameters to URLs
I also dipped my toes into Bootstrap for this project, because I wanted to show the categories and tags in a sidebar next to the list of meals, and I found that getting a very basic two-column layout working with Bootstrap was actually really easy.
I wanted to get this app up on a server by the time this project was complete, but because it's going to live on a server Josh already runs instead of my own, I need to leave that part to him. I also need to add authorisation handling before I can run it on a live server, but because I didn't include that in the original to-do list for the project, I keep forgetting to get it done. So there's still a bit of work outstanding.
So what did I learn?
There's a lot to web development. Having worked through a few new projects now, and with my checklist to refer to, I'm confident creating new projects and getting all the pieces up-and-running. But beyond that there's way too much that I don't know for me to have any confidence about building new stuff for the web right now. Almost any ideas I might have, I wouldn't know how to implement. Which is always the way when you try out a new platform, I suppose. I felt the same way about Android when I first tried it after years of iOS development, and it's a frustrating feeling.
Having said that, I won't get past that feeling without practice. I think my next steps need to be to just keep exposing myself to more web development until I know a lot of the basics and can feel more confident making my ideas real.
Another interesting thing I've noticed: I put off learning web development this long because I never had ideas for web apps that I really wanted to build. I tried to learn programming in Python and Ruby before I tried iOS, and part of the reason iOS stuck and the others didn't was because I was full of ideas for cool iPhone apps I wanted to make.
But since I've started this learning project, I've been having more ideas for web apps. I already have another project I'm keen to make, though I want to wait until I'm a bit more confident about bringing it to life. I think this fits well with how I've always found writing to work as well: doing the work begets ideas. The ideas will flow after you start taking action, not before.
This is really difficult advice to follow through on when you have zero ideas or inspiration. Especially for programming, where I always find having a specific project I care about and want to create is the absolute best motivation for working through the tough parts of learning something new. But, at least for me, if I can come up with an idea that's just motivating enough to get me going, all that experience with new-to-me platforms and technologies is bound to encourage new ideas to form.
I think Josh was expecting me to have more to say specifically about learning Python and Django, but to be honest, I don't have a lot of thoughts on that. I've been using GRDB in my iOS projects recently, which is a Swift wrapper around SQlite. It forced me to learn about database stuff like migrations, rows and tables, and queries. Though I found it all quite confusing and difficult at first, after getting much more familiar with GRDB, it wasn't too big a leap to use Django.
Getting my head around how
views.py is actually full of logic code, rather than UI code, and templates are where all the UI is handled took a while, just because the word "view" doesn't equate to "logic" in my head. And I find it easy to trip up on figuring out where certain variables come from, because you don't always see where things are passed around in Django; you just put things in the right places, and later you can rely on them being there. For example, in a template, there's no list anywhere of what variables are passed in—you have to go check in your
views.py file to see what's being passed to the template. That's quite different to working with view controllers on iOS, where the initialiser shows you exactly what you have to work with (I don't ever use IB/Storyboards, so maybe this would be less foreign to someone who doesn't write all their layout in code).
Oh, that reminds me: I really hate how Python is dynamic. I get that there are benefits to dynamic languages, but it drives me crazy coming from Swift. It's probably the only thing I find super uncomfortable about this whole process. Everything else I got used to fairly quickly, even if I didn't love the way it worked.
So what's next?
I'd like to keep putting time into web development on weekends, to increase my knowledge and experience, and to build out some of the ideas I have. I also haven't played with creating my own REST API yet, and that's something I'd like to try in future, so I can build something on the web with an iOS app component, too.
Cramming lots of Django and Python experience into the last few weeks made for a good introduction, but from now on I expect it'll be a slower growth process as I tinker and learn throughout 2020.
P.S. I make some stuff you might like: Exist, a personal analytics app to help you understand your life, Larder, a bookmarking app for developers, and Changemap, a roadmap and changelog for transparent teams.