habits of a responsible programmer
TRANSCRIPT
![Page 1: Habits of a Responsible Programmer](https://reader038.vdocuments.us/reader038/viewer/2022103018/55a9c4181a28abad7d8b4766/html5/thumbnails/1.jpg)
Habits of a Responsible Programmer
Anders Janmyr@andersjanmyr
http://anders.janmyr.com
![Page 2: Habits of a Responsible Programmer](https://reader038.vdocuments.us/reader038/viewer/2022103018/55a9c4181a28abad7d8b4766/html5/thumbnails/2.jpg)
Outline
• Definitions
• Programming
• Project
• Life, the Universe and Everything
• Summary
![Page 3: Habits of a Responsible Programmer](https://reader038.vdocuments.us/reader038/viewer/2022103018/55a9c4181a28abad7d8b4766/html5/thumbnails/3.jpg)
Definitions
![Page 4: Habits of a Responsible Programmer](https://reader038.vdocuments.us/reader038/viewer/2022103018/55a9c4181a28abad7d8b4766/html5/thumbnails/4.jpg)
Habit
An acquired behavior pattern, regularly followed,
until it has become almost involuntary
— dictionary.com
![Page 5: Habits of a Responsible Programmer](https://reader038.vdocuments.us/reader038/viewer/2022103018/55a9c4181a28abad7d8b4766/html5/thumbnails/5.jpg)
The Conscious BrainSequential and Slow
![Page 6: Habits of a Responsible Programmer](https://reader038.vdocuments.us/reader038/viewer/2022103018/55a9c4181a28abad7d8b4766/html5/thumbnails/6.jpg)
The Unconscious BrainParallel and Fast
![Page 7: Habits of a Responsible Programmer](https://reader038.vdocuments.us/reader038/viewer/2022103018/55a9c4181a28abad7d8b4766/html5/thumbnails/7.jpg)
Habits
![Page 8: Habits of a Responsible Programmer](https://reader038.vdocuments.us/reader038/viewer/2022103018/55a9c4181a28abad7d8b4766/html5/thumbnails/8.jpg)
Creating Habits
Outsourcing to our
unconscious
![Page 9: Habits of a Responsible Programmer](https://reader038.vdocuments.us/reader038/viewer/2022103018/55a9c4181a28abad7d8b4766/html5/thumbnails/9.jpg)
Responsible
Accountable for somethingwithin one's power or control
— dictionary.com
![Page 10: Habits of a Responsible Programmer](https://reader038.vdocuments.us/reader038/viewer/2022103018/55a9c4181a28abad7d8b4766/html5/thumbnails/10.jpg)
Why Be Responsible?
![Page 11: Habits of a Responsible Programmer](https://reader038.vdocuments.us/reader038/viewer/2022103018/55a9c4181a28abad7d8b4766/html5/thumbnails/11.jpg)
Programming
![Page 12: Habits of a Responsible Programmer](https://reader038.vdocuments.us/reader038/viewer/2022103018/55a9c4181a28abad7d8b4766/html5/thumbnails/12.jpg)
TypingAnd as for this
non-college bullshit I got two words for that:learn to fuckin' type!
— Mr. Pink
![Page 13: Habits of a Responsible Programmer](https://reader038.vdocuments.us/reader038/viewer/2022103018/55a9c4181a28abad7d8b4766/html5/thumbnails/13.jpg)
Write Clear Code
![Page 14: Habits of a Responsible Programmer](https://reader038.vdocuments.us/reader038/viewer/2022103018/55a9c4181a28abad7d8b4766/html5/thumbnails/14.jpg)
Consistent
• Follow Conventions
• Constants: SCREAMING_SNAKE_CASE
• HTML Attributes: dash-er-ized
• API: Naming, Ordering, etc.
![Page 15: Habits of a Responsible Programmer](https://reader038.vdocuments.us/reader038/viewer/2022103018/55a9c4181a28abad7d8b4766/html5/thumbnails/15.jpg)
Don’t Quick Fix
![Page 16: Habits of a Responsible Programmer](https://reader038.vdocuments.us/reader038/viewer/2022103018/55a9c4181a28abad7d8b4766/html5/thumbnails/16.jpg)
Short Classes, Functions, Parameter Lists
![Page 17: Habits of a Responsible Programmer](https://reader038.vdocuments.us/reader038/viewer/2022103018/55a9c4181a28abad7d8b4766/html5/thumbnails/17.jpg)
Short Classes, Functions, Parameter Lists
![Page 18: Habits of a Responsible Programmer](https://reader038.vdocuments.us/reader038/viewer/2022103018/55a9c4181a28abad7d8b4766/html5/thumbnails/18.jpg)
Separate Commands from Queries
![Page 19: Habits of a Responsible Programmer](https://reader038.vdocuments.us/reader038/viewer/2022103018/55a9c4181a28abad7d8b4766/html5/thumbnails/19.jpg)
Separate Commands from Queries
![Page 20: Habits of a Responsible Programmer](https://reader038.vdocuments.us/reader038/viewer/2022103018/55a9c4181a28abad7d8b4766/html5/thumbnails/20.jpg)
External Dependencies
• Use as few as practical
• Learn it well
• Wrap them
![Page 21: Habits of a Responsible Programmer](https://reader038.vdocuments.us/reader038/viewer/2022103018/55a9c4181a28abad7d8b4766/html5/thumbnails/21.jpg)
Refactor Mercilessly
• When understanding changes
• Prevents bugs and frustration
• Don’t ask for permission!
![Page 22: Habits of a Responsible Programmer](https://reader038.vdocuments.us/reader038/viewer/2022103018/55a9c4181a28abad7d8b4766/html5/thumbnails/22.jpg)
Balance
![Page 23: Habits of a Responsible Programmer](https://reader038.vdocuments.us/reader038/viewer/2022103018/55a9c4181a28abad7d8b4766/html5/thumbnails/23.jpg)
Prefer Explicit
ExplicitSpecific
ConcreteDirect
ImplicitGenericAbstractIndirect
function helloWorld() { console.log(‘Hello World’);}
function helloWorld() { hello(‘World’);}
function hello(thing) { var m = ‘Hello ’+ thing; console.log(m);}
![Page 24: Habits of a Responsible Programmer](https://reader038.vdocuments.us/reader038/viewer/2022103018/55a9c4181a28abad7d8b4766/html5/thumbnails/24.jpg)
Learn Basic Techniques
• Iteration and Recursion
• Conditional Code
• Functions and Closures
• Classes, Objects, Immutability
![Page 25: Habits of a Responsible Programmer](https://reader038.vdocuments.us/reader038/viewer/2022103018/55a9c4181a28abad7d8b4766/html5/thumbnails/25.jpg)
Simple vs. Easy
SimpleSingular
Does one thingIs made of one thing
EasyClose at hand
Familiar
![Page 26: Habits of a Responsible Programmer](https://reader038.vdocuments.us/reader038/viewer/2022103018/55a9c4181a28abad7d8b4766/html5/thumbnails/26.jpg)
Learn Advanced Techniques
• Meta-objects and Reflection
• Monads and Continuations
• Events, Contracts, ...
• Actors, Message Queues, ...
![Page 27: Habits of a Responsible Programmer](https://reader038.vdocuments.us/reader038/viewer/2022103018/55a9c4181a28abad7d8b4766/html5/thumbnails/27.jpg)
Testing
![Page 28: Habits of a Responsible Programmer](https://reader038.vdocuments.us/reader038/viewer/2022103018/55a9c4181a28abad7d8b4766/html5/thumbnails/28.jpg)
The Scientific MethodTheory
Prediction
Experiment
Observation
![Page 29: Habits of a Responsible Programmer](https://reader038.vdocuments.us/reader038/viewer/2022103018/55a9c4181a28abad7d8b4766/html5/thumbnails/29.jpg)
What to Unit Test?Query Command
Assertresult
Assert direct publicside e!ects
Ignore Expect to send
Incoming
Type
@sandimetz Apr 2013
Message
IgnoreSent to Self
Outgoing
Origin
Saturday, April 27, 13
![Page 30: Habits of a Responsible Programmer](https://reader038.vdocuments.us/reader038/viewer/2022103018/55a9c4181a28abad7d8b4766/html5/thumbnails/30.jpg)
Documentation
![Page 31: Habits of a Responsible Programmer](https://reader038.vdocuments.us/reader038/viewer/2022103018/55a9c4181a28abad7d8b4766/html5/thumbnails/31.jpg)
README
• Description
• Installation Instructions
• Usage Instructions
• Examples
• Pointers to more documentation
![Page 32: Habits of a Responsible Programmer](https://reader038.vdocuments.us/reader038/viewer/2022103018/55a9c4181a28abad7d8b4766/html5/thumbnails/32.jpg)
An Overview
![Page 33: Habits of a Responsible Programmer](https://reader038.vdocuments.us/reader038/viewer/2022103018/55a9c4181a28abad7d8b4766/html5/thumbnails/33.jpg)
System Overview
DrawingMap
DescriptionA few pages
ServersDatabases
External services
![Page 34: Habits of a Responsible Programmer](https://reader038.vdocuments.us/reader038/viewer/2022103018/55a9c4181a28abad7d8b4766/html5/thumbnails/34.jpg)
Domain Overview
DrawingMap
DescriptionA few pages
Bounded ContextCore Objects
Main supporting domains
![Page 35: Habits of a Responsible Programmer](https://reader038.vdocuments.us/reader038/viewer/2022103018/55a9c4181a28abad7d8b4766/html5/thumbnails/35.jpg)
CommentsASSUMPTION:
TODO:
As Few As Possible
WTF:
Anything else
![Page 36: Habits of a Responsible Programmer](https://reader038.vdocuments.us/reader038/viewer/2022103018/55a9c4181a28abad7d8b4766/html5/thumbnails/36.jpg)
Tools
• The Editor
• The Version Control System
• The Command Line
• A scripting language
• Anything you use on a daily basis
![Page 37: Habits of a Responsible Programmer](https://reader038.vdocuments.us/reader038/viewer/2022103018/55a9c4181a28abad7d8b4766/html5/thumbnails/37.jpg)
The Editor
![Page 38: Habits of a Responsible Programmer](https://reader038.vdocuments.us/reader038/viewer/2022103018/55a9c4181a28abad7d8b4766/html5/thumbnails/38.jpg)
Version Control System
![Page 39: Habits of a Responsible Programmer](https://reader038.vdocuments.us/reader038/viewer/2022103018/55a9c4181a28abad7d8b4766/html5/thumbnails/39.jpg)
CV, legacy
![Page 40: Habits of a Responsible Programmer](https://reader038.vdocuments.us/reader038/viewer/2022103018/55a9c4181a28abad7d8b4766/html5/thumbnails/40.jpg)
CV, modern
![Page 41: Habits of a Responsible Programmer](https://reader038.vdocuments.us/reader038/viewer/2022103018/55a9c4181a28abad7d8b4766/html5/thumbnails/41.jpg)
http://commitlogsfromlastnight.com/
![Page 42: Habits of a Responsible Programmer](https://reader038.vdocuments.us/reader038/viewer/2022103018/55a9c4181a28abad7d8b4766/html5/thumbnails/42.jpg)
A Good Commit Message
![Page 43: Habits of a Responsible Programmer](https://reader038.vdocuments.us/reader038/viewer/2022103018/55a9c4181a28abad7d8b4766/html5/thumbnails/43.jpg)
Command Line
sudo lsof -nPi | grep LISTEN |awk '{printf "%-20s%8s%20s\n",$1,$2,$9}'| sort | uniq
![Page 44: Habits of a Responsible Programmer](https://reader038.vdocuments.us/reader038/viewer/2022103018/55a9c4181a28abad7d8b4766/html5/thumbnails/44.jpg)
Scripting
![Page 45: Habits of a Responsible Programmer](https://reader038.vdocuments.us/reader038/viewer/2022103018/55a9c4181a28abad7d8b4766/html5/thumbnails/45.jpg)
What to script?Alias
DeploymentVerification
Code Generation
Watch scripts
Setup Machines
Editor Macros
![Page 46: Habits of a Responsible Programmer](https://reader038.vdocuments.us/reader038/viewer/2022103018/55a9c4181a28abad7d8b4766/html5/thumbnails/46.jpg)
A bash function (≈alias)
![Page 47: Habits of a Responsible Programmer](https://reader038.vdocuments.us/reader038/viewer/2022103018/55a9c4181a28abad7d8b4766/html5/thumbnails/47.jpg)
Deploy new Server
![Page 48: Habits of a Responsible Programmer](https://reader038.vdocuments.us/reader038/viewer/2022103018/55a9c4181a28abad7d8b4766/html5/thumbnails/48.jpg)
Go away,or I will replace you with a very small shell script!
![Page 49: Habits of a Responsible Programmer](https://reader038.vdocuments.us/reader038/viewer/2022103018/55a9c4181a28abad7d8b4766/html5/thumbnails/49.jpg)
Environments
![Page 50: Habits of a Responsible Programmer](https://reader038.vdocuments.us/reader038/viewer/2022103018/55a9c4181a28abad7d8b4766/html5/thumbnails/50.jpg)
All Environments
• Setup with ONE command
• Scripts are continuously maintained
![Page 51: Habits of a Responsible Programmer](https://reader038.vdocuments.us/reader038/viewer/2022103018/55a9c4181a28abad7d8b4766/html5/thumbnails/51.jpg)
Production
• All configuration, dependencies
• Optimized for speed
• Configured for monitoring
![Page 52: Habits of a Responsible Programmer](https://reader038.vdocuments.us/reader038/viewer/2022103018/55a9c4181a28abad7d8b4766/html5/thumbnails/52.jpg)
Development
• As similar as possible to production
• Optimized for development speed
• Short feedback cycle
• Watchers, live reloading, auto testing
![Page 53: Habits of a Responsible Programmer](https://reader038.vdocuments.us/reader038/viewer/2022103018/55a9c4181a28abad7d8b4766/html5/thumbnails/53.jpg)
Test
• Test Fixtures
• Mock services
• Recorded API interactions
![Page 54: Habits of a Responsible Programmer](https://reader038.vdocuments.us/reader038/viewer/2022103018/55a9c4181a28abad7d8b4766/html5/thumbnails/54.jpg)
Project
![Page 55: Habits of a Responsible Programmer](https://reader038.vdocuments.us/reader038/viewer/2022103018/55a9c4181a28abad7d8b4766/html5/thumbnails/55.jpg)
Compromise
![Page 56: Habits of a Responsible Programmer](https://reader038.vdocuments.us/reader038/viewer/2022103018/55a9c4181a28abad7d8b4766/html5/thumbnails/56.jpg)
Critique
![Page 57: Habits of a Responsible Programmer](https://reader038.vdocuments.us/reader038/viewer/2022103018/55a9c4181a28abad7d8b4766/html5/thumbnails/57.jpg)
Own It!
![Page 58: Habits of a Responsible Programmer](https://reader038.vdocuments.us/reader038/viewer/2022103018/55a9c4181a28abad7d8b4766/html5/thumbnails/58.jpg)
Why? Why? Why?
![Page 59: Habits of a Responsible Programmer](https://reader038.vdocuments.us/reader038/viewer/2022103018/55a9c4181a28abad7d8b4766/html5/thumbnails/59.jpg)
Estimation
![Page 60: Habits of a Responsible Programmer](https://reader038.vdocuments.us/reader038/viewer/2022103018/55a9c4181a28abad7d8b4766/html5/thumbnails/60.jpg)
It is better to ask for
forgiveness than to ask for
permission!-- Grace Hopper
![Page 61: Habits of a Responsible Programmer](https://reader038.vdocuments.us/reader038/viewer/2022103018/55a9c4181a28abad7d8b4766/html5/thumbnails/61.jpg)
![Page 62: Habits of a Responsible Programmer](https://reader038.vdocuments.us/reader038/viewer/2022103018/55a9c4181a28abad7d8b4766/html5/thumbnails/62.jpg)
Flow
![Page 63: Habits of a Responsible Programmer](https://reader038.vdocuments.us/reader038/viewer/2022103018/55a9c4181a28abad7d8b4766/html5/thumbnails/63.jpg)
Focus
![Page 64: Habits of a Responsible Programmer](https://reader038.vdocuments.us/reader038/viewer/2022103018/55a9c4181a28abad7d8b4766/html5/thumbnails/64.jpg)
![Page 65: Habits of a Responsible Programmer](https://reader038.vdocuments.us/reader038/viewer/2022103018/55a9c4181a28abad7d8b4766/html5/thumbnails/65.jpg)
Know what makes you happy!
![Page 66: Habits of a Responsible Programmer](https://reader038.vdocuments.us/reader038/viewer/2022103018/55a9c4181a28abad7d8b4766/html5/thumbnails/66.jpg)
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!
![Page 67: Habits of a Responsible Programmer](https://reader038.vdocuments.us/reader038/viewer/2022103018/55a9c4181a28abad7d8b4766/html5/thumbnails/67.jpg)
Not Important Important
Not Urgent
Urgent
✖ ✔
✔
Urgent ≠ Important
![Page 68: Habits of a Responsible Programmer](https://reader038.vdocuments.us/reader038/viewer/2022103018/55a9c4181a28abad7d8b4766/html5/thumbnails/68.jpg)
Relax
![Page 69: Habits of a Responsible Programmer](https://reader038.vdocuments.us/reader038/viewer/2022103018/55a9c4181a28abad7d8b4766/html5/thumbnails/69.jpg)
Summary
• Write clean code
• Test
• Script everything
• Learn your tools by heart
• Optimize for flow
![Page 70: Habits of a Responsible Programmer](https://reader038.vdocuments.us/reader038/viewer/2022103018/55a9c4181a28abad7d8b4766/html5/thumbnails/70.jpg)
Proud!
![Page 71: Habits of a Responsible Programmer](https://reader038.vdocuments.us/reader038/viewer/2022103018/55a9c4181a28abad7d8b4766/html5/thumbnails/71.jpg)
Habits of a Responsible Programmer
Anders Janmyr@andersjanmyr
References http://anders.janmyr.com