Successfully reported this slideshow.

To Code Is Human

2

Share

Upcoming SlideShare
UED 102 STUDY SKILLS
UED 102 STUDY SKILLS
Loading in …3
×
1 of 25
1 of 25

To Code Is Human

2

Share

Download to read offline

Combining the art of programming with the science of cognitive psychology to emerge with a set of simple, proven techniques that enable programmers to work more effectively.

Combining the art of programming with the science of cognitive psychology to emerge with a set of simple, proven techniques that enable programmers to work more effectively.

More Related Content

Related Books

Free with a 14 day trial from Scribd

See all

Related Audiobooks

Free with a 14 day trial from Scribd

See all

To Code Is Human

  1. 1. to code is human
  2. 2. programmers are machines that turn coffee into bugs features
  3. 3. software can only be as healthy as the engineers that create it
  4. 4. manage your energy, not your time
  5. 5. get enough sleep
  6. 6. human beings are rhythmic creatures establish a daily routine
  7. 7. your brain is powered by food garbage in, garbage out
  8. 8. motion is life
  9. 9. sleep, diet, and exercise form the foundation for consistent energy
  10. 10. to get the most out of our brains we need to understand how they work
  11. 11. for approximately 40 minutes per day you are completely blind
  12. 12. human working memory can hold 7±2 items at any one time
  13. 13. lines must be less than 80 characters maximum 5-7 lines of code in a method no more than 3 levels of indentation
  14. 14. def self.to_rgb(c) c.length == 3 ? c.scan(/[0-9a-f]/).map {|v| v.to_i(16)*16}) : c.scan(/[0-9a-f]{2}/i).map {|v| v.to_i(16)} end
  15. 15. we have evolved to remember stories
  16. 16. code that reads like well-written prose gets a cognitive fast-track for both comprehension and recall
  17. 17. HEXDIGIT = /[0-9a-f]/i def to_rgb(color) short_to_rgb(color) || long_to_rgb(color) end def short_to_rgb(color) return unless (color =~ /#{HEXDIGIT}{3}/) color.scan(/#{HEXDIGIT}/).map { |v| v.to_i(16) * 16 } end def long_to_rgb(color) return unless (color =~ /#{HEXDIGIT}{6}/) color.scan(/#{HEXDIGIT}{2}/).map { |v| v.to_i(16) } end
  18. 18. decisions are hard
  19. 19. discipline is overrated build effective habits instead
  20. 20. the reward cycle
  21. 21. test-driven development
  22. 22. human speech is really distracting because we have evolved to focus on it
  23. 23. pair programming
  24. 24. create an environment where excellence is the path of least resistance
  25. 25. werve.net | @matadon

Editor's Notes

  • “dhh stick with rails” — focus on computational efficiency
    but neglect our most important tools
    software engineering — not algorithms — human infrastructure
    old joke: “mathematicians turn coffee into theorems”
  • mind is an incredible machine
    to get the most out, learn how it works and how to maintain
    good investment is quality machines — best investment in human infra
    start with hardware
  • fail to care for hardware then software suffers — piku and anti-work
    body not infinite capacity — what do we want to optimize hardware for?
    strength/speed probably not important
    consistent energy delivery — often ignored but keeps us in the zone
  • people obsess over getting more hours
    pulling all-nighters, caffeine / nootropic drugs (alcohol joke)
    goal is quality hours — image if all your hours were in the zone
    most fundamental thing to getting quality hours…
  • don’t cut sleep to get more time — better hours, not more hours
    wake at regular time, go to bed when tired — even weekends (jetlag)
    alcohol reduces REM, sleep just as long, but less rested
    my tool: bedtime on iOS — sleep important because it sets daily rhythm
  • our bodies have two rhythms: daylight and food (jetlag)
    eating, sleeping, waking, and working at the same time every day
    reduces stress, increases energy, and boosts focus
    my tools: calendar everything, same schedule on weekends
  • you don’t need to live off organic tofu
    but your brain can only work as well as the fuel you put in
    insulin sensitivity and energy spikes
    my tools: weekly meal planning, slow carbs, avoid processed food
  • exercise — documented benefits; endorphins, blood flow == brain good
    don’t focus on the best, focus on what you will actually do
    try things until you find what you like
    my tools: first step / incrementalism / progress tracking
  • can not stress how important these are
    consistent energy puts us at the top of our game
    great hardware requires great software — to write great software…
  • good rubyists know the quirks of the language
    creative professionals — most valuable tools are our minds
    like any tool — optimal use — limitations
    there’s a lot you might not know about your brain…
  • saccade blindness — narrow focus for the eye, so it moves
    actually the fastest motion in the human body
    > 20 degrees == head movement (half monitor)
    long lines and functions are exhausting to scan
    principle discovered by ancient typographers
  • limit to your working memory — degrades not drops
    remember “almost right”
    ever lose track of things while in a function? this is why
  • heard this before — joel spolsky and uncle bob
    complaint: arbitrary rules, like straightjacket, bigger terminals
    now you understand why? cognitive and physical limits
    why matters — you can follow the rules and still end up with
  • extreme example — plenty of “small code” like this in production
    this code (basically) follows all the rules — is “small code” not “readable code”
    three bugs are hidden in this mess
    readability really matters — because of how our memories work
  • writing 10k years, talking for millions of years
    through oral tradition — method of loci (cicero the roman)
    remember my story about the piku bug?
  • code that reads like a story
    has a fast-track to understanding and long-term memory
    …and saves energy!
    if we refactor the above snippet…
  • everything is much clearer
    knowing the rule is good, knowing why helps you apply it
    another interesting aspect of human psychology
  • decision use energy (remember energy?) — limited per day
    story: inmates up for parole, interviews
    fall back on path of least resistance
    discipline means choosing to do the right thing
  • habits are decisions that you have made beforehand
    can’t rely on discipline — teach your brain to do the right thing automatically
    many “best practices” are just good habits that leverage the brain
    one example…
  • reward cycle — dopamine and serotonin
    motivates with anticipation — then rewards — reward fades
    how people get addicted to exercise — new car becomes just a car
    this is motivation — this is why you do… everything; in programming
  • the goal is the feature, not writing tests
    put the busywork first and it becomes part of the goal
    tld relies on discipline, saps energy
  • birds sounding the alarm when a predator nears
    Wernicke's area right behind the ear — speech processing engagement
    headphones block most sound
    what if you could productively engage?
  • engages the speech area of your brain, removes distraction
    real-time code review (remember that reward cycle?)
    review-later *can* work, but it takes more energy and discipline
    energy is a biggie
  • stable energy and health through diet, exercise, sleep, and regularity
    use memory limits, reward cycle, and decision fatigue to your advantage
    by building habits
    for a successful career — as well as a happy life
  • always forget — write articles on how to CTO
    from management to teaching software engineering
    any questions?
  • ×