How to Code: Simple Data
This course was next up after the math prerequisites. A large chunk of this course involved information that was completely new to me, which on one hand was a bit surprising given my existing technical background, but on the other hand I had never done any real work with functional programming. Object-oriented programming and Java were the standard when I was in college the first time.
After taking this course, I think I understand some of the hype behind functional programming. There is a certain elegance about it, and at least for me, recursive functions are kind of magical. That feeling hasn't worn off too much even as I work through the next course (How to Code: Complex Data).
This course also revealed (and helped correct) some poor development habits that had crept in over the years:
Make sure the problem is well-defined
I don't do this all the time, but when I program I have a tendency to just sit down and start working on the problem at hand, without much effort to plan things out first. Consequently, I often end up rewriting things from scratch and changing design decisions frequently as I go. I know that this is not the optimal way to do it, but things usually work out.
This course, like any good instructional course, emphasizes the opposite. Before you write code, you need to ask questions like: What is the problem I am trying to solve? What specific` things does this function need to do? What constants do I need? What is the function changing? Should I sketch out the flow of the program first?
These are basic concepts when tackling any problem. They are not unique to programming. I try to plan well in all areas of my personal and work life - and yet, I had become undisciplined in this specific area. As I solved the small, relatively simple problems in this course, I was reminded that proper planning goes a long way. It's hard to describe how important this is unless you've experienced the boost in productivity for yourself.
Write good tests, and write them first
I've done a little bit of work with testing frameworks over the years, but this course forces you to write tests before your functions are written. This was extremely helpful in two ways (there are probably more ways but these were the most obvious to me):
- It makes writing the function easier because you have a clearer idea of what you want the function to do
- It's easier to catch bugs and unexpected behavior if you make changes in the future.
Bias to simpler functions
When I say "simple" I mean it as the opposite of "complex". A single function should not try to do too much. Functions that only do a few things are preferable to functions that try to do a bunch of things in one place. Simpler functions are, in general, easier to write, maintain, and understand.
I will sometimes write functions that are big, long, sprawling messes and leave them that way. This course helped remind me that it is a good idea to not do that.
Study habits and routine
- Study a minimum of 15 hours every week
- Work through one course at a time, and definitely no more than two at a time.
- Actively participate in the Discord community.
I struggled with this one the last few months. There was a period of about 20 days in November where I didn't work on OSSU at all. I took a week off around Thanksgiving when I was out of state with family, but for over a month after we got back at least one person in my immediate family was sick. I personally got sick three times between late November and early January, one of which was with whatever variant of COVID is going around.
We've got two young kids, one of which is in school, and the weather was changing so on one hand this is kind of expected, but on the other hand three times in a month is a lot. After I got sick the first time, I fell off track with my sleeping and exercise habits. I think this may have played a part in weakening my immune system. I'm back on track now and I've also started to implement some of the habits I learned in these Huberman Lab podcasts:
It took me over two months to complete How to Code: Simple Data. This is far too slow a pace. My pace has been better since I started How to Code: Complex Data, but I'm really going need to drive forward harder if I want to complete OSSU in two years.
One course at a time
No problems with this one, as you might expect. I struggled to complete a single course in two months, so I'm not really feeling tempted to add more courses to my workload.
Participate in the Discord community
The weekly check-ins for the UTC Night cohort have been text-only for a while, which is kind of disappointing, but I'm not sure I would have attended voice chats much either. There's been a push recently for more voice chat check-ins, and I'd like to do better about attending them.
That said, I have been a bit more active on Discord than when I was taking the math prerequisites. It is a legitimately helpful place for getting your questions answered. I even answered a question or two myself, which gave me a nice feeling of validation after taking so long to complete How to Code: Simple Data.
As I write this, I'm working steadily through the next course: How to Code: Complex Data. I am progressing at a decent pace and am really enjoying the course so far. All the (frankly annoying) work you put in to get disciplined about function signatures, type comments, etc in HtC: Simple Data really pays off in this course.
I missed a few months of blogging (this post was due in November), but I'm hopeful that things are back on track now.