Today I Learned

TIL, 2018-02-08, 99 Bottles


  • Repeat: Ruby is dynamically and STRONGLY typed. Meaning once you know the type of object, it expects you to do something with it that makes sense. You can’t do “3” + 3. Reference (You can do this in JS.)
  • I like this article: Remain professional even after your death. Reference
  • Reviewing GraphQL and checking out type systems for Ruby. Uh so there were a lot of attempts but I don’t think anything actually stuck?
  • Hacker News, toys: Companies often didn’t start as “toys”. Toys = everything an idea needs except being important. Companies like Facebook, Airbnb looked like toys at first, but they made people happy. Reference
    • Ice skates or ear muffs? Ice skates = allow you to do something new that you didn’t even know you had a demand for. Ear muffs = solve a problem that you were already solving poorly.
    • Entertainment = business. Movies, video games, comic books, frisbee.
    • Dropbox, Google, Uber, Airbnb can be argued as toys. For Facebook, from the perspective of marketers, they are not toys.
    • Postman: started as a browser extension first, but it became a tool. It hides its advanced features like a sliding door, they have to exist, and they have to be discoverable.

99 Bottles

  • Changing indentation = conditionals.
  • Changing color = changing abstraction levels (method call?).
  • “This code contains a deeply non-object-oriented pattern: the flocked five methods take an argument, examine it, and then supply behavior for it.”
  • “As an OO practitioner, when you see a conditional, the hairs on your neck should stand up. Its very presence ought to offend your sensibilities. You should feel entitled to send messages to objects, and look for a way to write code that allows you to do so.”
  • You use conditionals to select classes to use. Not behaviors to do.
  • I thin this is why you have the code smell Primitive Obsession. The problem with primitives is that you can’t add custom behavior to them. So you can extract this class with a smarter object rather than the primitive.
  • You can temporarily do things like def container(delete_me=nil) so the refactored code doesn’t break the tests.

Programming Elixir

  • Much more idiomatic to use pattern matching.
  • There’s cond and case.
  • mix is the Elixir CL utility that manages Elixir’s projects.

This project is maintained by daryllxd