SlideShare uma empresa Scribd logo
1 de 24
Baixar para ler 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

Mais conteúdo relacionado

Mais procurados

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
 

Mais procurados (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
 

Semelhante a Software Engineering Best Practices @ Nylas

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
Mike Harris
 

Semelhante a 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#ジョブシステムによるモバイルゲームのパフォーマンス向上テクニック
 

Último

TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
mohitmore19
 
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
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
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
 
+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
 

Último (20)

Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS LiveVip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptx
 
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 🔝✔️✔️
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
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
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
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
 
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 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 ☂️
 
+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...
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
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...
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
 
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...
 
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...
 
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
 

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