Loading presentation...

Present Remotely

Send the link below via email or IM


Present to your audience

Start remote presentation

  • Invited audience members will follow you as you navigate and present
  • People invited to a presentation do not need a Prezi account
  • This link expires 10 minutes after you close the presentation
  • A maximum of 30 users can follow your presentation
  • Learn more about this feature in our knowledge base article

Do you really want to delete this prezi?

Neither you, nor the coeditors you shared it with will be able to recover it again.


Software Engineering Failure techniques

No description

Alex Staveley

on 25 January 2016

Comments (0)

Please log in to add your comment.

Report abuse

Transcript of Software Engineering Failure techniques

Failing Fast and Failing Safe
Fail Fast - Database
- Architect your validation
- Defaults
- Duplicates

Failing Fast
Definition: A fail-fast system is designed to immediately report at its interface any failure or condition that is likely to lead to failure
How do we fail fast?
Let's consider:
Programming language
Continuous Integration
Start up
Application use cases
Strict JavaScript: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode
Consistent Hashing: http://dublintech.blogspot.ie/2011/06/consistent-hashing.html
CAP Theorm http://architects.dzone.com/articles/better-explaining-cap-theorem
Compile Time V Unit Test Time
Code coverage
Language features
@TypeChecked, @GrailsTypeChecked annotation (Groovy)
"use strict" - JavaScript
More language features
final, package access scope
Use @Immutable
Fail Fast - Continuous Integration
Failing Fast - Example
List<Worker> payees = new ArrayList();

// They've worked hard. Pay them money
Iterator<Worker> myIterator = payees.iterator();
while (myIterator.hasNext()) {
'... the worst kinds of bugs are those in which the repair doesn't succeed and the problem quietly causes corruption that doesn't show up until much later.

Therefore, write your software to cope with incorrect inputs and its own execution errors as gracefully as possible. But when it cannot, make it fail in a way that makes diagnosis of the problem as easy as possible.'
Why Fail Fast?
Rule of Repair, Eric S. Raymond
The Ten Commandments for C Programmers (Henry Small, 1987)
Repair what you can —- but when you must fail, fail noisily and as soon as possible.
'If a function be advertised to return an error code in the event of difficulties, thou shalt check for that code, yea, even though the checks triple the size of thy code and produce aches in thy typing fingers, for if thou thinkest ``it cannot happen to me'', the gods shall surely punish thee for thy arrogance.'
Josh Bloch
Bumper-Sticker API Design - 2008
'Fail fast. The sooner you report a bug, the less damage it will do. Compile-time is best. If you must fail at run-time, do it as soon as possible.'
So why fail fast?
Bugs always happen
How long does it take to fix them?
Make defects easier to find, easier to fix
Programming Languages
Groovy example...
public String getGoodElectronicProducer() {
return "Max Cooper"

// Typo's
String producter = getGooooodElectronicProducer()
// Incorrect type!
Integer i = getGoodElectronicProducer()

Regression tests
Compile packages
_Events.groovy - check depenendencies
Enforce process
Published APIs change
Doc update?
Email sent?
Sufficient code coverage
Fail Fast - UIs
Example User Address
Other benefits
Less Server hits
Check error responses
Can't console log but could ajax request to server

Fail fast - Start Up
- Check DB connection
- Check down stream components
- Check super admin user exists
- Check DB
- Check critical configuration
- Distributed Cache
UI - Beware of silent failure
<p>Seán O'Brien is <I>NOT</I> easy to tackle</p>
Seán O'Brien is
easy to tackle

<p>Seán O'Brien is <I>NOT easy to tackle</p>
Seán O'Brien is
NOT easy to tackle

<p>Seán O'Brien is <INOT</I> easy to tackle</p>
Seán O'Brien is easy to tackle
JavaScript - Silent Failure
var object = {
foo: "bar",
foo: "baz"
function myFunction(p1, p1) {

Problem with silent failure
Two questions:
- What should happen?
- What will happen?
Application Use Cases
Are you caching data?

What if it is incorrect?

Fail Safe
Definition: A fail-safe or fail-secure device is one that, in the event of a specific type of failure, responds in a way that will cause no harm, or at least a minimum of harm, to other devices or danger to personnel.
Fail Safe - Engineering

Fail Safe - Software Engineering
- Redundancy
- Failover, Session replication,
Hardware failure?
* Dual CPU
* Master / Slave
Software failure?
Fail Safe EE Architecture
Consistent Hashing
Trade Offs?
Does it mean something, nothing or anything? Should be called undef...
def myMethod() {
return "Hello world"

int i = myMethod()
org.codehaus.groovy.runtime.typehandling.GroovyCastException: Cannot cast object 'Hello world' with class 'java.lang.String' to class 'int'
Full transcript