Why Duck Typing Is Safe
Jun 16, 2020

For the last 20 years I've been programming almost exclusively in languages with either duck typing or structural typing. These are languages where you can have objects that either conform to an informal interface without that conformance being declared (dynamically-typed languages), or where conformance is simply a matter of matching the interface (Go). This is as opposed to languages where conformance must be explicitly declared somehow, either with a formal subclass relationship (the class-based portion of C++) or by explicitly declaring conformance to an interface (Java).

Not needing to formally declare conformance is powerful because you can take some pre-existing object, declare a new interface that it conforms to, and then use it with your interface. This reduces the endless paperwork around re-wrapping things to make existing objects conform to new interfaces.

I have seen a lot of programmers over the years express concerns; what if something accidentally conforms to an interface and causes some horrible bug? What if I have an interface for Shoot() for a video game and some object wanders in that Shoot()s a real gun by accident? Isn't it safer to formally declare conformance?

Read the rest...

Stream Resolutions Are Quality Maximums, Not Minimums
Dec 19, 2019

From the "It's Obvious When I Say It, But..." department: I recently figured out to put something into words that has been bothering me for a while: We tend to treat stream resolutions as putting a minimum guarantee of quality on a stream. Thus, a "720P stream" must be lower in quality than a "1080P stream", which must be lower in quality than a "4K stream".

This is backwards. Stream resolution puts a maximum quality on a stream. For a given codec setting, the more bits you allocate to a stream, the better it will look, until eventually it gets to the point where there's no more quality to be had. A 720P stream will reach this point sooner than a 1080P stream, which will in turn reach it much sooner than a 4K stream.

However, prior to that point, what really matters more is the bandwidth of a stream. A "720P stream" pushing a megabyte/second will be higher in quality than a "4K stream" pushing 800kilobytes/second. It's completely possible to have a higher quality "lower resolution" stream.

You can see this in DVDs. The early ones were poorly encoded, and often had fewer bits since double-layer DVDs weren't widely-available and cheap yet. The later ones are much nicer, and with the double-layer, have a lot of bits. The result is a DVD stream that is pretty much maxed out, despite its lower resolution. Blu-rays have a larger nominal resolution, a superior codec, and the ability to throw about 5 times as many bits at a video stream... yet for all that, they aren't necessarily that much better. If I get up close to a Blu-ray stream on my TV, it clearly has a ways to go before it hits "maximum quality" for 1080P. It's certainly better, just not by as much as you'd think, because modern DVDs are already fairly high quality. Contrary to popular opinion, if you are a cinephile, there is still a place for distributing media to people in their homes, where you can casually allocate 40GB to a single movie for a quality experience.

Marketing takes advantage of this widespread misunderstanding. I tend to look askance at anyone claiming a "4K stream". Few companies are willing to pay to serve such streams properly, and even in 2019, few home Internet connections are strong enough to reliably stream what it would take to truly max out a 4K stream. I've seen many "4K streams" that are more accurately described as "fairly decent 1080P streams, finally".

Dec 20, 2017

While writing comment on another site, I accidentally came up with what I think is a pretty good definition of "gimmick", since the internet tends to throw the term around with wild abandon.

A storyteller that likes getting paid should do things that make the audience want to come back for more. A gimmick is when you do something that win in the short term, but is ultimately burning your audience as they tire of it.

The linked article talks about one of JJ Abram's go-to gimmicks. It's a good one that has carried him quite far, but it's ultimately a gimmick as people figure out that the answer to the questions that his stories pose is "There is no answer, and in fact, whatever you think it is, it's not that."

That latter clause in particular is not only gimmicky, but kinda a jerk move. When watching an ongoing series, the Internet as a whole will propose every sensible possibility, every crazy possibility, every wish-fullfillment possibility, and every out-right stupid possibility. If what is truly going to happen isn't in the set of things the Internet is guessing, you'd better have a really good reason, or otherwise, that is a strong signal that you have screwed up and written a dumb story, if nobody at all could guess what was coming next. You don't want 100% of the audience to be able to guess, but you also don't want to be writing stories where 0% of the audience guessed.

Motion controls for games are often referred to as "gimmicks", but using this metric we can distinguish some differences. Motion controls that are replacements for button presses are gimmicks. Nifty at first, but eventually the game instinctive notices the lower precision and higher latency of the motion control, and begins to hate it. Motion controls that use the continuous, physical nature of motion controls to do something that requires it is not a gimmick. I find even years later, using them to aim, or steer cars in Mario Kart, is still a superior control method, sometimes even the best commonly-available method.

The best test for a gimmick is time. If you want to go back to it a couple of years later, it's probably not a gimmick. If the fad rises, burns across the landscape, and then fades with hardly a trace (found footage movies, for instance), it's a gimmick.

Aging in the 21st Century
May 05, 2017

It's abstract to think about how one will someday be old and feeble, but as I was filtering over some spam a moment ago, it occurred to me that someday, my children will have to take away my email because I won't be able to properly process Mr. Al-Amin Dagash's email titled REQUEST FOR A LEGITIMATE BUSINESS PARTNERSHIP.

Now that's a sobering thought.

XML Namespaces in a Nutshell
Aug 05, 2016

I've said several times that XML Namespaces are simple, but I don't have a good proof document. So here it is.

Read the rest...

<- Future Posts Past Posts ->


Site Links


All Posts