Halvor William Sanden

CS50 and my final project

I completed Harvard’s CS50x: CS50’s Introduction to Computer Science on the last day of October 2021 and received a passing grade a couple of weeks later. It’s a course about "abstraction, algorithms, data structures, encapsulation, resource management, security, software engineering, and web programming". In addition to ten labs and problems sets along the way, there’s a final project where you can make something useful with the technology of your choice.

I made a web application that logs and calculates firewood usage.

The app, Firewood Logger #

People burning wood rely on their memory of past seasons to figure out how much wood they need in the coming season. That’s what the app aims to support by being a more accurate memory of previous seasons and providing a nice way to keep track of the current one.

The app calculates a budget and keeps track of the balance per season.

When a unit is used, it gets added to the chart. If the user has multiple seasons, the app also displays a line with the mean values of the historical data. It gives a fairly accurate indication of how this season will be, as they don’t change that much over a few years.

There’s also an administration page where the user can name the stack, delete seasons and change the password.

Scope #

It’s a simple application that tries to do fewer things rather than being everything related to firewood. I had ideas about connecting it to weather data APIs to log temperatures and make complex projections but the results wouldn’t have been much more useful or accurate.

At 3250 lines, it’s starting to get difficult to have a clear overview; I had instances where I had to read the code as if it was the first time to remember what some of the parts were doing. Any increased levels of complexity, and the time it would have taken to make would only have led to headache-inducing bloat. Instead, it’s now at a level where it’s more accurate and less buggy because it has fewer moving parts.

Stack and learning #

The project is built on Python with Flask in the backend, with a SQL database. The frontend is made with Jinja, JavaScript, HTML and CSS.

I had to dive deeper into Python than before; I had never used it in conjunction with frontend and database work. Flask was new to me, Jinja as well, but it wasn’t notably different from similar kinds of templating languages I already had experience with.

I worked extensively with form validation, from native HTML elements and JavaScript in the frontend to the Python backend. Wishing sometimes things in JavaScript were as simple as in Python and vice versa.

The app is not publicly available and will not be for the foreseeable future.

The course #

I would say CS50 is for people who have at least some experience with programming. The curve gets pretty steep. For frontend developers tired of yet another JS course, this is something different. It's also valuable if you're a developer that didn’t take the more traditional CS route.

I wanted to refresh some of what I mostly skipped through twenty years ago and hadn’t looked at in a structured manner since. I was also interested in approaching programming from a tech-centred standpoint as opposed to the user standpoint I’m familiar with.

Much of the problem sets require writing C, which I hadn’t touched before, but as programming languages go, logic is logic, it’s just different ways to express it and make it efficient. Working with C made quite a few things click in Java, which I’m touching upon from time to time.

Enjoyably difficult #

Somewhat unfamiliar areas like security and backend validation turned out to be interesting, the course is a good way to find new areas to dive into more extensively later. Working with databases has gone from a slightly scary necessity to a fun challenge. It has directly influenced how I now approach JSON structures and data sources in the frontend. Search and sorting algorithms aren’t as much fun to write as picking the right one for the right job.

The difficulty of tasks and labs were at an enjoyable level. You can choose between two levels, I chose the hardest which requires more work but is also much more fun. Most are solvable with time and pseudo-code as help. And when you get stuck, there are lots of ways to get support from the community.

There is room to use concepts repeatedly and not just learn them and move on to the next one. This provides good learning. It was also interesting to see how my writing style evolved from task to task.

I’ve started writing more pseudo-code than before, and I think the future of interface development lies in combining that with logical user stories. We just refine it until it’s actual code.

Lectures #

The lectures were excellent at unpacking and explaining various CS concepts. They were done on a theatre stage, the "audience" were present only via big screens – yet it did not feel artificial or stiff.

The backdrops, the props, the way students were included … it was refreshing to experience someone who doesn’t just do hours of monologue and spout rhetorical questions. Hats off to David Malan and the rest of the CS50 staff. Even though I have several years of higher education, this is by far the most memorable course I have taken.

It takes time #

Everyone is different and in different situations. You will not complete the course in three months if you have other things on your plate – at least twice that time is more realistic if you work at a comfortable pace.

I spent about two weeks on each of the first few lectures. As problem sets got more complex, I spent perhaps three weeks per topic. Around halfway through, where the task is to translate several of the previous problem sets to Python, things got faster. When we moved toward the frontend, I think I completed as many as three topics in one week.

The final project took two months of intensive work. I made an initial backlog with milestones and continued to feed and trim it as I progressed, basically running it as any development project.

Having an employer where education is encouraged, also during work hours, does help.

My one issue #

My issue with CS50 is something that is communicated in one of the lectures, not a big deal in itself, and probably just as a reflection of the industry in general.

HTML and CSS are at one point explicitly labelled as "not programming languages". Whether they are or not is not the issue for me, it’s the wrong thing to focus on. But labelling them as such and, what sounded to my ears as, suggesting to leave them to other people is a bit disappointing. It gives the impression that learning HTML and CSS is generally less relevant, and perhaps less valuable, than Java, Python, JavaScript and so on.

I don’t think that’s the intention, it’s probably just a clumsy attempt at useful categorisation. There’s nothing wrong with clear scoping – for some, HTML, CSS and JavaScript are not interesting to work with.

But one should be less tempted to say what is someone else’s job. Every field involved in making interfaces is guilty of this. Computer science, frontend and UI/UX all have a distance to interface-making that involves pointing at each other expecting deliveries under the guise of collaboration.

As long as we do that, making user interfaces won’t exist as a distinct field of expertise.