Pan-fried

A blog about nothing in particular. RSS

Person pouring liquid into a pot

I know it’s called “pan-fried,” but this blog isn’t about cooking in particular. Frying foods just makes me happy, and it’s been on my mind lately. Which I suppose is as good an indicator of what to expect here as anything.

Comments are good, actually

7 minutes, 2021-04-29

After that 99 Bottles of OOP post, I’ve been thinking a lot about coding style. In particular, there’s a perspective I hear sometimes that code should be self-documenting.

There’s a strawman version of perspective that I want to get out of the way first — I don’t think anyone’s seriously proposing that we not use comments anywhere. But I do hear people talk about how comments can easily become out-of-date and eventually no longer reflect what’s actually happening in the code. They say you should try and pack as much information into variable and function names as possible. “Comments should be rare; we should break our code up into a lot of small functions with descriptive names so that the code itself tells us what it’s doing.”

The trouble with that is, naming functions and variables is hard. Besides cache invalidation, it’s the only hard problem in computer science, or so the aphorism goes. So advocates of self-documenting code will say, yeah, obviously it does take a while to come up with good names. There’s no way around it.

But let’s think for a minute about what makes it so hard to name things. Computer science is a complicated and abstract field. Much like philosophy, it deals mostly in ideas that are meticulously structured and rather unlike anything in the physical world around us. When you name a function, you need to take a complex and abstract process and compress it into a short alphanumeric slug — maybe 25 characters long at the most. That’s barely any space, and we have a lot of information to convey.

So consider that the statement “your code should be self-documenting” can be reworded as, “your code should explain what it does mostly within the confines of function and variable names.” That’s actually a pretty tough sell, given how poor a medium names really are. We can spend our time much more efficiently by writing comments than we can by cramming every relevant detail into names. Good names are important, of course, but let’s not expect the unreasonable from them.

Continue reading…

Problems with object-oriented programming

9 minutes, 2021-04-17

There’s a lot of writing out there about what “good code” looks like, especially within the object-oriented programming community. I mostly work with imperative and object-oriented programming languages, but a lot of the ideas I’ve heard about what “proper OOP” looks like don’t resonate with me.

I recently flipped through a copy of 99 Bottles of OOP, which is one such “what does good object-oriented code look like” book. I’ve heard good things about it, and I was curious how much it would align with my opinions and how much I’d disagree with. And, well… I disagreed with a lot.

The premise of the book is that it presents us with the problem of writing a program that prints out the “99 bottles of beer on the wall” song, and then walks us through an object-oriented development process to create a program using strategies that scale to larger projects. I’m not very impressed by the code the book comes up with, though.

Continue reading…

Why permissionless blockchain is garbage

6 minutes, 2021-03-21

This is part two of my critique of block­chain. In part one, I explained the technology behind block­chain, and listed three types of distributed block­chain: permissioned, proof-of-work, and proof-of-stake. If you already know what these things are, you’re welcome to skip part one, but otherwise, it’s probably worth a read.

This part is going to be dedicated to a takedown of permissionless block­chain. That includes Bitcoin, Etherium, and basically every block­chain that anyone talks about.

The case in favour of permissionless (proof-of-work and proof-of-stake) block­chain is brief: Permissionless block­chain doesn’t require a central authority, so in theory, Bitcoin doesn’t rely on any one government or group. The idea is that this makes Bitcoin more reliable. But in practice, this idea has a lot of problems.

Every permissionless block­chain requires a cryptocurrency, both for proof-of-work and proof-of-stake systems. The continued existence and security of the block­chain depends on this cryptocurrency, this token, retaining value. But why would anyone value it in the first place? A thing only has value if people want it, and for a completely invented asset which doesn’t do anything, the only reason to want it is if it has value on the market.

So the reason the price of these cryptocurrency token climbs above zero is speculation: the idea that their value will rise in the future, and that anyone who buys now will be able to turn a profit later. This creates an asset whose price is completely untethered from the material world, and which continues climbing so long as people believe it will continue to climb. If it ever does stabilize, the investors who were looking to turn a profit will all start selling, looking for new investment opportunities. And when a lot of people start selling something, its price crashes.

Continue reading…

Understanding blockchain

17 minutes, 2021-03-21

I don’t like cryptocurrency. My reasons for that are kind of complicated and a bit technical, and I’m writing a two-part series about them. Now, I want to explain myself in a way that’s accessible to a non-technical audience, but people have used a thousand imprecise analogies to explain block­chain, and all of them seem to fall flat. So in this first part, I’m going to explain what block­chain is, what problems it solves, how it works, and what the alternatives are, without papering over details using analogies.

Continue reading…

Tampermonkey is pretty cool

2 minutes, 2021-03-06

The other day, I found myself wanting to scrape a bunch of logs from Discord. I’d written a Markov generator for fun, and I wanted to train it on a friend’s post history. Trouble is, Discord doesn’t exactly have a “scrape logs” button in its UI. I imagine a bot could do it easily enough, but I didn’t control a bot on that server.

Now, I’d previously heard Tampermonkey mentioned in passing. Tamper­monkey is a browser plugin that lets you run custom userscripts — snippets of javascript that execute automatically on certain domains. I injected a button into Discord that would automatically flip through pages of Discord search results, scrape the text from the results, and post it to a local Flask server with the fetch() API. Setting aside a couple hitches here and there, it worked quite nicely.

Today, I used it again. I find that it’s easy to waste time on Twitter, because you don’t know how long you’ve been using it for. Twenty minutes can go by without you actually realizing it. So I set up a userscript to run on https://twitter.com/*. It pings a local Go server every 30 seconds, and the server sends desktop notifications every five minutes letting you know how long you’ve been scrolling through Twitter. It stops timing you when the keep-alives stop rolling in. It works great.

I’m excited about future possibilities here. I’m usually pretty hesitant to install random browser plugins, because “browser plugin got taken over by bad actors” is a really easy vector for malware. But with Tampermonkey, I control the code I run. Browsers are one of the most important tools we use, and I’m excited to see the possibilities that open up to me with this kind of simple automation.

— Pan-fried, 2021-03-06. Back to top

FreeCell slaps

2 minutes, 2021-03-05

Last month, I bought a pack of playing cards at the supermarket on a whim, and I found myself looking for something to do with them. I like cards. I like their aesthetics, I like how we arbitrarily categorized a bunch of slips of paper and then came up with games for them. But my card game white whale has always been a fun solitaire game.

Regular solitaire — Klondike solitaire — is kind of terrible. Any given deal of Klondike has a significant chance of being unwinnable, and the player doesn’t make very many meaningful choices over the course of the game anyway. If you find a move, most of the time you’re gonna want to take it. Other solitaire games aren’t much better.

So I’ve got my cards, and I’m looking for games, and I stumble upon the instructions for how to play FreeCell. I was tangentially aware of Microsoft FreeCell, but I’d always assumed that FreeCell was just the name of Microsoft’s Klondike implementation. But no: FreeCell is its own solitaire game, and it is the best. Microsoft popularized it, but it existed before that.

See, the great thing about FreeCell is that basically every game is winnable. Unwinnable deals exist, but you’re not likely to run into one. So you know you’ve got a real challenge to deal with. Unlike in Klondike, you’re constantly making real choices. You’re not hunting around for options — you have too many options, and you’re trying to sort out which strategy won’t screw you later on. Because if you misplay, your options will dry up and you’ll have nowhere left to go.

Perhaps the clearest difference between FreeCell and Klondike is the cards. In Klondike, the game starts with seven cards face-up, and an additional eight cards accessible in the stock. In FreeCell, all 52 cards are dealt face-up. You can see the whole game. The challenge isn’t in making lucky guesses. Once the cards are dealt, it’s a pure test of skill.

I’m not playing FreeCell as much as I was a few weeks ago, when I’d just discovered it. But I still play a game every so often. It’s compelling. I’m glad I found it. Give it a try if you’re feeling bored and have a minute — it may surprise you.

— Pan-fried, 2021-03-05. Back to top

Real good fry oil

4 minutes, 2021-03-04

The name of this blog comes from a funny little passion of mine. See, I always used to cook with canola oil. When I was a kid, my mom had a giant plastic jug of the stuff in our pantry, and it’s cheap as dirt, so it seemed like the obvious option. But the trouble with canola oil is that it tastes like canola oil. Cloying and plasticky. It’s just not good.

What else to cook with, though? Olive oil is delicious, but too temperamental to use on high heat. Butter likewise. Sunflower oil is the obvious one, and I used that for a while when I finally got fed up with canola. It’s unobjectionable enough — high smoke point, no strong taste.

But everything changed when I discovered the lost history of lard. See, lard used to be the go-to cooking fat in the anglosphere. It’s a pork byproduct, so there’s lots of it to go around. It’s saturated, like butter, which makes it lovely for baking and frying, but unlike butter, it has a high smoke point, so you can cook basically anything with it. Alas! nobody uses lard anymore. It’s catastrophically unhealthy, or so we’ve been told. But I learned a couple years back that this narrative about lard is a cultural fiction derived from Crisco’s marketing campaign, among other things. Lard is actually no worse than any other saturated fat, and saturated fats aren’t as bad as we thought in the first place.

Lard was a game-changer for me — food fried in saturated fat is just lovely. Unsaturated vegetable oils can leave a bit of a greasy sheen on fried foods, but saturated fats fry crispy and dry. I thought I had reached the end of my little cooking-fat quest; that lard was fry cook enlightenment. Until I found out how butter really works.

Continue reading…

I hate antinatalism

5 minutes, 2021-03-03

I recently read the essay Neoreaction a Basilisk, by Elizabeth Sandifer. It’s an interesting read, although the author sometimes seems to dance around her arguments without ever quite making them explicit. But even at its weakest, it’s no more than poetically out-of-focus, and I snapped up the whole thing in two sittings.

One of the authors who Sandifer discusses is Thomas Ligotti, an existential pessimist and an antinatalist. His positions is that existence is agony, and we’d all be better-off not doing so. In fact, he thinks we should all just stop having kids and end humanity altogether.

Between this and a recent online argument, I’ve been thinking about antinatalism again. I’ve argued with my fair share of antinatalists, and frankly I just can’t stand them. I think they’re wrong, but there’s more to it than that. I think they’re wrong-headed. I think antinatalism isn’t just incorrect, but foul too.

Some antinatalist arguments are just flat-out incorrect. Some say that it’s cruel to bring people into being if there’s even the slightest chance that they’ll live sad lives. After all, you can’t ask a baby’s consent before conceiving it. But of course, consent is only a heuristic for how much pleasure or harm an action will cause. No one can consent to a surprise birthday party, but we throw them anyway, because we know that they will probably amuse and delight their recipients.

And I think most people enjoy their lives well enough. Depression only affects about 5% of the population, give or take, and I figure depression is a pretty good heuristic for the percentage of people who doubt the worthwhileness of their lives. And I imagine we could cut that number down a lot if we changed some stuff about our society. If we supported those in need and lived in more tightly-knit social communities, I bet depression statistics would plummet. Even the sadness that does exist is hardly essential to the human condition.

Continue reading…

Hello, Neocities!

1 minute, 2021-03-03

Twelve months into Covid, more or less, and I feel like having somewhere new to write down my thoughts. Last summer, I put together a blog, but eventually I stopped wanting to make high-effort posts.

But now, my standards are low, and I’m bored. Voilà.

Honestly, to some extent, I just felt like making a new CSS theme. Kinda love doing that. But now that we’re here, I’ve got an opportunity to talk about the things that’ve just been running around my head. I don’t make a lot of small talk these days.

Anyway — feels good to be here 😄

— Pan-fried, 2021-03-03. Back to top