Live data from Hacker News

Writing toy software is a joy

blog.jsbarretto.com

101–110 of 318 posts

Re: Writing toy software is a joy

#101
I'm surprised by the number of bad takes on LLMs in this thread.

LLMs spoon-feed you with information about how things are implemented. You are not supposed to know how everything works when you start these projects. You're supposed to try your best, inevitably fail, then research the topic and understand where you went wrong, then adjust your approach. If you know how everything works and just follow the tutorial, you won't know what makes other methods fail, and by proxy what makes the one you chose work.

Write a language parser with a regex. Find out that it can't parse recursive statements. You've now learnt that regex can only parse a specific subset of syntaxes. Try to workaround this by pattern-matching the most nested statement first. Find out that it blows up performance. You now know more about time complexity and know what to watch out for when you write a real parser.

Write a non-optimizing compiler from scratch. Find out that you can't make do with unsound optimizations because you can't keep track of what optimizations are applied where. Find out that implementing sound optimizations is hard because you need to track use-def chains. Then you'll understand why SSA is used. Find out that code motion is a mess. Learn about sea of nodes. Merge every optimization pass into one because you're unable to order passes right. Learn how e-graphs solve this.

Write a layout engine. Get stuck on being unable to define what a "width" is. Workaround this with min/max/natural widths, introduce binary search, etc. Learn how this stuff works in practice (this is something I haven't personally done yet).

They say we learn from mistakes. Please don't let the smart (or "smart", depending on how you look at it) machine stop you from making them. It's not a teacher and it doesn't know how to educate.

Re: Writing toy software is a joy

#102
post #3

Toy Software is a lot like working on your bike/car/boat/whatever. Working on your bike is fun. Working on the bike you need to ride to work tomorrow is stressful. I miss writing toy software. It’s fun. But inevitably I want to use said software and that’s where the trouble starts. You find all the bugs and none of the time to fix them.

This is why I love building a personal website. It's like a live playground.

Re: Writing toy software is a joy

#103
post #39

> Perhaps you’re a user of LLMs. I get it, they’re neat tools. They’re useful for certain kinds of learning. But I might suggest resisting the temptation to use them for projects like this. Knowledge is not supposed to be fed to you on a plate Am I the only one using LLMs as if they were a search engine? So before LLMs I was searching on Google things like "pros cons mysql mongodb". I would read the official document…

I think one of the major issues I (and others) have with LLM's as search is they are heavily biased towards outdated data. The other day I was trying to have it get me the most updated versions of X, X, X from an old project. I tried several providers and all of them without exception gave me an "upgrade" to an older version than was in the project for at least 1 item(by years). I'm sure they are choosing LTS releases over the new ones because that is most popular overall in a dataset. However no matter how "hard" I prompt they keep giving me those old ones over "latest"

Re: Writing toy software is a joy

#104
post #56

Earlier quoted context omitted.

How are you supposed to learn to invent new things if you don't know how existing things work?

There's ZERO room for innovation in the projects suggested. Wanna do some creative thinking? Read some books, learn how normal people think. Explore latest datasets. That's where the meat is. 98% of what you read online has been written by super uncreative(boring) people. They have no imagination whatsoever, IQ is well statistically speaking not too flattering. Internet is ran by the bottom. It's slop by the bottom,…

Novelty is not the only value. Slop comes from your attitude: people like you who think that things must be new to be worth something

Re: Writing toy software is a joy

#105
post #11

One of the best things that I’ve done for myself, career-wise, came during a 6-month sabbatical between jobs. I had a bunch of projects that I wanted to do, but I kept finding myself stymied by scope creep - when you don’t have any constraints, it’s hard to decide how big a project should be, and the projects would grow to these massive unfinishable beasts. I decided to constrain myself to one week per project - what…

In my younger years, classic ASP + SQL was easy, and I had IIS + SQL Server set up on a server at my house. And I could write HTML/CSS/JavaScript. Deployment was... run update scripts, push ASP files via FTP. Now I know there are newer ways to do things, and I'd love to set up CI/CD in my personal life, but every time I want to do a "toy project" I get hung up researching and thinking about my own personal software d…

I've got a VPS and domain I've had for a long time - for most of these, docker compose + the VPS did the job just fine. I was in the same boat - I'd fallen behind on a lot of the ops stack, and project setup wound up being a tar pit for a couple projects before I got frustrated and just said "Fuck it" and did it the dumb way, which wound up being the correct approach.

I found the trick with the personal projects was to pick the thing I was trying to learn with that project and focus on that - if I was trying to learn React, don't also try to learn kubernetes or lambdas or anything else. You really have to be comfortable with your project kind of sucking for all this to work.

So I'd say if you want to learn proper modern deploy + CI/CD + etc, take a project where you already know the rest of the stack (hell, make it Hello World if you have to) and use that. Keep things simple and in scope, get something stupid working, and then iterate to make it better.

Re: Writing toy software is a joy

#106
post #20

Big time! Almost all of my interesting knowledge came from toy projects I made to solve my own problems (or zero problem solved but it was fun so I did it anyway). For example, I wanted to know if I can make 1 Kubernetes cluster span multi region, multi cloud. So I slapped TailScale for networking, replaced etcd with multi-region PostgreSQL Aurora, and span the Kubelets between my Raspberry Pi, Digital Ocean VMs, and…

rqlite[1] creator here, happy to answer any questions.

If you're interested in writing Raft-backed databases you might be interested in my talk at GopherCon 2023. It walks through doing exactly that, step by step: https://www.youtube.com/watch?v=8XbxQ1Epi5w

[1] https://rqlite.io

Re: Writing toy software is a joy

#107

I quite enjoy the spirit of the article, and I believe joy in programming has become even more important in the AI agent coding age we're leaving. However, am I the only one finding those time estimates way too short? I'm not the fastest programmer on Earth, but I'm not the slowest either, and I think most of those projects would take me a lot more time than those estimates, specially if I'd be working only 2-3 hours…

Your project is vastly more specified than a toy project, because it has a real customer (you) who will expect it to work after it ships. That expectation is what separates toys from real tools.

I bet you could write a word processor in an hour. It might only add or delete one character at a time (no selections). It might persist only to a hard-coded "output.txt" filename. You might have to kill the process because there's no quit operation. But that would suffice for a toy word processor.

Re: Writing toy software is a joy

#108

Earlier quoted context omitted.

I think the main difficulty is deployment. Grandma wants that recipe manager to be available to her family 24x7. How can she deploy it easily for free or very low cost? If there were a modern Hypercard, I think the key to its success would be making deployment extremely simple, reliable, and safe.

There are platforms like Observable and Repl.It that just let you deploy code/data pretty quickly.

> Observable

> Repl.it

Sorry, Grandma has never heard of those fancy-pansy platforms.

Re: Writing toy software is a joy

#109
post #81
post #11

One of the best things that I’ve done for myself, career-wise, came during a 6-month sabbatical between jobs. I had a bunch of projects that I wanted to do, but I kept finding myself stymied by scope creep - when you don’t have any constraints, it’s hard to decide how big a project should be, and the projects would grow to these massive unfinishable beasts. I decided to constrain myself to one week per project - what…

Unfortunately the leet coding is key to getting the next job

For what it's worth, the two tricks I found for leet-code interviews were 1) do the simple stupid thing first - get something _working_, and then make it good and 2) explain what you're doing and what you're thinking about to your interviewers. I'm still not Great at the leet-code style, but you can get a lot of the way there with some basic knowledge about algorithmic design and complexity and data structures. In general, I've found finishing the problem and being able to talk coherently about it trumps finding the ideal solution.

(I also code like a psychopath - I'm constantly rewriting what I'm writing while I'm writing it, so a) slowing down and b) telling interviewers what I'm doing and why made that look less chaotic.)

I'm also not the person you want to hire if you're looking for deep algorithmic knowledge, though - I've got a long career of delivering high impact systems and solutions, but if you want someone to rewrite the index parsing algorithm in your mature database software to minimize lookup speed, you've got the wrong guy.

Post reply on HN