To use computers well, learn their rules

post by dkl9 · 2023-07-21T17:00:21.676Z · LW · GW · 6 comments

This is a link post for https://dkl9.net/essays/computer_rules.html

Contents

  How computers use numbers
  Quadratic scaling
  The size of data
  Why tasks get stuck
  Autocompletion
  Principles of filesystems
  Configuration files
  Principles of the web
None
6 comments

To use computers effectively, you don't need to learn a lot about particular programs and features. Learn the near-universal rules of computing and common interface designs. The details are readily inferred.

The rules also apply to things beyond what you might think of as "computers". Smartphones are computers.

Here are some of those rules to demonstrate the technique, and to help you learn it.

How computers use numbers

Computers have limited memory, so they represent a number with (usually) a tiny amount of memory. Often, that amount is 16, 32, or 64 bits. In case that's meaningless to you: that means each number can only be one of a limited set of values. 66 thousand, 4.3 billion, 18 quintillion options, respectively, for those sizes.

If what you do introduces huge or precise numbers, at some point along the path of size or precision, the program doesn't handle the numbers quite as well, or, in some cases, breaks.

If you try to make the number too big, it's handled with less precision than you expect. For a clear example of this: try putting 10^20 + 999 in a calculator. Some calculators are forced to round it to 10^20, no 999.

If you try to make the number too precise, the little details will be cut off and won't help.

Quadratic scaling

Some things in computing, such as images or link-networks, have an inherent scale proportional to the square of the obvious variable. An image has around many pixels as the square of its width. A link-network has around half as many potential links as the square of the items it can link. The square of number grows much faster than the original number. Doubling the original quadruples the square.

The more detailed study of matters like these is computational complexity.

The size of data

Typical units are based around the byte (representing one character, at least in English plaintext), and extend it to the kilobyte/KB, megabyte/MB, gigabyte/GB, and terabyte/TB. Those last terms, respectively, mean 1 000, 1 000 000, 1 000 000 000, and 1 000 000 000 000 bytes, each one a thousand times the last. Sometimes (for good reason) the factor each time is instead the nearby 1 024: 1 024, 1 048 576, 1 073 741 824, 1 099 511 627 776.

The size of a file (or file-equivalent dataset) gives a hint as to how long it'll take to process. On machines of the 2010s, for straightforward operations (transferring, searching, reformatting, etc):

Of course, the time an operation takes varies depending on what exactly you're doing. Some are a bit simpler and can be done faster than what I've listed. Many tasks are much more complex and can take far longer. A few don't really depend on the size of the data.

Why tasks get stuck

If something you run on a computer doesn't finish after a long wait, and doesn't show an error:

  1. Consider the size of its task (see previous section). If practical, try doing the same thing with a much smaller file, to see if it's a matter of data size or something else. Evaluate if the time taken really exceeds what you should expect.
  2. Consider if there's an unavailable resource it might be waiting for. Network connections are the first that come to mind.
  3. It is distressingly common for programs to get stuck sith they enter an accidental infinite loop.

Autocompletion

Many systems that expect you to enter somewhat-predictable text (writing with real words, filenames, usernames, etc) have a way to help you with that. Sometimes it displays automatically and you just have to select it, often with arrow-keys and Enter. Sometimes you have to trigger it, often with Tab.

Principles of filesystems

Configuration files

Many programs (especially the more complex ones) have configuration files associated with them. All of the following are often, but far from always, the case about configuration files:

Principles of the web

6 comments

Comments sorted by top scores.

comment by Misaligned-Semi-intelligence (MisalignedIntelligence) · 2023-07-21T17:17:25.679Z · LW(p) · GW(p)

It is distressingly common for programs to get stuck sith they enter an accidental infinite loop.

I want to make a clever sith pun but I don't have one so I'm just pointing out the typo.

Replies from: dkl9
comment by dkl9 · 2023-07-21T17:58:04.946Z · LW(p) · GW(p)

What did you think the right word would be?

(It's deliberate. Synonym of "because".)

Replies from: andrew-sauer, MisalignedIntelligence
comment by andrew sauer (andrew-sauer) · 2023-07-21T23:03:12.955Z · LW(p) · GW(p)

Is this actually a random lapse into Shakespearean English or just a typo?

Replies from: dkl9
comment by dkl9 · 2023-07-21T23:10:39.580Z · LW(p) · GW(p)

Neither. Long-lasting deliberate idiosyncrasy, based on Shakespearean English.
What word is sufficiently Levenshtein-close to "sith" as to get there from a typo whilst also fitting grammatically into the sentence?

Replies from: andrew-sauer
comment by andrew sauer (andrew-sauer) · 2023-07-21T23:31:09.790Z · LW(p) · GW(p)

"since"?(distance 3)

I guess that would be a pretty big coincidence lol

comment by Misaligned-Semi-intelligence (MisalignedIntelligence) · 2023-07-21T20:43:24.517Z · LW(p) · GW(p)

Ah, I was reading it like "if" or "when", even if I couldn't quite see how that typo would actually happen. I actually was confused enough that I asked GPT-4 "is this a typo and if so what is it supposed to be?", and it never even crossed my mind that it was not a typo once I started thinking about Star Wars sith. Especially since it seemed to be for a relatively basic audience.