Skip to content

Instantly share code, notes, and snippets.

@amcgregor
Last active February 3, 2022 22:42
Show Gist options
  • Save amcgregor/9f5c0e7b30b7fc042d81 to your computer and use it in GitHub Desktop.
Save amcgregor/9f5c0e7b30b7fc042d81 to your computer and use it in GitHub Desktop.
Alice's Laws

Alice's Laws

  1. You can only count on yourself.
  2. Never reveal more than you have to.
  3. Execution is nine-tenths of the job.
  4. Give credit where credit is due.
  5. When all else fails, do it yourself.
  6. 90% of a project takes 90% of the time.
  7. The remaining 10% takes an additional 90% of the time.
  8. Never date a co-worker.
  9. Never look back, all obstacles are ahead.
  10. Always make time for friends.
  11. If life hands you lemonade, don't try to make lemons out of it.
  12. You gotta go with what works.
  13. Any joke that has to be explained isn't worth explaining.
  14. Never underestimate the power of teamwork.
  15. Never underestimate a man's ability to make you laugh.
  16. A little elbow grease never hurt anyone.
  17. Everything dies.
  18. Never second-guess your own work.
  19. Whenever you've eliminated the impossible, whatever remains, however improbable, must be the truth.
  20. Always watch your back.
  21. Everything is transitory.
  22. It always pays to think ahead.
  23. Anything can happen.
  24. Distance can't keep good friends apart.
  25. It's not over until it's over, and sometimes not even then.
  26. When someone is trying to kill you, it's OK to sweat.
  27. If it works perfectly, someone will redesign it.
  28. Beautiful is better than ugly.
  29. Explicit is better than implicit.
  30. Simple is better than complex.
  31. Complex is better than complicated.
  32. Flat is better than nested.
  33. Sparse is better than dense.
  34. Readability counts.
  35. Special cases aren’t special enough to break the rules.
  36. Although practicality beats purity.
  37. Errors should never pass silently.
  38. Unless explicitly silenced.
  39. In the face of ambiguity, refuse the temptation to guess.
  40. There should be one–and preferably only one–obvious way to do it.
  41. Flexibility can be nice, however.
  42. Now is better than never.
  43. Although never is often better than right now.
  44. If the implementation is hard to explain, it’s a bad idea.
  45. If the implementation is easy to explain, it may be a good idea.
  46. Namespaces are not just a good idea.
  47. Choose two: good, fast, cheap.
  48. Discipline is the best tool.
  49. Design first.
  50. Don’t patch bugs out, rewrite them out.
  51. Don’t test bugs out, design them out.
  52. If you don’t understand it, you can’t program it.
  53. If you didn’t measure it, you didn’t do it.
  54. Good design is magical.
  55. Feature lists should not be the goal of any project.
  56. To go faster, slow down.
  57. If something is worth doing twice, it’s worth building a tool to do it.
  58. Corollary: if it's worth doing, it's worth doing twice.
  59. The more you have to type, the more you have to know.
  60. The less you have to type, the faster you can get things done.
  61. Synonyms are your best friend.
  62. Though semantic meaning should take precedence.
  63. If you deliver on time and there are defects, you haven’t delivered on time.
  64. Not all features are worth implementing. Those that are, are worth implementing well.
  65. Restrictions breed creativity.
  66. It never hurts to help.
  67. Pillage, then burn.
  68. A Sergeant in motion outranks a Lieutenant who doesn't know what's going on.
  69. An ordnance technician at a dead run outranks everybody.
  70. Close air support covereth a multitude of sins.
  71. Close air support and friendly fire should be easier to tell apart.
  72. If violence wasn’t your last resort, you failed to resort to enough of it.
  73. If the food is good enough, the grunts will stop complaining about the incoming fire.
  74. Mockery and derision have their place. Usually, it's on the far side of the airlock.
  75. Never turn your back on an enemy.
  76. Sometimes the only way out is through… through the hull.
  77. Everything is air-droppable at least once.
  78. A soft answer turneth away wrath. Once wrath is looking the other way, shoot it in the head.
  79. Do unto others.
  80. It only takes one good match for an entire house to burn to the ground.
  81. "Mad Science" means never stopping to ask "what's the worst thing that could happen?"
  82. Only you can prevent friendly fire.
  83. Your name is in the mouth of others: be sure it has teeth.
  84. The longer everything goes according to plan, the bigger the impending disaster.
  85. If the officers are leading from in front, watch out for an attack from the rear.
  86. The world is richer when you turn enemies into friends, but that's not the same as you being richer.
  87. If you're not willing to shell your own position, you're not willing to win.
  88. Give a man a fish, feed him for a day. Take his fish away and tell him he's lucky just to be alive, and he'll figure out how to catch another one for you to take tomorrow.
  89. If you can see the whites of their eyes, somebody's done something wrong.
  90. The company mess and friendly fire should be easier to tell apart
  91. Any sufficiently advanced technology is indistinguishable from a big gun.
  92. If the damage you do is covered by a manufacturers warranty, you didn't do enough damage.
  93. Don't be afraid to be the first to resort to violence.
  94. If the price of collateral damage is high enough, you might be able to get paid for bringing ammunition home with you.
  95. The enemy of my enemy is my enemy's enemy. No more. No less.
  96. A little trust goes a long way. The less you use, the further you'll go.
  97. Loyalty should be rewarded with loyalty and no small amount of suspicion.
  98. Only cheaters prosper.
  99. Hope is the first step on the road to disappointment.
  100. Anything is amphibious if you can get it back out of the water.
  101. If you're leaving tracks, you're being followed.
  102. If you’re leaving scorch-marks, you need a bigger gun.
  103. That which does not kill you has made a tactical error.
  104. When the going gets tough, the tough call for close air support.
  105. There is no 'overkill.' There is only 'open fire' and 'I need to reload.'
  106. Just because it's easy for you doesn't mean it can't be hard on your clients.
  107. “Do you have a backup?” means “I can’t fix this.”
  108. Backups are what happens when everything else, including the extinguisher, is on fire.
  109. A really good idea will not last long before someone else runs with it.
  110. Success is directly proportional to how much you love what you are doing.
  111. Planning is mandatory for success. Fail to plan and you plan to fail.
  112. A plan that is not periodically reviewed is nearly useless.
  113. An effective and successful leader does not become consumed by his operation.
  114. Without marketing, failure is guaranteed.
  115. Nearly 70% of defection takes place because they feel poorly treated.
  116. It takes five times as much energy to get new users than retain existing ones.
  117. For every person who bothers to complain, there are 26 others that remain silent.
  118. It takes 12 positive incidents to make up for one negative incident.
  119. 80% of complaints received by an organization are likely to have poor communication as their root cause, either with the customer or within the organization itself.
  120. A typical business hears from only about 4% of its dissatisfied customers. 96% just go away and 91% will never come back.
  121. If you don't know where you're going, any road will take you there.
  122. New does not mean better. A change for the sake of change will be a detrimental one.
  123. There are big problems impacting performance in every organization that everyone knows about but no one talks about or attempts to fix. They will treat the symptoms but not the core problems… the elephant in the room is career preservation.
  124. Confidence comes from success, knowledge comes from failure, but only if you can own your failures.
  125. People won’t perform for those they don’t respect.
  126. Whether negotiation is strong or weak depends entirely on your goals.
  127. All analysis begins with complete and accurate information.
  128. Any agreement which has no consequences for failure isn't an agreement, it's a non-binding understanding.
  129. Always double-check which side you're standing on of the branch you are sawing.
  130. You run when you attack. You run when you retreat. When you can't run, you die.
  131. Weird is what drives the universe.
  132. Pain is inevitable, suffering is optional.
  133. Strings: the universal arbitrary precision math format.
  134. I before e, except after c, unless you're running a feisty heist against a weird beige neighbour who owns a Rottweiler. English sucks.
  135. Too few people know how to properly tie a noose.
  136. People don't choose their gender or colour. Tear those barriers down!
  137. Programming language? Editor? You make your bed, you lie in it.
  138. When attempting to learn how to mask layers in the GNU Image Manipulation Program (GIMP) avoid searching unconsciously for “gimp mask”.
  139. Django is what happens when a cluster bomb goes off in code: disjoint parts, but shrapnel everywhere.
  140. What is best in life? To mallet trolls, see them deleted before you, and to hear the lamentations of their bros!
  141. Never attribute to malice that which is adequately explained by stupidity.
  142. Never underestimate the stupidity of human beings.
  143. The only failure in stupidity is in not learning from it.
  144. As within, so without.
  145. The skilled create art from misfortune.
  146. The most compelling tasks are never the most urgent.
  147. Optimization without measurement is by definition premature.
  148. Things that start working by themselves tend to stop working by themselves.
  149. "A [person] who won't die for something is not fit to live." [-- MLK Jr.]
  150. Bliss is a well-timed coma.
  151. If you have a name you want to give an idea, Google it first.
  152. Beware the small victories, lest you become complacent.
  153. Decisive blows are often struck [off]-handed. [-- Walter Benjamin]
  154. Subtlety in wisdom is saying one thing and meaning three, all true.
  155. The day and night is divided into: Oh my God, what are we doing up this late 'ning, defined as between two and six AM, morning, six to ten, midday, ten to two, afternoon, two to six, evening, six to ten, and gweepning, ten to two.
  156. You're only given a little spark of madness, [don't] lose it. [-- Robin Williams]
  157. Reality is just a crutch for people who can't cope with drugs. [-- Robin Williams]
  158. Perfection is achieved not when nothing more can be added, but when nothing else can be taken away.
  159. When inundated with choices, confidence in your choice is substantially reduced; eliminate the distraction of choice wherever possible.
  160. When in doubt, try it out, and don't forget to measure.
  161. Failure is always an option. It is the default option.
  162. No matter where you go, there you are.
  163. Any project needs two lines drawn: a success condition, where you can dust your hands off and call it done, and a failure condition, where hope is abandoned and a new approach, or project, begun.
  164. All code is bad and makes you feel terrible six months after you've written it. You can't let reminders of past inefficiencies distract from forward progress.
  165. The more you learn, the more you fundamentally grok the underlying mechanisms and principles and see how everything is the same. This holds for programming languages, frameworks, and people.
  166. If the hammer works, I don't care what language the person who made it spoke.
  167. Complexity is the mind-killer; the little-death that brings total obliteration.
  168. Any Fundamental Concept™ is more amusing with title case and a trademark symbol or an exclamation mark.
  169. Do not confuse Science! with science.
  170. Treat your client's data with more respect (security, care, thought) than your client does.
  171. Code is magic. A choose-your-own adventure novel written using words of power.
  172. Don't do what you can delegate, don't delegate what you can automate, and don't automate what you can eliminate.
  173. “He who takes offense when offense was not intended is a fool, yet he who takes offense when offense is intended is an even greater fool for he has succumbed to the will of his adversary.” — Brigham Young
  174. Compare yourself to who you were yesterday, not to who someone else is today.

Alice's Laws, Rationale

9. Never look back, all obstacles are ahead.

While it can be useful to review, the "obstacles are ahead" thing relates to future planning and project survival. The past only contains solved and unsolved problems, but the consequences of those are ahead. In a similar vein to the quote "if one is busy studying history, one does not make history".

32. Flat is better than nested.

http://s.webcore.io/2Z0y2S3x2331

pretend this is more than just a 1/0 in the immediate controller. It only gets deeper in real code. That's "my face" levels of stack nesting that makes it much harder to dianose and debug issues through sheer signal to noise ratio.

http://s.webcore.io/2x0U0T2e1I2f

WebCore 2 is now… not nearly as in your face with the stack. Flat is better than nested here. (Callbacks > middleware.)

It relates to overall algorithmic thinking, too. Recursive is an almost universally worse approach than any other.

Object dispatch, for example, could be recursive.

def find(obj, path):
	part, *path = path
	obj = getattr(obj)
	if path: obj = find(obj, path)
	return obj

But… there's simply no need for the function calls at all when a loop will do.

def find(obj, path):
	for part in path:
		obj = getattr(obj, part)
	return obj

Which do you think is more efficient? Or robust?

37. Errors should never pass silently. \ Unless explicitly silenced

I have an interesting recent example for this one.

https://github.com/V0idExp/marrow.mailer/commit/273129298ed16af7717082aba2deda125f5986ec#diff-889ca38a0e30b9543d868965549b8719R47

In this example, if no manager is available, there is no possibility of forward progress or success. That's an error that should most definitely not pass silently, as this patch attempts to make happen.

https://github.com/V0idExp/marrow.mailer/commit/273129298ed16af7717082aba2deda125f5986ec#diff-889ca38a0e30b9543d868965549b8719R73

Similarly, this section, armouring the message defaults, would defer the fault until one attempts to construct a Message instance, far removing the unexpected behaviour (which would silently happen; it'd just be missing) from the actual source of the problem.

A true "error" is something that indicates a process has failed beyond recovery, or that some critical expectation has failed. Explicitly silencing such a thing would generally involve explicitly passing in a dummy configuration, or fixing the problem. Passing silently just obfuscates things and hinders correction.

54. Good design is magical.

I can agree that this one may be a touch nebulous and require clarification, or may be possibly misleading.

Magical is not meant in the terms of phyiscally impossible or logic-defying "magical powers". It's meant in the "beautiful or delightful in a way that seems removed from everyday life" way.

There are many factors that might go into making an API, UX, or other subject matter magical in this way. For API and UX, simplicity and obviousness are key components.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment