SlideShare a Scribd company logo
1 of 24
Download to read offline
Software Engineering
Best Practices
Ben Gotow (@bengotow)
Computer Science ≠ Software Engineering
• Clean
• Predictable
• Maintainable
• Extensible
• Fast & Efficient
• Mathematically Optimal
• Uses latest language
features
Essentials
• The Mafia Model
• Design Patterns
• Building a Shared Language
• Exceptions aren’t evil
• Anti-patterns
“Design software like
you’re running a mafia.”
• Has one well defined job. Doesn’t ask
questions.
• Has limited knowledge of the rest of the
operation. Others don’t know or care how
he gets the job done.
• Has no secret dealings with others, clean
cut actor.
• Can be replaced—others could do this
specific job if he was “removed.”
• Single Responsibility Principle 

(Robert C. Martin)
• Separation of Concerns 

(Dijkstra)

• Avoid Side Effects

• “Program to an interface, not an
implementation.” (Erich Gamma)
Design Patterns
Patterns make it easy to communicate abstract
ideas about software.
Design Patterns
Command EmitterSingleton
Design Patterns
Command
Encapsulate a request as an object, thereby letting users
parameterize clients with different requests, queue or log
requests, and support undoable operations.
(Tasks in N1 are an implementation of the Command pattern.)
Anti-Patterns (“Code Smells”)
- Copying code into more than three places
- Calling private methods on other classes
- Inspecting state which was not designed to be observed
- Waiting for something to happen using the wall clock
setTimeout I’m looking at you. 😒
Anti-Patterns (“Code Smells”)
Ex: Adding optional parameters that change the behavior of
existing code slightly. “Don’t do this, this one time.”
thread.save({tellUser: true}) thread.save().then(() => {
this.tellUser();
});
Take a break, think about refactoring,
explain the problem to someone else.
Naming Conventions
Naming things is hard, and really important
when building software on a team.
• Functions that return a value should indicate how costly that
value is to retrieve:
thread() // easy
getThread() // hmm, probably not O(1)
fetchThread() // better cache the result of this!
Naming Conventions
• Names should reflect intended use and give you an idea what
is returned:
onClicked() // called in response to an event
newWindow() // always returns a new object
isSending() // always returns a boolean
ensureReady() // may or may not do anything
• Long names are almost always worth it:
finalizeAndPersistNewMessage() // shit is going down
Naming Conventions
• Functions with many parameters should use named hashes:
_onComposeReply: ({thread, message, popout, behavior}) =>
• Leading (or trailing) underscores denote private members:
_doInternalFileWrite myInstanceVar_
this._onComposeReply({

thread: A,
behavior: reply-all,
popout: true
})
Naming Conventions
Exceptions aren’t Evil
Throw exceptions aggressively to protect the
code you write from things it wasn’t intended for.
• If your code makes assumptions, make
assertions.
• If you ever have the option of crashing now, or /
probably/ crashing later downstream, crash
now.
Exceptions aren’t Evil
😍
Code Review
https://paper.dropbox.com/doc/Code-Reviews-using-Phabricator-
LdupUMb1X9SWMyrShmhQB
Write better code, learn new tricks, avoid shipping mistakes,
develop a shared understanding of the codebase.
Code Review
Code Level:
• Clarity
• Function / variable naming
• Test coverage
Architectural Level:
• Does this fit performance requirements?
• Does this follow conventions and patterns used elsewhere?
• Are we comfortable with the limitations of this approach?
• Are changes well contained?
Further Reading
- Design Patterns: Elements of Reusable Object-Oriented
Software (Gang of Four)
- Clean Code: A Handbook of Agile Software Craftmanship (Bob
Martin)
- https://sourcemaking.com/design_patterns
- http://en.clouddesignpattern.org
ben@nylas.com

More Related Content

What's hot

Mythical Man Month Essays on Software Engineering
Mythical Man Month Essays on Software EngineeringMythical Man Month Essays on Software Engineering
Mythical Man Month Essays on Software Engineeringmustafa sarac
 
Extreme programming - a quick and agile overview !
Extreme programming - a quick and agile overview !Extreme programming - a quick and agile overview !
Extreme programming - a quick and agile overview !Vinit Kumar Singh
 
Agile Practices - eXtreme Programming
Agile Practices - eXtreme ProgrammingAgile Practices - eXtreme Programming
Agile Practices - eXtreme ProgrammingAniruddha Chakrabarti
 
ADUF - Adaptable Design Up Front
ADUF -  Adaptable Design Up FrontADUF -  Adaptable Design Up Front
ADUF - Adaptable Design Up FrontHayim Makabee
 
Going extreme-with-extreme-programming
Going extreme-with-extreme-programmingGoing extreme-with-extreme-programming
Going extreme-with-extreme-programmingMichael Green
 
Extreme Programming (XP) for Dummies
Extreme Programming (XP) for DummiesExtreme Programming (XP) for Dummies
Extreme Programming (XP) for DummiesJon McNestrie
 
The Mythical Man Month
The Mythical Man MonthThe Mythical Man Month
The Mythical Man MonthMr Cracker
 
Reducing Technical Debt
Reducing Technical DebtReducing Technical Debt
Reducing Technical DebtHayim Makabee
 
Difference between traditional and agile software development
Difference between traditional and agile software developmentDifference between traditional and agile software development
Difference between traditional and agile software developmentDeepaThirumurugan
 
Xp(Xtreme Programming) presentation
Xp(Xtreme Programming) presentationXp(Xtreme Programming) presentation
Xp(Xtreme Programming) presentationMuaazZubairi
 
Agile software development and extreme Programming
Agile software development and extreme Programming  Agile software development and extreme Programming
Agile software development and extreme Programming Fatemeh Karimi
 
Agile Software Development with XP
Agile Software Development with XPAgile Software Development with XP
Agile Software Development with XPVashira Ravipanich
 
Introduction To Extreme Programming
Introduction To Extreme ProgrammingIntroduction To Extreme Programming
Introduction To Extreme ProgrammingJoe Drumgoole
 
Audrys Kažukauskas - Introduction into Extreme Programming
Audrys Kažukauskas - Introduction into Extreme ProgrammingAudrys Kažukauskas - Introduction into Extreme Programming
Audrys Kažukauskas - Introduction into Extreme ProgrammingAgile Lietuva
 

What's hot (20)

Mythical Man Month Essays on Software Engineering
Mythical Man Month Essays on Software EngineeringMythical Man Month Essays on Software Engineering
Mythical Man Month Essays on Software Engineering
 
Extreme programming - a quick and agile overview !
Extreme programming - a quick and agile overview !Extreme programming - a quick and agile overview !
Extreme programming - a quick and agile overview !
 
Agile Practices - eXtreme Programming
Agile Practices - eXtreme ProgrammingAgile Practices - eXtreme Programming
Agile Practices - eXtreme Programming
 
ADUF - Adaptable Design Up Front
ADUF -  Adaptable Design Up FrontADUF -  Adaptable Design Up Front
ADUF - Adaptable Design Up Front
 
Going extreme-with-extreme-programming
Going extreme-with-extreme-programmingGoing extreme-with-extreme-programming
Going extreme-with-extreme-programming
 
Extreme Programming (XP) for Dummies
Extreme Programming (XP) for DummiesExtreme Programming (XP) for Dummies
Extreme Programming (XP) for Dummies
 
XP In 10 slides
XP In 10 slidesXP In 10 slides
XP In 10 slides
 
Extreme programming (xp)
Extreme programming (xp)Extreme programming (xp)
Extreme programming (xp)
 
The Mythical Man Month
The Mythical Man MonthThe Mythical Man Month
The Mythical Man Month
 
Reducing Technical Debt
Reducing Technical DebtReducing Technical Debt
Reducing Technical Debt
 
Design Sprints
Design SprintsDesign Sprints
Design Sprints
 
Difference between traditional and agile software development
Difference between traditional and agile software developmentDifference between traditional and agile software development
Difference between traditional and agile software development
 
Extreme Programming
Extreme ProgrammingExtreme Programming
Extreme Programming
 
Xp(Xtreme Programming) presentation
Xp(Xtreme Programming) presentationXp(Xtreme Programming) presentation
Xp(Xtreme Programming) presentation
 
Agile software development and extreme Programming
Agile software development and extreme Programming  Agile software development and extreme Programming
Agile software development and extreme Programming
 
Software engineering
Software engineeringSoftware engineering
Software engineering
 
Agile Software Development with XP
Agile Software Development with XPAgile Software Development with XP
Agile Software Development with XP
 
extreme programming
extreme programmingextreme programming
extreme programming
 
Introduction To Extreme Programming
Introduction To Extreme ProgrammingIntroduction To Extreme Programming
Introduction To Extreme Programming
 
Audrys Kažukauskas - Introduction into Extreme Programming
Audrys Kažukauskas - Introduction into Extreme ProgrammingAudrys Kažukauskas - Introduction into Extreme Programming
Audrys Kažukauskas - Introduction into Extreme Programming
 

Similar to Software Engineering Best Practices @ Nylas

Functional Patterns for C++ Multithreading (C++ Dev Meetup Iasi)
Functional Patterns for C++ Multithreading (C++ Dev Meetup Iasi)Functional Patterns for C++ Multithreading (C++ Dev Meetup Iasi)
Functional Patterns for C++ Multithreading (C++ Dev Meetup Iasi)Ovidiu Farauanu
 
cf.Objective() 2017 - Design patterns - Brad Wood
cf.Objective() 2017 - Design patterns - Brad Woodcf.Objective() 2017 - Design patterns - Brad Wood
cf.Objective() 2017 - Design patterns - Brad WoodOrtus Solutions, Corp
 
Evolution of Patterns
Evolution of PatternsEvolution of Patterns
Evolution of PatternsChris Eargle
 
GoF Design patterns I: Introduction + Structural Patterns
GoF Design patterns I:   Introduction + Structural PatternsGoF Design patterns I:   Introduction + Structural Patterns
GoF Design patterns I: Introduction + Structural PatternsSameh Deabes
 
How I Learned to Stop Worrying and Love Legacy Code - Ox:Agile 2018
How I Learned to Stop Worrying and Love Legacy Code - Ox:Agile 2018How I Learned to Stop Worrying and Love Legacy Code - Ox:Agile 2018
How I Learned to Stop Worrying and Love Legacy Code - Ox:Agile 2018Mike Harris
 
Introduction to Design Patterns in Javascript
Introduction to Design Patterns in JavascriptIntroduction to Design Patterns in Javascript
Introduction to Design Patterns in JavascriptSanthosh Kumar Srinivasan
 
Booting into functional programming
Booting into functional programmingBooting into functional programming
Booting into functional programmingDhaval Dalal
 
Java - A broad introduction
Java - A broad introductionJava - A broad introduction
Java - A broad introductionBirol Efe
 
Go Faster With Native Compilation
Go Faster With Native CompilationGo Faster With Native Compilation
Go Faster With Native CompilationPGConf APAC
 
Go faster with_native_compilation Part-2
Go faster with_native_compilation Part-2Go faster with_native_compilation Part-2
Go faster with_native_compilation Part-2Rajeev Rastogi (KRR)
 
【Unite 2017 Tokyo】C#ジョブシステムによるモバイルゲームのパフォーマンス向上テクニック
【Unite 2017 Tokyo】C#ジョブシステムによるモバイルゲームのパフォーマンス向上テクニック【Unite 2017 Tokyo】C#ジョブシステムによるモバイルゲームのパフォーマンス向上テクニック
【Unite 2017 Tokyo】C#ジョブシステムによるモバイルゲームのパフォーマンス向上テクニックUnity Technologies Japan K.K.
 

Similar to Software Engineering Best Practices @ Nylas (20)

Functional Patterns for C++ Multithreading (C++ Dev Meetup Iasi)
Functional Patterns for C++ Multithreading (C++ Dev Meetup Iasi)Functional Patterns for C++ Multithreading (C++ Dev Meetup Iasi)
Functional Patterns for C++ Multithreading (C++ Dev Meetup Iasi)
 
cf.Objective() 2017 - Design patterns - Brad Wood
cf.Objective() 2017 - Design patterns - Brad Woodcf.Objective() 2017 - Design patterns - Brad Wood
cf.Objective() 2017 - Design patterns - Brad Wood
 
Evolution of Patterns
Evolution of PatternsEvolution of Patterns
Evolution of Patterns
 
Agile
AgileAgile
Agile
 
GoF Design patterns I: Introduction + Structural Patterns
GoF Design patterns I:   Introduction + Structural PatternsGoF Design patterns I:   Introduction + Structural Patterns
GoF Design patterns I: Introduction + Structural Patterns
 
How I Learned to Stop Worrying and Love Legacy Code - Ox:Agile 2018
How I Learned to Stop Worrying and Love Legacy Code - Ox:Agile 2018How I Learned to Stop Worrying and Love Legacy Code - Ox:Agile 2018
How I Learned to Stop Worrying and Love Legacy Code - Ox:Agile 2018
 
Introduction to Design Patterns in Javascript
Introduction to Design Patterns in JavascriptIntroduction to Design Patterns in Javascript
Introduction to Design Patterns in Javascript
 
Booting into functional programming
Booting into functional programmingBooting into functional programming
Booting into functional programming
 
Java - A broad introduction
Java - A broad introductionJava - A broad introduction
Java - A broad introduction
 
Design_Patterns_Dr.CM.ppt
Design_Patterns_Dr.CM.pptDesign_Patterns_Dr.CM.ppt
Design_Patterns_Dr.CM.ppt
 
Introduction to Design Patterns
Introduction to Design PatternsIntroduction to Design Patterns
Introduction to Design Patterns
 
10-DesignPatterns.ppt
10-DesignPatterns.ppt10-DesignPatterns.ppt
10-DesignPatterns.ppt
 
Software Engineering
Software EngineeringSoftware Engineering
Software Engineering
 
Go Faster With Native Compilation
Go Faster With Native CompilationGo Faster With Native Compilation
Go Faster With Native Compilation
 
Go Faster With Native Compilation
Go Faster With Native CompilationGo Faster With Native Compilation
Go Faster With Native Compilation
 
Go faster with_native_compilation Part-2
Go faster with_native_compilation Part-2Go faster with_native_compilation Part-2
Go faster with_native_compilation Part-2
 
Design Pattern Automation
Design Pattern AutomationDesign Pattern Automation
Design Pattern Automation
 
Clean Code V2
Clean Code V2Clean Code V2
Clean Code V2
 
Software Design
Software DesignSoftware Design
Software Design
 
【Unite 2017 Tokyo】C#ジョブシステムによるモバイルゲームのパフォーマンス向上テクニック
【Unite 2017 Tokyo】C#ジョブシステムによるモバイルゲームのパフォーマンス向上テクニック【Unite 2017 Tokyo】C#ジョブシステムによるモバイルゲームのパフォーマンス向上テクニック
【Unite 2017 Tokyo】C#ジョブシステムによるモバイルゲームのパフォーマンス向上テクニック
 

Recently uploaded

PREDICTING RIVER WATER QUALITY ppt presentation
PREDICTING  RIVER  WATER QUALITY  ppt presentationPREDICTING  RIVER  WATER QUALITY  ppt presentation
PREDICTING RIVER WATER QUALITY ppt presentationvaddepallysandeep122
 
How to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion ApplicationHow to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion ApplicationBradBedford3
 
Ahmed Motair CV April 2024 (Senior SW Developer)
Ahmed Motair CV April 2024 (Senior SW Developer)Ahmed Motair CV April 2024 (Senior SW Developer)
Ahmed Motair CV April 2024 (Senior SW Developer)Ahmed Mater
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Andreas Granig
 
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanySuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanyChristoph Pohl
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024StefanoLambiase
 
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...confluent
 
Precise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive GoalPrecise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive GoalLionel Briand
 
MYjobs Presentation Django-based project
MYjobs Presentation Django-based projectMYjobs Presentation Django-based project
MYjobs Presentation Django-based projectAnoyGreter
 
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...Angel Borroy López
 
Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEEVICTOR MAESTRE RAMIREZ
 
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...OnePlan Solutions
 
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Matt Ray
 
UI5ers live - Custom Controls wrapping 3rd-party libs.pptx
UI5ers live - Custom Controls wrapping 3rd-party libs.pptxUI5ers live - Custom Controls wrapping 3rd-party libs.pptx
UI5ers live - Custom Controls wrapping 3rd-party libs.pptxAndreas Kunz
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureDinusha Kumarasiri
 
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)jennyeacort
 
A healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdfA healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdfMarharyta Nedzelska
 
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...Natan Silnitsky
 
Innovate and Collaborate- Harnessing the Power of Open Source Software.pdf
Innovate and Collaborate- Harnessing the Power of Open Source Software.pdfInnovate and Collaborate- Harnessing the Power of Open Source Software.pdf
Innovate and Collaborate- Harnessing the Power of Open Source Software.pdfYashikaSharma391629
 

Recently uploaded (20)

PREDICTING RIVER WATER QUALITY ppt presentation
PREDICTING  RIVER  WATER QUALITY  ppt presentationPREDICTING  RIVER  WATER QUALITY  ppt presentation
PREDICTING RIVER WATER QUALITY ppt presentation
 
How to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion ApplicationHow to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion Application
 
Ahmed Motair CV April 2024 (Senior SW Developer)
Ahmed Motair CV April 2024 (Senior SW Developer)Ahmed Motair CV April 2024 (Senior SW Developer)
Ahmed Motair CV April 2024 (Senior SW Developer)
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024
 
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte GermanySuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
SuccessFactors 1H 2024 Release - Sneak-Peek by Deloitte Germany
 
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
Dealing with Cultural Dispersion — Stefano Lambiase — ICSE-SEIS 2024
 
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort ServiceHot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
 
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
 
Precise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive GoalPrecise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive Goal
 
MYjobs Presentation Django-based project
MYjobs Presentation Django-based projectMYjobs Presentation Django-based project
MYjobs Presentation Django-based project
 
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
 
Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEE
 
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
 
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
 
UI5ers live - Custom Controls wrapping 3rd-party libs.pptx
UI5ers live - Custom Controls wrapping 3rd-party libs.pptxUI5ers live - Custom Controls wrapping 3rd-party libs.pptx
UI5ers live - Custom Controls wrapping 3rd-party libs.pptx
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with Azure
 
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
Call Us🔝>༒+91-9711147426⇛Call In girls karol bagh (Delhi)
 
A healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdfA healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdf
 
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
 
Innovate and Collaborate- Harnessing the Power of Open Source Software.pdf
Innovate and Collaborate- Harnessing the Power of Open Source Software.pdfInnovate and Collaborate- Harnessing the Power of Open Source Software.pdf
Innovate and Collaborate- Harnessing the Power of Open Source Software.pdf
 

Software Engineering Best Practices @ Nylas

  • 2. Computer Science ≠ Software Engineering • Clean • Predictable • Maintainable • Extensible • Fast & Efficient • Mathematically Optimal • Uses latest language features
  • 3. Essentials • The Mafia Model • Design Patterns • Building a Shared Language • Exceptions aren’t evil • Anti-patterns
  • 4.
  • 5.
  • 6. “Design software like you’re running a mafia.”
  • 7. • Has one well defined job. Doesn’t ask questions. • Has limited knowledge of the rest of the operation. Others don’t know or care how he gets the job done. • Has no secret dealings with others, clean cut actor. • Can be replaced—others could do this specific job if he was “removed.”
  • 8. • Single Responsibility Principle 
 (Robert C. Martin) • Separation of Concerns 
 (Dijkstra)
 • Avoid Side Effects
 • “Program to an interface, not an implementation.” (Erich Gamma)
  • 9.
  • 10. Design Patterns Patterns make it easy to communicate abstract ideas about software.
  • 12. Design Patterns Command Encapsulate a request as an object, thereby letting users parameterize clients with different requests, queue or log requests, and support undoable operations. (Tasks in N1 are an implementation of the Command pattern.)
  • 13. Anti-Patterns (“Code Smells”) - Copying code into more than three places - Calling private methods on other classes - Inspecting state which was not designed to be observed - Waiting for something to happen using the wall clock setTimeout I’m looking at you. 😒
  • 14. Anti-Patterns (“Code Smells”) Ex: Adding optional parameters that change the behavior of existing code slightly. “Don’t do this, this one time.” thread.save({tellUser: true}) thread.save().then(() => { this.tellUser(); }); Take a break, think about refactoring, explain the problem to someone else.
  • 15. Naming Conventions Naming things is hard, and really important when building software on a team.
  • 16. • Functions that return a value should indicate how costly that value is to retrieve: thread() // easy getThread() // hmm, probably not O(1) fetchThread() // better cache the result of this! Naming Conventions
  • 17. • Names should reflect intended use and give you an idea what is returned: onClicked() // called in response to an event newWindow() // always returns a new object isSending() // always returns a boolean ensureReady() // may or may not do anything • Long names are almost always worth it: finalizeAndPersistNewMessage() // shit is going down Naming Conventions
  • 18. • Functions with many parameters should use named hashes: _onComposeReply: ({thread, message, popout, behavior}) => • Leading (or trailing) underscores denote private members: _doInternalFileWrite myInstanceVar_ this._onComposeReply({
 thread: A, behavior: reply-all, popout: true }) Naming Conventions
  • 19. Exceptions aren’t Evil Throw exceptions aggressively to protect the code you write from things it wasn’t intended for. • If your code makes assumptions, make assertions. • If you ever have the option of crashing now, or / probably/ crashing later downstream, crash now.
  • 21. Code Review https://paper.dropbox.com/doc/Code-Reviews-using-Phabricator- LdupUMb1X9SWMyrShmhQB Write better code, learn new tricks, avoid shipping mistakes, develop a shared understanding of the codebase.
  • 22. Code Review Code Level: • Clarity • Function / variable naming • Test coverage Architectural Level: • Does this fit performance requirements? • Does this follow conventions and patterns used elsewhere? • Are we comfortable with the limitations of this approach? • Are changes well contained?
  • 23. Further Reading - Design Patterns: Elements of Reusable Object-Oriented Software (Gang of Four) - Clean Code: A Handbook of Agile Software Craftmanship (Bob Martin) - https://sourcemaking.com/design_patterns - http://en.clouddesignpattern.org