The Perfect Weekend-Project, or You Should Build a Blog

2023-05-12

You should build a blog.

After years of tinkering with this site, swapping out frameworks and eventually building my own, I think I’ve come to the conclusion that building a blog is the best way to learn a new programming language - or refresh your understanding on what you already know. It’s a project just large enough to push the beginner out their comfort zone and straight forward enough that it serves as a quick reality check for the more experienced.

For one, a blog is simple. You certainly could architect a JSX-powered database-backed system with global CDNs informed by behavioural analytics to target growth and user retention - or you could build something that puts HTML on a screen. Here, I’ll focus on the latter.

A blog is, and arguably should, be simple. I have never revisited someones blog just to admire their fancy animations or elegant colour scheme; no, I want to read their blog. This should serve as the starting point and continual focus while building a blog: putting words on a page.

And putting words on a page shouldn’t be difficult. Few choose to write their blogs by hand in HTML, many, myself included, do it in Markdown. But taking that Markdown and converting it to HTML doesn’t have be to a challenge either. You don’t have to write a converter to handle taking Markdown and turning it into HTML. I don’t; I let Pandoc handle that. It’s everything surrounding generating your pages that you need to build - and a lot of these features grow quite naturally with the ability to declare the project done at any point.

Let’s walk through the thinking process of building a blog from scratch:

My site can generate blog posts but it isn’t very useful if there’s no way to see what posts are available - time to build something to generate a list of posts.

But just showing posts in any order isn’t particularly useful - time to figure out how to parse and validate dates.

But it isn’t fair on visitors bandwidth to have dozens of megabytes downloaded on every page load - time to learn how to optimise HTML and CSS and learn to use JavaScript with restraint.

But there’s also all these newlines and blank spaces that take up precious bandwidth but don’t actually effect the finished page - time to learn how to compress your files.

But not everyone is going to keep visiting your site to check if there’s anything new - time to delve into RSS.

At every step of this process, you’re getting to explore your chosen programming language in new ways along with developing broader skills as a developer. Generating a list of blog posts requires you to think about how you can efficiently iterate over files. Figuring out how to show those blog posts in order requires thinking through how you parse and validate dates. Reducing the size of your pages helps you understand how to write more performant and tidier code. Building an RSS generator also serves as an excellent final test, requiring you to put together a single tool that iterates over files, figures out their order, captures your blog post for distribution, and puts it together in a format that, thanks to XML, does not allow any error.

That list of sub tasks that go into building a blog might seem daunting but actually it’s the kind of thing that could be reasonably put together in a weekend. If you’re wanting a project that is just challenging enough to get to grips with a new programming language, building a blog might be the best option.

And once you’re finished with that, ideas for what comes next are also abundant. If you’re using some converter to generate the HTML for your site, why not explore writing your own converter? Putting together images to use for OpenGraph? What if those were generated programatically? Or if you don’t want to only announce new posts via RSS, why not explore integrating APIs to post every time there’s something new?

And once that’s all done and you stare at the site that you build from scratch with your own tools, you can tell everyone about it in your first post.