I doth whip mine hair to the aft and to the fore.
47 stories
·
2 followers

NASA refuses to reply to aliens who attempted to communicate with Earth via YAML

1 Comment
NASA refuses to reply to aliens who attempted to communicate with Earth via YAML

Washington, D.C.—NASA spokesperson shared breaking news this morning: the governmental agency had received an intelligent radio signal of extraterrestrial origin. The message contains information about the alien species and their benign intentions, as well as an invitation to continue the dialogue.

However, NASA had decided not to reply to the message not because of its content, but because of its format. The original message was encoded in YAML, a human-readable data-serialization language widely used by software developers and some other conscious entities.

Excerpt from the official press-release:

Even though the contents of the message is benign, we believe the format is the actual message. The choice if YAML can be interpreted as a cruel joke, a sarcastic remark or a threat.


Read the whole story
Share this story
Delete
1 public comment
Groxx
202 days ago
reply
Everything in here is true facts
Silicon Valley, CA

Silly Hats Only

1 Comment
comic: 

This tactic did *intensely* amplify the surprise factor.

Read the whole story
Share this story
Delete
1 public comment
Groxx
485 days ago
reply
Taking surprise parties to the next level
Silicon Valley, CA

Moore's Hierarchy of Needs

1 Comment and 2 Shares
comic: 

We moved so many times for awhile... moving sucks :(

Read the whole story
denubis
505 days ago
reply
Share this story
Delete
1 public comment
Groxx
504 days ago
reply
it me
Silicon Valley, CA

I want off Mr. Golang's Wild Ride

1 Comment
My honeymoon with the Go language is extremely over. This article is going to have a different tone from what I've been posting the past year - it's a proper rant. And I always feel bad writing those, because, inevitably, it discusses things a lot of people have been working very hard on. In spite of that, here we are. Having invested thousands of hours into the language, and implemented several critical (to my employer) pieces of infrastructure with it, I wish I hadn't.
Read the whole story
Share this story
Delete
1 public comment
Groxx
518 days ago
reply
I cannot possibly agree more. Go is a weird sort of drunken living nightmare if you try to do anything carefully.
Silicon Valley, CA

🌟🌟🌟New comic!🌟🌟🌟

1 Comment


🌟🌟🌟New comic!🌟🌟🌟

Read the whole story
Share this story
Delete
1 public comment
Groxx
522 days ago
reply
So accurate, it's beyond our ability to measure.
Silicon Valley, CA

Need a Magic Constant? Choose Something Obscure

1 Comment

We all have various constants in our code, whether they are integers for use with startActivityForResult(), strings for Logcat tags, and so forth. Most of these are internal to our code and do not affect others.

Sometimes, though, we have an API that we expose that others might call, where certain parameters are up to the caller… except for some magic constants. For example, you might have a key/value data store, where you want to reserve some keys for your internal use, but others can stuff whatever they want into that data store using their own choices of keys. Those reserved keys are magic constants.

(IMHO, try to avoid such APIs, keeping your internal data separate so there is no chance of a key collision… but sometimes this API structure is unavoidable)

So, the caller of your API can choose any value for their keys, except certain magic constants. In that case:

  • Practice defensive programming and validate that a caller-supplied key is not one of your magic constants,

  • Document what the magic constants are, and

  • Choose obscure values

When it comes to NotificationChannel, we got two out of the three.

NotificationChannel has a DEFAULT_CHANNEL_ID constant. This is a magic constant, as you cannot use it as the ID of your own channel. If you try, you get a somewhat cryptic stack trace. But, that stack trace is because of the defensive programming, so that’s good. And the magic constant is documented, at least to an extent.

However, the value of DEFAULT_CHANNEL_ID is "miscellaneous".

That’s a reasonably common English word, one that somebody might well choose without noticing that it is not an eligible value.

Particularly with strings, you have a near-infinite space to choose magic constants from. So, it is easy to choose a magic constant that is unlikely to collide with any value that others might choose:

  • Use a UUID

  • Use a passphrase generated by diceware

  • Use a series of digits from a random number generator

  • And so on

Even if memory use is a consideration, it would be better to choose a random six-digit number than to use a common word. There are lots of obscure values that we could use that are shorter than "miscellaneous".

After all, neither the compiler nor the OS really cares about the actual value. Your own code does not care about the individual characters inside of the magic constant. It just needs to know that it can look up things using that magic constant and get what it expects.

Magic constants are part of your API and they need to be designed along with the rest of the API. It’s just that whereas normally you want things to be human-readable, this is one case where you do not. Or, at the very least, choose a less-common human-readable word, such as "axolotl".

(NOTE: no actual axolotls were harmed in the creation of this blog post)

Read the whole story
Share this story
Delete
1 public comment
Groxx
745 days ago
reply
even better:
misc-[uuid]

human friendly and collision-"impossible".

I've done this before - it's handy. You can probably guess at the meaning, and you can search *the whole internet* for that UUID and get only relevant results. I'm not sure if there's any downside, aside from an insignificant increase in binary/log size.
Silicon Valley, CA
Next Page of Stories