Coding Fast and Slow

Baruch Sadogursky - @jbaru ch × Developer Productivity Advocate × Gradle Inc × Development -> DevOps -> #DPE

shownotes × × × × speaking.jbaru.ch Slides Video All the links!

A bat and a ball cost $1.10 in total. The bat costs $1 more than the ball. How much does the ball cost?

How much does the ball cost? C10 + $1.10 = $1.20 C5 + $1.5 = $1.10

Two systems x x x x x Fast Intuitive Automatic Emotional Cheap and eager x x x x x Slow Analytical Controlled Logical Expensive and lazy

Remember the following numb × × × × × ers: 34687 56820 76378 90824 11247 9

You have “mental fuel”

Attention and Capacity Limits in Perception: A Cellular Metabolism Account × × × × BNIRS and oxCCO Cellular Metabolism as Mental Fuel Finite Energy Supply High Load Mode vs Low Load Mode 19

Which system do we use for co d ing? x x x x x Fast Intuitive Automatic Emotional Cheap and Eager x x x x x Slow Analytical Controlled Logical Expensive and Lazy

effortless

26

def calculate_discount(price, discount): # Calculate the final price after discount final_price = price - (price * discount / 100) print(f”The final price after a {discount}% discount is: {final_price}”) return final_price # Example usage calculate_discount(100, 10)

How Many Triangles?

def calculate_tax(amount, tax_rate): # Calculate the total amount after tax total_amount = amount + (amount * tax_rate) print(f”The total amount with tax is: {total_amount}”) return total_amount # Example usage calculate_tax(100, 5)

The problem: × You deplete your fuel by contextswitching × You’re not in the flow because of context-switching × Loose-loose: you need more fuel needed, but you have less fuel

When we are tired, we produce worse code × “Developers are cutting corners on quality when fatigued.” (duh)

But We don’t know when to qu x x x it Parole Judges issued fewer paroles when tired and/or hungry Granting parole requires System 2 The Judges didn’t realize they had switched to System 1

Real-life outcome: you run on system one x x x x x Fast Intuitive Automatic Emotional Cheap and Eager x x x x x Slow Analytical Controlled Logical Expensive and Lazy

Which sucks less? Bad code “OK” code

The problem of “ok code” It looks “OK” to us System 1 It looks “OK” to PR review System 1 It looks “OK” to pipelines System 1

Next thing you know: You have an “ok” product

Invest in The goal: Running on System 2 all-day

Time Management Strategies × Time Blocking × Pomodoro Technique × Task Batching

Mindfulness and Cognitive Pra ctices × Mindfulness and Meditation × Reflective Practices × Single-tasking

Workspace and Interruption M anagement × Workspace Organization × Notification Management × Prioritization Techniques

Physical and Mental Well-bein g × Physical Exercise × Breaks and Downtime

And… Developer productivity Engineering!

Developer Productivity Enginee Foster Faster Feedback Collaborate through Effective Tooling Eliminate Toil for Developers Dedicated Organizational Mindset ring Embrace Rigorous Observability for Proactive Improvement Prioritize Automation and Eliminate Bottlenecks Outcomes Over Output

“Faster foster feedback” saves Speeding up local build minimizes context switch Less context switch saves mental fuel mental fuel Run on System 2 all-day

How can we engineer less con tex × × × × × × t switches? Measure local build times! Caching, local and remote Parallel testing, local and remote Predictive test selection Fight evil flaky tests! Watch your build like a hawk for degradations

What you can do today (for fr ee × × × × × ) Parallel local Local caching Remote caching* Build Scans Win Prizes (a.k.a. speed challenge)

What your company should pa y for × Top development hardware × Develocity (or similar)

Learn more and try it today! × × × × Take the Gradle/Maven Speed Challenge Be DPE Agent of Change! Read the DPE Handbook Watch the DPE Summit videos (published soon!) x speaking.jbaru.ch