Failfast

28
Welcome to Fail Fast Session By @AlSayedGamal 1

Transcript of Failfast

Welcome to Fail FastSession By @AlSayedGamal

1

Fail FastBy @AlSayedGamal

2

Agenda

Fail Immediately!

Assertion!

Eliminate the debugger!

Fail fast and robust software.

3

Q1:What’s the most annoying part of software development ?

4

A: Debugging

5

Q2:What are the most hated bugs ?

6

A: Bugs that appear unexpectedly after a long time of operating

normally!

7

Fail Fast is the solution

8

Fail ImmediatelyFail Fast concept can be digested as failing

immediately and clearly.

9

Can you debug this ?Imagine this in a web based app & the developer had a typo in config file

10

What about debugging this ?Same typo will be spotted immediately.

11

Fail Fast Fundamentals

12

Assertions

What’s assertion ?!

Make sure that your language fails on assertion error.!

When is the most suitable time to do assertion.!

Assertion doesn’t conflict with logging.

13

Design your assertionsOnly if your language doesn’t have a powerful one already

14

بط هوين؟ *

*But when ?15

–Jim Shore

“However, it’s tough to know when to add assertions. One way to tell is to look for comments.”

16

The Killing ExceptionWhen Assert.notNull() can save your life.

17

18

Debug this.The hair pulling phase.

19

but when ?*

*بط هوين ؟20

Assertion not required

Assertion required21

Rule of thumb

22

Eliminate the debugger

23

and even better

If the maxConnections wasn’t found or mistyped it will throw!something like this one:

24

Fail fast robust software

Global exception handler

Summary

Don’t fail silently and save your time and out time.!

Assert whenever you comment.!

Assert.notNull(_instanceVariable).!

Fail with description.!

Use a global handler for users sake.

25

References

http://www.martinfowler.com/ieeeSoftware/failFast.pdf!

en.wikipedia.org/wiki/Fail-fast

26

Questions ?

@AlSayedGamal

Thank you!