Habits of a Responsible
Programmer
Anders Janmyr
@andersjanmyr
http://anders.janmyr.com
Outline
• Definitions
• Programming
• Project
• Life, the Universe and Everything
• Summary
Definitions
Habit
An acquired behavior pattern,
regularly followed,
until it has become almost
involuntary
— dictionary.com
The Conscious Brain
Sequential and Slow
The Unconscious Brain
Parallel and Fast
Habits
Creating Habits

Outsourcing
to our
unconscious
Responsible
Accountable for something
within one's power or control
— dictionary.com
Why Be Responsible?
Programming
Typing
And as for this
non-college bullshit I
got two words for that:
learn to fuckin' type!
— Mr. Pink
Write Clear Code
Consistent
• Follow Conventions
• Constants: SCREAMING_SNAKE_CASE
• HTML Attributes: dash-er-ized
• API: Naming, Ordering,...
Don’t Quick Fix
Short Classes, Functions,
Parameter Lists
Short Classes, Functions,
Parameter Lists
Separate Commands
from Queries
Separate Commands
from Queries
External
Dependencies
• Use as few as practical
• Learn it well
• Wrap them
Refactor
Mercilessly
• When understanding changes
• Prevents bugs and frustration
• Don’t ask for permission!
Balance
Prefer Explicit
Explicit

Implicit

Specific
Concrete
Direct

Generic
Abstract
Indirect

function helloWorld() {
console.lo...
Learn Basic
Techniques
• Iteration and Recursion
• Conditional Code
• Functions and Closures
• Classes, Objects, Immutabil...
Simple vs. Easy
Simple
Singular
Does one thing
Is made of one thing

Easy

Close at hand
Familiar
Learn Advanced
Techniques
• Meta-objects and Reflection
• Monads and Continuations
• Events, Contracts, ...
• Actors, Messa...
Testing
The Scientific Method
Theory

Prediction

Observation

Experiment
What to Unit Test?
Message
Origin

Incoming

Sent to Self

Outgoing

Type

Query

Command

Assert

Assert

result

direct ...
Documentation
README
• Description
• Installation Instructions
• Usage Instructions
• Examples
• Pointers to more documentation
An Overview
System Overview
Drawing
Map

Description
A few pages

Servers
Databases
External services
Domain Overview
Drawing
Map

Description
A few pages

Bounded Context
Core Objects
Main supporting domains
Comments
ASSUMPTION:

As
Few As
Possible
TODO:

WTF:

Anything else
Tools
• The Editor
• The Version Control System
• The Command Line
• A scripting language
• Anything you use on a daily ba...
The Editor
Version Control System
CV, legacy
CV, modern
http://commitlogsfromlastnight.com/
A Good Commit Message
Command Line

sudo lsof -nPi | grep LISTEN |
awk '{printf "%-20s%8s%20sn",$1,$2,$9}'
| sort | uniq
Scripting
What to script?
Alias

Verification
Deployment
Setup
Machines

Code
Generation

Watch
scripts

Editor
Macros
A bash function (≈alias)
Deploy new
Server
Go away,
or I will
replace you
with a very
small
shell script!
Environments
All
Environments
• Setup with

ONE command

• Scripts are continuously maintained
Production
• All configuration, dependencies
• Optimized for speed
• Configured for monitoring
Development
• As similar as possible to production
• Optimized for development speed
• Short feedback cycle
• Watchers, li...
Test
• Test Fixtures
• Mock services
• Recorded API interactions
Project
Compromise
Critique
Own It!
Why? Why? Why?
Estimation
It is better to
ask for
forgiveness than
to ask for
permission!
-- Grace Hopper
Flow
Focus
Know what makes you
happy!
Silva’s 4 rules of
happiness
1. If you like something, enjoy it!
2. If you don’t like something, avoid it!
3. If you don’t...
Urgent

≠

Important

Not Important

Not Urgent

Urgent

Important

✖

✔

✔
Relax
Summary
• Write clean code
• Test
• Script everything
• Learn your tools by heart
• Optimize for flow
Proud!
References
http://anders.janmyr.com

Habits of a
Responsible
Programmer

Anders Janmyr
@andersjanmyr
anders.janmyr@jayway....
Habits of a Responsible Programmer
Habits of a Responsible Programmer
Upcoming SlideShare
Loading in …5
×

Habits of a Responsible Programmer

543
-1

Published on

Published in: Technology
0 Comments
3 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
543
On Slideshare
0
From Embeds
0
Number of Embeds
4
Actions
Shares
0
Downloads
6
Comments
0
Likes
3
Embeds 0
No embeds

No notes for slide

Habits of a Responsible Programmer

  1. 1. Habits of a Responsible Programmer Anders Janmyr @andersjanmyr http://anders.janmyr.com
  2. 2. Outline • Definitions • Programming • Project • Life, the Universe and Everything • Summary
  3. 3. Definitions
  4. 4. Habit An acquired behavior pattern, regularly followed, until it has become almost involuntary — dictionary.com
  5. 5. The Conscious Brain Sequential and Slow
  6. 6. The Unconscious Brain Parallel and Fast
  7. 7. Habits
  8. 8. Creating Habits Outsourcing to our unconscious
  9. 9. Responsible Accountable for something within one's power or control — dictionary.com
  10. 10. Why Be Responsible?
  11. 11. Programming
  12. 12. Typing And as for this non-college bullshit I got two words for that: learn to fuckin' type! — Mr. Pink
  13. 13. Write Clear Code
  14. 14. Consistent • Follow Conventions • Constants: SCREAMING_SNAKE_CASE • HTML Attributes: dash-er-ized • API: Naming, Ordering, etc.
  15. 15. Don’t Quick Fix
  16. 16. Short Classes, Functions, Parameter Lists
  17. 17. Short Classes, Functions, Parameter Lists
  18. 18. Separate Commands from Queries
  19. 19. Separate Commands from Queries
  20. 20. External Dependencies • Use as few as practical • Learn it well • Wrap them
  21. 21. Refactor Mercilessly • When understanding changes • Prevents bugs and frustration • Don’t ask for permission!
  22. 22. Balance
  23. 23. Prefer Explicit Explicit Implicit Specific Concrete Direct Generic Abstract Indirect function helloWorld() { console.log(‘Hello World’); } function helloWorld() { hello(‘World’); } function hello(thing) { var m = ‘Hello ’+ thing; console.log(m); }
  24. 24. Learn Basic Techniques • Iteration and Recursion • Conditional Code • Functions and Closures • Classes, Objects, Immutability
  25. 25. Simple vs. Easy Simple Singular Does one thing Is made of one thing Easy Close at hand Familiar
  26. 26. Learn Advanced Techniques • Meta-objects and Reflection • Monads and Continuations • Events, Contracts, ... • Actors, Message Queues, ...
  27. 27. Testing
  28. 28. The Scientific Method Theory Prediction Observation Experiment
  29. 29. What to Unit Test? Message Origin Incoming Sent to Self Outgoing Type Query Command Assert Assert result direct public side effects Ignore Ignore Expect to send
  30. 30. Documentation
  31. 31. README • Description • Installation Instructions • Usage Instructions • Examples • Pointers to more documentation
  32. 32. An Overview
  33. 33. System Overview Drawing Map Description A few pages Servers Databases External services
  34. 34. Domain Overview Drawing Map Description A few pages Bounded Context Core Objects Main supporting domains
  35. 35. Comments ASSUMPTION: As Few As Possible TODO: WTF: Anything else
  36. 36. Tools • The Editor • The Version Control System • The Command Line • A scripting language • Anything you use on a daily basis
  37. 37. The Editor
  38. 38. Version Control System
  39. 39. CV, legacy
  40. 40. CV, modern
  41. 41. http://commitlogsfromlastnight.com/
  42. 42. A Good Commit Message
  43. 43. Command Line sudo lsof -nPi | grep LISTEN | awk '{printf "%-20s%8s%20sn",$1,$2,$9}' | sort | uniq
  44. 44. Scripting
  45. 45. What to script? Alias Verification Deployment Setup Machines Code Generation Watch scripts Editor Macros
  46. 46. A bash function (≈alias)
  47. 47. Deploy new Server
  48. 48. Go away, or I will replace you with a very small shell script!
  49. 49. Environments
  50. 50. All Environments • Setup with ONE command • Scripts are continuously maintained
  51. 51. Production • All configuration, dependencies • Optimized for speed • Configured for monitoring
  52. 52. Development • As similar as possible to production • Optimized for development speed • Short feedback cycle • Watchers, live reloading, auto testing
  53. 53. Test • Test Fixtures • Mock services • Recorded API interactions
  54. 54. Project
  55. 55. Compromise
  56. 56. Critique
  57. 57. Own It!
  58. 58. Why? Why? Why?
  59. 59. Estimation
  60. 60. It is better to ask for forgiveness than to ask for permission! -- Grace Hopper
  61. 61. Flow
  62. 62. Focus
  63. 63. Know what makes you happy!
  64. 64. Silva’s 4 rules of happiness 1. If you like something, enjoy it! 2. If you don’t like something, avoid it! 3. If you don’t like something and can’t avoid it, change it! 4. If you can’t or choose not to avoid or change it, change your perception of it!
  65. 65. Urgent ≠ Important Not Important Not Urgent Urgent Important ✖ ✔ ✔
  66. 66. Relax
  67. 67. Summary • Write clean code • Test • Script everything • Learn your tools by heart • Optimize for flow
  68. 68. Proud!
  69. 69. References http://anders.janmyr.com Habits of a Responsible Programmer Anders Janmyr @andersjanmyr anders.janmyr@jayway.com
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×