SlideShare ist ein Scribd-Unternehmen logo
1 von 40
Downloaden Sie, um offline zu lesen
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.

Weitere ähnliche Inhalte

Was ist angesagt?

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
 

Was ist angesagt? (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
 

Ähnlich wie 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
 

Ähnlich wie 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
 

Kürzlich hochgeladen

Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsAlberto González Trastoy
 
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
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...ICS
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...MyIntelliSource, Inc.
 
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female serviceCALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female serviceanilsa9823
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfkalichargn70th171
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️anilsa9823
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsArshad QA
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...panagenda
 
+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
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxComplianceQuest1
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionSolGuruz
 
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
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerThousandEyes
 
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
 
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
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providermohitmore19
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...kellynguyen01
 

Kürzlich hochgeladen (20)

Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
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 🔝✔️✔️
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female serviceCALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
+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...
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with Precision
 
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
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
 
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
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
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
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
 

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.