Hacker News new | ask | show | jobs
by jlesk 3205 days ago
I've been a designer/programmer pretty much my entire career and currently work on a research-centric UX design team. So while I've been designing my own language (THT, a language that compiles to PHP, aiming to fix most of the issues with that language), I've been applying usability concepts to the design.

A few principles:

- Acknowledging that the user is probably familiar with other languages, so stay within those conventions when possible. This is inspired by Jakob Nielsen's maxim that web designers should acknowledge that their users send 99% of their time on other websites.

- Making the most common activities the easiest. Larry Wall refers to this as applying Huffman coding to the syntax itself.

- Safe defaults. Making dangerous operations less convenient than the safe path. PHP has pretty much the opposite behavior, where many of the default design choices lead to security issues.

- Cognitive Load. Minimizing visual noise and the number of micro-decisions the user has to make. i.e. There should be one (good) way to do it.

- Preferring shorter, clearer terms over technical jargon. e.g. I use the terms "Flag" instead of "Boolean" and "List" instead of "Array". One can get pedantic over the exact meanings of symbols, but during the actual act of programming, simpler terms can help reduce friction.

The project is at https://tht.help if anyone is curious.

4 comments

> e.g. I use the terms "Flag" instead of "Boolean" and "List" instead of "Array"

It some cases "Flag" makes much more sense than "Boolean", but when using logic gates does "Flag" make any sense? Wouldn't it make people think of actual flags more than an on or off signal.

"List" and "Array" mean different things in CS. Lists cannot be accessed arbitrarily whereas arrays can be.

> One can get pedantic over the exact meanings of symbols, but during the actual act of programming, simpler terms can help reduce friction.

"Simpler" is a matter of perspective. Any experienced programmer should not have any problem with Arrays vs Lists vs Queues, etc, and they are all necessary concepts to be able to talk about and program with.

Most jargon exists because it is able to describe things that are not used in everyday life much more efficiently than without it.

Depends on the context. If you're writing a CRUD web app with simple business logic, is the mental priming of data structures like arrays relevant helping you develop?
> e.g. I use the terms "Flag" instead of "Boolean"

I'm not familiar with THT and this is a nitpick, but doesn't this contradict the first principle? Pretty much every language I've ever used has some notion of "boolean", and I don't know one that uses "flag". Don't want to bash, just curious how that decision was taken.

Most of the principles are always in tension to some degree, and come down to a design decision. In this case, the shorter, clearer term won out. The two terms are practically synonymous, so if you know what a "boolean" is, you probably know what a "flag" is.

In actual use, you rarely interact with the names anyway -- you use `true` and `false` as values like most other languages.

Flag is a pretty obscure term that you learn from using the linux command line. Booleans are in math and engineering. Flag is not clear at all and using it instead of boolean, especially when you don't even use the term boolean directly all that much, seems kind of silly.
Is "flag" actually clearer if you're not already familiar with the term from command-line "flags"? Personally I always thought it was kind of a weird usage, pretty far from the literal meaning.
I can't remember where I first heard it, but I'm sure it was before I'd used command lines. I always thought it came from the little flags on the side of some mailboxes.

etymonline doesn't have an entry for flag as a noun meaning boolean, but this might be related:

> flag (v.2) 1875, "place a flag on or over," from flag (n.1). Meaning "designate as someone who will not be served more liquor," by 1980s, probably from use of flags to signal trains, etc., to halt, which led to a verb meaning "inform by means of signal flags" (1856, American English). Meaning "to mark so as to be easily found" is from 1934 (originally by means of paper tabs on files). Related: Flagged; flagging.

I love this idea of Huffman coding the syntax- I've been thinking recently it wouldn't be difficult to crawl all the packages of NPM for example, encode them into their AST's, and use algorithms to analyse them. e.g. trying to apply PageRank to visualise the most important classes/methods in a codebase.