SlideShare a Scribd company logo
1 of 40
Download to read offline
Back to Basics
Simple, elegant, beautiful code.
Back to Basics
This is not the dinosaur talk.
Back to Basics
Sorry.
What are we
trying to
achieve?
1. Agility.
2. Sustainability.
3. Happiness.
Agility is not about doing sprints
“But we do stand-ups! That makes us agile!”
“We need to get these stories into iterations so that our
project manager can sign off on the project plan.”
“We do the Agile method here.”
“SCRUM.” Because backronyms are a thing.
Agility is not about doing sprints
Agility is the ability to respond rapidly to threat or
opportunity.
Sustainability
… because the professionals go home on time*
.
*
Mostly.
Happiness
Self-evident, much?
What does this
all have to do
with code?
Show us some code
already...
//TODO Implement happiness
What does this all have to do with code?
★ Good development practices allow for both agility and
sustainability. These, in turn, permit happiness.
★ Projects should not slow down when they get larger.
★ New team members should be able to get up to speed
quickly.
★ Teams should be able to scale effectively.
★ People should enjoy what they do.
What is
beautiful code?
I’ll know it when I see
it...
1. Simple.
2. Elegant.
3. Expressive.
4. Never, ever finished.
This is not beautiful.
Tell me: what is the reason
for this class’s existence?
Now tell me: who hasn’t
written code like this
before?
Some quick no-
brainers
There’s an app for that.
//TODO: Spot the sponsors
Use an IoC container
There’s a video
about that.
Use a message bus
Introduce message
brokerage early. It will
save you pain.
There’s a video about
that, too.
Log all the things
Logs are your friend.
Centralised logs are a
better friend.
Centralised, correlated
logs are your bestest
friend ever.
There’s an app for that.
Monitor all the things
New Relic. Raygun. App Insights. Montastic. Pingdom. Seq
dashboards. Consul. Plain old email.
Pick one. Pick them all. Then pay attention :)
Continuous delivery is a thing
When you find a bug in production, you need to be able to:
1. git checkout <that exact revision>
2. git checkout -b hotfix-all-gone-wrong
3. // fix the bug
4. git add -A .
5. git commit -m “Fixed the bug”
6. git push
and then promote that build all the way to production.
Automation is your friend
* Builds should run on:
- every push to every branch
- every single day.
* Automate your deployments.
- This includes your databases!
- And your configuration transforms.
* Polish the F5 experience.
Some quick anti-patterns
Don’t automate the awful
Fixing something does not mean just automating it.
“Hey, all! I just wrote a JavaScript snippet to re-run all
the failed pipelines.”
“We had too many manual deployment processes so I wrote
batch files for all of them.”
“I put the test runners inside a loop.We run them up to ten
times each before giving up.”
If your DBA makes your schema changes...
… you're doing it wrong.
Stored procs are so 1990s...
Flares belong in the 1970s.
Mullets? 1980s.
Stored procs are from the 90s.
Don’t ask about stonewashed jeans or flannel.
Let the exceptions throw
If you can handle it and continue, do so. Otherwise, you’re
broken. Accept this. Move on.
Don’t string.Format(...) your exceptions. It makes them
harder to group in the logs. Use the Exception.Data property
bag instead. And log this.
Booleans are not your friend
if (!human.CanAcquirePet(pet)) throw new DomainException
(“This human may not acquire a pet.”);
var reasons = human.CannotAcquirePet(pet);
if (reasons.Any()) throw new DomainException(“This human may
not acquire a pet”).WithReasons(reasons);
Get inside the
head of whoever
comes next
Smart me codes for stupid
me.
//It’s dark in here.
//TODO: Find a way out
//TODO: Make the voices
stop!!!
//TODO: Show them some
code already...
Beautiful code is a mindset
* What am I thinking when I write this?
* What will I be thinking when I read this?
Let’s look at some code
If trip over it you do, fix it you should.
* Don't set traps for yourself.
* Code should be easy to reason about.
* Don’t make me mentally parse irrelevant things.
* Explain what the code achieves, not how it does it.
* Ideally, don't even make me read it.
Your domain model should model your domain
Use your ubiquitous language wisely. It's very powerful.
Check, then do, then announce
public void DoFoo()
{
// Check preconditions
// Do a foo
// Announce that a foo was done
}
Optimise your tests
1. Test by convention.
2. Unit test.
3. Integration test.
4. UI automation.
Adding new features?
Just add code.
Aspect injection is your friend
Weave all the things!
Commenting a decision your code makes?
Consider logging it instead. Future you will thank past you.
if (minions.None()) return; // no minions. Can't take over
the world.
if (minions.None())
{
}Log.Information(“No minions. Can't take over the world.”)(
Some final thoughts
What are we optimising for?
1. Agility.
2. Sustainability.
3. Happiness.
Thank you.

More Related Content

What's hot

team++; making your team work better together
team++; making your team work better togetherteam++; making your team work better together
team++; making your team work better togetherNeil Crosby
 
W jax wenn-code altert
W jax  wenn-code altertW jax  wenn-code altert
W jax wenn-code altertSven Peters
 
Mongoid ate my homework
Mongoid ate my homeworkMongoid ate my homework
Mongoid ate my homeworkslowjud
 
How To Do Kick-Ass Software Development
How To Do Kick-Ass Software DevelopmentHow To Do Kick-Ass Software Development
How To Do Kick-Ass Software DevelopmentSven Peters
 
5 best practices for (web/ software) development (2010)
5 best practices for (web/ software) development (2010)5 best practices for (web/ software) development (2010)
5 best practices for (web/ software) development (2010)Erwin Elling
 
Internship @SlideShare -My Experiences
Internship @SlideShare -My ExperiencesInternship @SlideShare -My Experiences
Internship @SlideShare -My ExperiencesSaket Choudhary
 
DevOps @Scale (Greek Tragedy in 3 Acts) as it was presented at Devoxx 2017
DevOps @Scale (Greek Tragedy in 3 Acts) as it was presented at Devoxx 2017DevOps @Scale (Greek Tragedy in 3 Acts) as it was presented at Devoxx 2017
DevOps @Scale (Greek Tragedy in 3 Acts) as it was presented at Devoxx 2017Baruch Sadogursky
 

What's hot (7)

team++; making your team work better together
team++; making your team work better togetherteam++; making your team work better together
team++; making your team work better together
 
W jax wenn-code altert
W jax  wenn-code altertW jax  wenn-code altert
W jax wenn-code altert
 
Mongoid ate my homework
Mongoid ate my homeworkMongoid ate my homework
Mongoid ate my homework
 
How To Do Kick-Ass Software Development
How To Do Kick-Ass Software DevelopmentHow To Do Kick-Ass Software Development
How To Do Kick-Ass Software Development
 
5 best practices for (web/ software) development (2010)
5 best practices for (web/ software) development (2010)5 best practices for (web/ software) development (2010)
5 best practices for (web/ software) development (2010)
 
Internship @SlideShare -My Experiences
Internship @SlideShare -My ExperiencesInternship @SlideShare -My Experiences
Internship @SlideShare -My Experiences
 
DevOps @Scale (Greek Tragedy in 3 Acts) as it was presented at Devoxx 2017
DevOps @Scale (Greek Tragedy in 3 Acts) as it was presented at Devoxx 2017DevOps @Scale (Greek Tragedy in 3 Acts) as it was presented at Devoxx 2017
DevOps @Scale (Greek Tragedy in 3 Acts) as it was presented at Devoxx 2017
 

Similar to Back to basics simple, elegant, beautiful code

WordCamp US: Clean Code
WordCamp US: Clean CodeWordCamp US: Clean Code
WordCamp US: Clean Codemtoppa
 
Big guns for small guys (reloaded)
Big guns for small guys (reloaded)Big guns for small guys (reloaded)
Big guns for small guys (reloaded)Jorge López-Lago
 
Software Development Essential Skills
Software Development Essential SkillsSoftware Development Essential Skills
Software Development Essential SkillsJohn Choi
 
30% faster coder on-boarding when you have a code cookbook
30% faster coder on-boarding when you have a code cookbook30% faster coder on-boarding when you have a code cookbook
30% faster coder on-boarding when you have a code cookbookGabriel Paunescu 🤖
 
Scottish Ruby Conference 2014
Scottish Ruby Conference  2014Scottish Ruby Conference  2014
Scottish Ruby Conference 2014michaelag1971
 
TDD and Simple Design Workshop - Session 1 - March 2019
TDD and Simple Design Workshop - Session 1 - March 2019TDD and Simple Design Workshop - Session 1 - March 2019
TDD and Simple Design Workshop - Session 1 - March 2019Paulo Clavijo
 
From 🤦 to 🐿️
From 🤦 to 🐿️From 🤦 to 🐿️
From 🤦 to 🐿️Ori Pekelman
 
Rasmus, Think Again! Agile Framework == Happy Php Developer
Rasmus, Think Again! Agile Framework == Happy Php DeveloperRasmus, Think Again! Agile Framework == Happy Php Developer
Rasmus, Think Again! Agile Framework == Happy Php DeveloperArno Schneider
 
My solution to malware.lu HackGyver's challenges.
My solution to malware.lu HackGyver's challenges.My solution to malware.lu HackGyver's challenges.
My solution to malware.lu HackGyver's challenges.Aodrulez
 
Life in the tech trenches (2015)
Life in the tech trenches (2015)Life in the tech trenches (2015)
Life in the tech trenches (2015)Julien SIMON
 
CTO Crunch avec Julien Simon, Viadeo
CTO Crunch avec Julien Simon, ViadeoCTO Crunch avec Julien Simon, Viadeo
CTO Crunch avec Julien Simon, ViadeoFrance Digitale
 
You shouldneverdo
You shouldneverdoYou shouldneverdo
You shouldneverdodaniil3
 
Agile Development Overview (with a bit about builds)
Agile Development Overview (with a bit about builds)Agile Development Overview (with a bit about builds)
Agile Development Overview (with a bit about builds)David Benjamin
 
Black Ops Testing Workshop from Agile Testing Days 2014
Black Ops Testing Workshop from Agile Testing Days 2014Black Ops Testing Workshop from Agile Testing Days 2014
Black Ops Testing Workshop from Agile Testing Days 2014Alan Richardson
 
10 tips to save you time and frustration while programming
10 tips to save you time and frustration while programming10 tips to save you time and frustration while programming
10 tips to save you time and frustration while programmingHugo Shi
 
Resisting The Feature Creature
Resisting The Feature CreatureResisting The Feature Creature
Resisting The Feature CreatureChristian Heilmann
 

Similar to Back to basics simple, elegant, beautiful code (20)

WordCamp US: Clean Code
WordCamp US: Clean CodeWordCamp US: Clean Code
WordCamp US: Clean Code
 
Big guns for small guys (reloaded)
Big guns for small guys (reloaded)Big guns for small guys (reloaded)
Big guns for small guys (reloaded)
 
Software Development Essential Skills
Software Development Essential SkillsSoftware Development Essential Skills
Software Development Essential Skills
 
30% faster coder on-boarding when you have a code cookbook
30% faster coder on-boarding when you have a code cookbook30% faster coder on-boarding when you have a code cookbook
30% faster coder on-boarding when you have a code cookbook
 
Scottish Ruby Conference 2014
Scottish Ruby Conference  2014Scottish Ruby Conference  2014
Scottish Ruby Conference 2014
 
TxJS 2011
TxJS 2011TxJS 2011
TxJS 2011
 
TDD and Simple Design Workshop - Session 1 - March 2019
TDD and Simple Design Workshop - Session 1 - March 2019TDD and Simple Design Workshop - Session 1 - March 2019
TDD and Simple Design Workshop - Session 1 - March 2019
 
From 🤦 to 🐿️
From 🤦 to 🐿️From 🤦 to 🐿️
From 🤦 to 🐿️
 
Rasmus, Think Again! Agile Framework == Happy Php Developer
Rasmus, Think Again! Agile Framework == Happy Php DeveloperRasmus, Think Again! Agile Framework == Happy Php Developer
Rasmus, Think Again! Agile Framework == Happy Php Developer
 
My solution to malware.lu HackGyver's challenges.
My solution to malware.lu HackGyver's challenges.My solution to malware.lu HackGyver's challenges.
My solution to malware.lu HackGyver's challenges.
 
Is Python still production ready ? Ludovic Gasc
Is Python still production ready ? Ludovic GascIs Python still production ready ? Ludovic Gasc
Is Python still production ready ? Ludovic Gasc
 
Life in the tech trenches (2015)
Life in the tech trenches (2015)Life in the tech trenches (2015)
Life in the tech trenches (2015)
 
CTO Crunch avec Julien Simon, Viadeo
CTO Crunch avec Julien Simon, ViadeoCTO Crunch avec Julien Simon, Viadeo
CTO Crunch avec Julien Simon, Viadeo
 
Spaghetti gate
Spaghetti gateSpaghetti gate
Spaghetti gate
 
You shouldneverdo
You shouldneverdoYou shouldneverdo
You shouldneverdo
 
Agile Development Overview (with a bit about builds)
Agile Development Overview (with a bit about builds)Agile Development Overview (with a bit about builds)
Agile Development Overview (with a bit about builds)
 
Black Ops Testing Workshop from Agile Testing Days 2014
Black Ops Testing Workshop from Agile Testing Days 2014Black Ops Testing Workshop from Agile Testing Days 2014
Black Ops Testing Workshop from Agile Testing Days 2014
 
Notes on Debugging
Notes on DebuggingNotes on Debugging
Notes on Debugging
 
10 tips to save you time and frustration while programming
10 tips to save you time and frustration while programming10 tips to save you time and frustration while programming
10 tips to save you time and frustration while programming
 
Resisting The Feature Creature
Resisting The Feature CreatureResisting The Feature Creature
Resisting The Feature Creature
 

Recently uploaded

%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrainmasabamasaba
 
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...SelfMade bd
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Modelsaagamshah0812
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnAmarnathKambale
 
Define the academic and professional writing..pdf
Define the academic and professional writing..pdfDefine the academic and professional writing..pdf
Define the academic and professional writing..pdfPearlKirahMaeRagusta1
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Steffen Staab
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...Health
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesVictorSzoltysek
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsJhone kinadey
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech studentsHimanshiGarg82
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfVishalKumarJha10
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️Delhi Call girls
 
ManageIQ - Sprint 236 Review - Slide Deck
ManageIQ - Sprint 236 Review - Slide DeckManageIQ - Sprint 236 Review - Slide Deck
ManageIQ - Sprint 236 Review - Slide DeckManageIQ
 
Chinsurah Escorts ☎️8617697112 Starting From 5K to 15K High Profile Escorts ...
Chinsurah Escorts ☎️8617697112  Starting From 5K to 15K High Profile Escorts ...Chinsurah Escorts ☎️8617697112  Starting From 5K to 15K High Profile Escorts ...
Chinsurah Escorts ☎️8617697112 Starting From 5K to 15K High Profile Escorts ...Nitya salvi
 
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...kalichargn70th171
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfkalichargn70th171
 
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfPayment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfkalichargn70th171
 
Pharm-D Biostatistics and Research methodology
Pharm-D Biostatistics and Research methodologyPharm-D Biostatistics and Research methodology
Pharm-D Biostatistics and Research methodologyAnusha Are
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisamasabamasaba
 

Recently uploaded (20)

%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
 
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
Define the academic and professional writing..pdf
Define the academic and professional writing..pdfDefine the academic and professional writing..pdf
Define the academic and professional writing..pdf
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
ManageIQ - Sprint 236 Review - Slide Deck
ManageIQ - Sprint 236 Review - Slide DeckManageIQ - Sprint 236 Review - Slide Deck
ManageIQ - Sprint 236 Review - Slide Deck
 
Chinsurah Escorts ☎️8617697112 Starting From 5K to 15K High Profile Escorts ...
Chinsurah Escorts ☎️8617697112  Starting From 5K to 15K High Profile Escorts ...Chinsurah Escorts ☎️8617697112  Starting From 5K to 15K High Profile Escorts ...
Chinsurah Escorts ☎️8617697112 Starting From 5K to 15K High Profile Escorts ...
 
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfPayment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
 
Pharm-D Biostatistics and Research methodology
Pharm-D Biostatistics and Research methodologyPharm-D Biostatistics and Research methodology
Pharm-D Biostatistics and Research methodology
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 

Back to basics simple, elegant, beautiful code

  • 1. Back to Basics Simple, elegant, beautiful code.
  • 2. Back to Basics This is not the dinosaur talk.
  • 4.
  • 5. What are we trying to achieve? 1. Agility. 2. Sustainability. 3. Happiness.
  • 6. Agility is not about doing sprints “But we do stand-ups! That makes us agile!” “We need to get these stories into iterations so that our project manager can sign off on the project plan.” “We do the Agile method here.” “SCRUM.” Because backronyms are a thing.
  • 7. Agility is not about doing sprints Agility is the ability to respond rapidly to threat or opportunity.
  • 8. Sustainability … because the professionals go home on time* . * Mostly.
  • 10. What does this all have to do with code? Show us some code already... //TODO Implement happiness
  • 11. What does this all have to do with code? ★ Good development practices allow for both agility and sustainability. These, in turn, permit happiness. ★ Projects should not slow down when they get larger. ★ New team members should be able to get up to speed quickly. ★ Teams should be able to scale effectively. ★ People should enjoy what they do.
  • 12. What is beautiful code? I’ll know it when I see it... 1. Simple. 2. Elegant. 3. Expressive. 4. Never, ever finished.
  • 13. This is not beautiful. Tell me: what is the reason for this class’s existence? Now tell me: who hasn’t written code like this before?
  • 14. Some quick no- brainers There’s an app for that. //TODO: Spot the sponsors
  • 15. Use an IoC container There’s a video about that.
  • 16. Use a message bus Introduce message brokerage early. It will save you pain. There’s a video about that, too.
  • 17. Log all the things Logs are your friend. Centralised logs are a better friend. Centralised, correlated logs are your bestest friend ever. There’s an app for that.
  • 18. Monitor all the things New Relic. Raygun. App Insights. Montastic. Pingdom. Seq dashboards. Consul. Plain old email. Pick one. Pick them all. Then pay attention :)
  • 19. Continuous delivery is a thing When you find a bug in production, you need to be able to: 1. git checkout <that exact revision> 2. git checkout -b hotfix-all-gone-wrong 3. // fix the bug 4. git add -A . 5. git commit -m “Fixed the bug” 6. git push and then promote that build all the way to production.
  • 20. Automation is your friend * Builds should run on: - every push to every branch - every single day. * Automate your deployments. - This includes your databases! - And your configuration transforms. * Polish the F5 experience.
  • 22. Don’t automate the awful Fixing something does not mean just automating it. “Hey, all! I just wrote a JavaScript snippet to re-run all the failed pipelines.” “We had too many manual deployment processes so I wrote batch files for all of them.” “I put the test runners inside a loop.We run them up to ten times each before giving up.”
  • 23. If your DBA makes your schema changes... … you're doing it wrong.
  • 24. Stored procs are so 1990s... Flares belong in the 1970s. Mullets? 1980s. Stored procs are from the 90s. Don’t ask about stonewashed jeans or flannel.
  • 25. Let the exceptions throw If you can handle it and continue, do so. Otherwise, you’re broken. Accept this. Move on. Don’t string.Format(...) your exceptions. It makes them harder to group in the logs. Use the Exception.Data property bag instead. And log this.
  • 26. Booleans are not your friend if (!human.CanAcquirePet(pet)) throw new DomainException (“This human may not acquire a pet.”); var reasons = human.CannotAcquirePet(pet); if (reasons.Any()) throw new DomainException(“This human may not acquire a pet”).WithReasons(reasons);
  • 27. Get inside the head of whoever comes next Smart me codes for stupid me. //It’s dark in here. //TODO: Find a way out //TODO: Make the voices stop!!! //TODO: Show them some code already...
  • 28. Beautiful code is a mindset * What am I thinking when I write this? * What will I be thinking when I read this?
  • 29. Let’s look at some code
  • 30. If trip over it you do, fix it you should. * Don't set traps for yourself. * Code should be easy to reason about. * Don’t make me mentally parse irrelevant things. * Explain what the code achieves, not how it does it. * Ideally, don't even make me read it.
  • 31. Your domain model should model your domain Use your ubiquitous language wisely. It's very powerful.
  • 32. Check, then do, then announce public void DoFoo() { // Check preconditions // Do a foo // Announce that a foo was done }
  • 33. Optimise your tests 1. Test by convention. 2. Unit test. 3. Integration test. 4. UI automation.
  • 35. Aspect injection is your friend Weave all the things!
  • 36. Commenting a decision your code makes? Consider logging it instead. Future you will thank past you. if (minions.None()) return; // no minions. Can't take over the world. if (minions.None()) { }Log.Information(“No minions. Can't take over the world.”)(
  • 38. What are we optimising for? 1. Agility. 2. Sustainability. 3. Happiness.
  • 39.