SlideShare a Scribd company logo
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
Software Engineering Best Practices @ Nylas
Software Engineering Best Practices @ Nylas
“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)
Software Engineering Best Practices @ Nylas
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

PPT
Best Practices - Software Engineering
PPTX
Tdd 4 everyone full version
PDF
Taming Big Balls of Mud with Diligence, Agile Practices, and Hard Work
PDF
Agile archiecture iltam 2014
PDF
Software engineering principles (marcello thiry)
PPT
Software engineering -core topics
PPT
Anti-Patterns
PPTX
Mythical Man-Month
Best Practices - Software Engineering
Tdd 4 everyone full version
Taming Big Balls of Mud with Diligence, Agile Practices, and Hard Work
Agile archiecture iltam 2014
Software engineering principles (marcello thiry)
Software engineering -core topics
Anti-Patterns
Mythical Man-Month

What's hot (20)

PDF
Mythical Man Month Essays on Software Engineering
PPTX
Extreme programming - a quick and agile overview !
PPTX
Agile Practices - eXtreme Programming
PPTX
ADUF - Adaptable Design Up Front
PPTX
Going extreme-with-extreme-programming
PPTX
Extreme Programming (XP) for Dummies
PDF
XP In 10 slides
PPTX
Extreme programming (xp)
PPTX
The Mythical Man Month
PPTX
Reducing Technical Debt
PDF
Design Sprints
PPTX
Difference between traditional and agile software development
PPTX
Extreme Programming
PPTX
Xp(Xtreme Programming) presentation
PPTX
Agile software development and extreme Programming
PPT
Software engineering
PPT
Agile Software Development with XP
PPTX
extreme programming
PPT
Introduction To Extreme Programming
PDF
Audrys Kažukauskas - Introduction into Extreme Programming
Mythical Man Month Essays on Software Engineering
Extreme programming - a quick and agile overview !
Agile Practices - eXtreme Programming
ADUF - Adaptable Design Up Front
Going extreme-with-extreme-programming
Extreme Programming (XP) for Dummies
XP In 10 slides
Extreme programming (xp)
The Mythical Man Month
Reducing Technical Debt
Design Sprints
Difference between traditional and agile software development
Extreme Programming
Xp(Xtreme Programming) presentation
Agile software development and extreme Programming
Software engineering
Agile Software Development with XP
extreme programming
Introduction To Extreme Programming
Audrys Kažukauskas - Introduction into Extreme Programming
Ad

Similar to Software Engineering Best Practices @ Nylas (20)

PDF
Functional Patterns for C++ Multithreading (C++ Dev Meetup Iasi)
PDF
cf.Objective() 2017 - Design patterns - Brad Wood
PPTX
Evolution of Patterns
PPT
01-introduction OOPS concepts in C++ JAVA
PPT
01-introductionto Object ooriented Programming in JAVA CS.ppt
PPTX
Agile
PPT
10-design-patterns1.ppt.software engineering
PPTX
GoF Design patterns I: Introduction + Structural Patterns
PPTX
How I Learned to Stop Worrying and Love Legacy Code - Ox:Agile 2018
PPTX
Introduction to Design Patterns in Javascript
PDF
Booting into functional programming
PPTX
Java - A broad introduction
PPT
Design_Patterns_Dr.CM.ppt
PPTX
Introduction to Design Patterns
PPT
Design patterns represent the best practices used by experienced object-orien...
PPT
10-DesignPatterns.ppt
PDF
Software Engineering
PDF
Go Faster With Native Compilation
PDF
Go Faster With Native Compilation
PDF
Go faster with_native_compilation Part-2
Functional Patterns for C++ Multithreading (C++ Dev Meetup Iasi)
cf.Objective() 2017 - Design patterns - Brad Wood
Evolution of Patterns
01-introduction OOPS concepts in C++ JAVA
01-introductionto Object ooriented Programming in JAVA CS.ppt
Agile
10-design-patterns1.ppt.software engineering
GoF Design patterns I: Introduction + Structural Patterns
How I Learned to Stop Worrying and Love Legacy Code - Ox:Agile 2018
Introduction to Design Patterns in Javascript
Booting into functional programming
Java - A broad introduction
Design_Patterns_Dr.CM.ppt
Introduction to Design Patterns
Design patterns represent the best practices used by experienced object-orien...
10-DesignPatterns.ppt
Software Engineering
Go Faster With Native Compilation
Go Faster With Native Compilation
Go faster with_native_compilation Part-2
Ad

Recently uploaded (20)

PDF
How Creative Agencies Leverage Project Management Software.pdf
PDF
Odoo Companies in India – Driving Business Transformation.pdf
PDF
How to Choose the Right IT Partner for Your Business in Malaysia
PDF
Design an Analysis of Algorithms I-SECS-1021-03
PDF
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
PDF
medical staffing services at VALiNTRY
PPTX
L1 - Introduction to python Backend.pptx
PDF
top salesforce developer skills in 2025.pdf
PPTX
history of c programming in notes for students .pptx
PPTX
CHAPTER 2 - PM Management and IT Context
PDF
Which alternative to Crystal Reports is best for small or large businesses.pdf
PDF
System and Network Administraation Chapter 3
PDF
Audit Checklist Design Aligning with ISO, IATF, and Industry Standards — Omne...
PDF
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
PPTX
CHAPTER 12 - CYBER SECURITY AND FUTURE SKILLS (1) (1).pptx
PDF
Wondershare Filmora 15 Crack With Activation Key [2025
PDF
Nekopoi APK 2025 free lastest update
PPTX
VVF-Customer-Presentation2025-Ver1.9.pptx
PPTX
ai tools demonstartion for schools and inter college
PPTX
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
How Creative Agencies Leverage Project Management Software.pdf
Odoo Companies in India – Driving Business Transformation.pdf
How to Choose the Right IT Partner for Your Business in Malaysia
Design an Analysis of Algorithms I-SECS-1021-03
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
medical staffing services at VALiNTRY
L1 - Introduction to python Backend.pptx
top salesforce developer skills in 2025.pdf
history of c programming in notes for students .pptx
CHAPTER 2 - PM Management and IT Context
Which alternative to Crystal Reports is best for small or large businesses.pdf
System and Network Administraation Chapter 3
Audit Checklist Design Aligning with ISO, IATF, and Industry Standards — Omne...
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
CHAPTER 12 - CYBER SECURITY AND FUTURE SKILLS (1) (1).pptx
Wondershare Filmora 15 Crack With Activation Key [2025
Nekopoi APK 2025 free lastest update
VVF-Customer-Presentation2025-Ver1.9.pptx
ai tools demonstartion for schools and inter college
Lecture 3: Operating Systems Introduction to Computer Hardware Systems

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
  • 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)
  • 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