Upgrade to Pro — share decks privately, control downloads, hide ads and more …

RedDotRubyConf 2014: Magenta is a Lie - and other tales of abstraction

RedDotRubyConf 2014: Magenta is a Lie - and other tales of abstraction

Abstraction is a fundamental approach in programming. It shapes how we solve problems, it is a defining factor in how we view the internals of software and even the world surrounding it and us. The questions of when, how and what to abstract are some of the biggest in computer science and can make the difference between good and bad code. This talk is a fresh take on different facets of abstractions we encounter, build on and have to fight with.

Konstantin Haase

June 26, 2014
Tweet

More Decks by Konstantin Haase

Other Decks in Technology

Transcript

  1. Magenta is a Lie
    and other tales of abstraction

    View full-size slide

  2. –Zachary Scott
    “Too much magic… Um, you mean in general?
    It can make make stuff simpler to understand, if
    that’s your goal. But it’s easy to go too far.”

    View full-size slide

  3. Basis of Science

    View full-size slide

  4. Picking the right
    abstraction is crucial

    View full-size slide

  5. In Computer Science,
    everything is an
    abstraction

    View full-size slide

  6. With a lot of room for
    interpretation

    View full-size slide

  7. This makes it similar to
    art

    View full-size slide

  8. Abstracting away
    Semantics

    View full-size slide

  9. Generic Algorithms

    View full-size slide

  10. Data Abstraction

    View full-size slide

  11. “Dataless
    Programming”
    RM Balzer - 1967

    View full-size slide

  12. Control Abstraction

    View full-size slide

  13. “Go To Statement
    considered harmfull”
    Edsger Dijkstra, 1968

    View full-size slide

  14. “Protection in
    Programming
    Languages"
    James H. Morris Jr., 1973

    View full-size slide

  15. You should be able to
    reason about modules in
    isolation

    View full-size slide

  16. “Global Variables
    Considered Harmful”
    W.A. Wulf, M. Shaw, 1973

    View full-size slide

  17. Data Abstraction +
    Control Abstraction =
    Object Oriented Programming?

    View full-size slide

  18. #alankayholdingthings

    View full-size slide

  19. –Alan Kay
    “OOP to me means only messaging, local
    retention and protection and hiding of state-
    process, and extreme late-binding of all things.”

    View full-size slide

  20. We make the rules

    View full-size slide

  21. Some rules enable
    good programs
    (For some definition of good.)

    View full-size slide

  22. Single Responsibility
    Principle

    View full-size slide

  23. Liskov Substitution
    Principle

    View full-size slide

  24. Law of Demeter

    View full-size slide

  25. Don’t abstract too
    much, too early

    View full-size slide

  26. Is inheritance a good
    abstraction?

    View full-size slide

  27. Used for type hierarchy
    and implementation
    sharing

    View full-size slide

  28. Strong external
    abstractions allow weak
    internal abstractions

    View full-size slide

  29. Distributed
    Applications

    View full-size slide

  30. Abstraction as a
    Security Issue

    View full-size slide

  31. Almost all attacks rely on
    switching up or down
    abstraction levels

    View full-size slide

  32. Social Engineering

    View full-size slide

  33. UI as Abstraction

    View full-size slide

  34. Is magenta real?

    View full-size slide

  35. Leaky abstraction?

    View full-size slide

  36. Tetrachromacy

    View full-size slide

  37. 2-3% of all women?
    50% of all women?

    View full-size slide

  38. Gene on X
    chromosome
    OPN1MW and OPN1MW2

    View full-size slide

  39. Women could have up
    to six colour cones

    View full-size slide

  40. Mostly dysfunctional

    View full-size slide

  41. At least two confirmed
    cases

    View full-size slide

  42. Seeing millions of
    more colours

    View full-size slide

  43. Why dysfunctional?
    (my own unscientific theory)

    View full-size slide

  44. We don’t see colours
    with our eyes

    View full-size slide

  45. We see colours with
    our brain

    View full-size slide

  46. Our brain adjusts
    colours

    View full-size slide

  47. We don’t see colours we
    don’t have an abstract
    concept for

    View full-size slide

  48. When we learn to speak, colour
    perception switches from left
    brain side to right brain side

    View full-size slide

  49. Himba Tribe (Namibia)

    View full-size slide

  50. zuzu: dark shades of blue, red, green
    and purple
    !
    vapa: white, some shades of yellow
    !
    buru: some shades of green and blue
    !
    dambu: some shades of green, red
    and brown

    View full-size slide

  51. Abstraction happens
    in our minds

    View full-size slide

  52. All abstraction

    View full-size slide

  53. OOP happens in our
    mind, not our computer

    View full-size slide

  54. UI happens in our
    mind, not our computer

    View full-size slide

  55. “Anything that is in the world when you’re born
    is normal and ordinary and is just a natural part
    of the way the world works.
    !
    Anything that's invented between when you’re
    fifteen and thirty-five is new and exciting and
    revolutionary and you can probably get a
    career in it.
    !
    Anything invented after you're thirty-five is
    against the natural order of things”
    –Douglas Adams

    View full-size slide

  56. Countries exist in our
    mind

    View full-size slide

  57. In our collective mind

    View full-size slide

  58. Changing abstractions is
    a basic principle of
    innovation and progress

    View full-size slide

  59. Is magenta a colour?

    View full-size slide