The Pursuit of APIness: The Secret to Happy Code

A presentation at DotNetSheff June 2018 in June 2018 in Sheffield, UK by Dylan Beattie

Slide 1

Slide 1

Life, Liberty, and the Pursuit of APIness The Secret to Happy Code Dylan Beattie @dylanbeattie www.dylanbeattie.net dot net sheff

Slide 2

Slide 2

@ dylanbeattie • Building websites since 1992 • CTO @SkillsMatter • Microsoft MVP • London .NET User Group • www.dylanbeattie.net • dylan@dylanbeattie.net

Slide 3

Slide 3

http://starnewshq.deviantart.com/art/Comedy

and

Tragedy

325546823

Slide 4

Slide 4

@dylanbeattie

happycode

Slide 5

Slide 5

http://www.mornota.com/beyninizi

gelistirin/ @dylanbeattie

happycode

Slide 6

Slide 6

EXPERIENCE EXPERIENCE EXPERTISE EXPERTISE @dylanbeattie

happycode

Slide 7

Slide 7

EXPERIENCE EXPERTISE @dylanbeattie

happycode

Slide 8

Slide 8

How To Draw An Owl: 1: draw an oval for the head 2: draw an oval for the body 3: draw the rest of the owl @dylanbeattie

happycode

Slide 9

Slide 9

EXPERIENCE EXPERTISE @dylanbeattie

happycode

Slide 10

Slide 10

Server Error in '/' Application Looks like you forgot to register the http module Castle.MicroKernel.Lifestyle.PerWebRequestLifestyleModule . To fix this add <add name=" PerWebRequestLifestyle " type=" Castle.MicroKernel.Lifestyle.PerWebRequestLifeStyleModule , Castle.Windsor " /> to the < httpModules

section on your web.config @dylanbeattie

happycode

Slide 11

Slide 11

Do you believe in… the users? @dylanbeattie

happycode

Slide 12

Slide 12

@dylanbeattie

happycode

Slide 13

Slide 13

(image from @ DrunkVS via Twitter) @dylanbeattie

happycode

Slide 14

Slide 14

@dylanbeattie

happycode

Slide 15

Slide 15

@dylanbeattie

happycode

Slide 16

Slide 16

@dylanbeattie

happycode

Slide 17

Slide 17

By MBlairMartin

Own work, CC BY

SA 4.0, https://commons.wikimedia.org/w/index.php?curid=50244059 @dylanbeattie

happycode

Slide 18

Slide 18

A> @dylanbeattie

happycode

Slide 19

Slide 19

A>hello @dylanbeattie

happycode

Slide 20

Slide 20

A>hello Bad command or file name A> @dylanbeattie

happycode

Slide 21

Slide 21

A>hello Bad command or file name A>menu Bad command or file name A>help Bad command or file name A> @dylanbeattie

happycode

Slide 22

Slide 22

A>if you're happy and you know it, syntax error Syntax error A>if you're happy and you know it, syntax error Syntax error A>if you're happy and you know it and you really want to show it if you're happy and you know it syntax error @dylanbeattie

happycode

Slide 23

Slide 23

A>if you're happy and you know it, syntax error Syntax error A>if you're happy and you know it, syntax error Syntax error A>if you're happy and you know it and you really want to show it if you're happy and you know it syntax error Syntax error A> @dylanbeattie

happycode

Slide 24

Slide 24

@dylanbeattie

happycode

Slide 25

Slide 25

@dylanbeattie

happycode

Slide 26

Slide 26

Type Your Program Here @dylanbeattie

happycode

Slide 27

Slide 27

@dylanbeattie

happycode

Slide 28

Slide 28

Microsoft Edge video @dylanbeattie

happycode

Slide 29

Slide 29

Slide 30

Slide 30

@dylanbeattie

happycode

Slide 31

Slide 31

here? Oxfordian Kissuth via Wikimedia Commons : https://commons.wikimedia.org/wiki/File:Hyde_Park_sign_post.jpg @dylanbeattie

happycode

Slide 32

Slide 32

http://maxpixel.freegreatpicture.com/Heartbeat

Pulse

Healthcare

Heart

Medicine

163709 @dylanbeattie

happycode

Slide 33

Slide 33

https://www.flickr.com/photos/philliecasablanca/2070476609/in/photostream/ @dylanbeattie

happycode

Slide 34

Slide 34

Request Timed Out @dylanbeattie

happycode

Slide 35

Slide 35

@dylanbeattie

happycode

Slide 36

Slide 36

@dylanbeattie

happycode

Slide 37

Slide 37

@dylanbeattie

happycode

Slide 38

Slide 38

@dylanbeattie

happycode

Slide 39

Slide 39

@dylanbeattie

happycode

Slide 40

Slide 40

Type Your Program Here @dylanbeattie

happycode

Slide 41

Slide 41

https://practicalmotoring.com.au/car

advice/common

car

warning

lights

explained/ @dylanbeattie

happycode

Slide 42

Slide 42

Enterprise Warp Drive http://memory

alpha.wikia.com/wiki/Force_of_Nature_(episode)?file=Warp_core_maintenance.jpg @dylanbeattie

happycode

Slide 43

Slide 43

@dylanbeattie

happycode

Slide 44

Slide 44

Monty Python Lumberjack. @dylanbeattie

happycode

Slide 45

Slide 45

Time CPU Consumption 100% 80% 60% 40% 20% 0% @dylanbeattie

happycode

Slide 46

Slide 46

Time CPU Consumption 100% 80% 60% 40% 20% 0% @dylanbeattie

happycode

Slide 47

Slide 47

Time CPU Consumption 100% 80% 60% 40% 20% 0% @dylanbeattie

happycode

Slide 48

Slide 48

Time CPU Consumption 100% 80% 60% 40% 20% 0% @dylanbeattie

happycode

Slide 49

Slide 49

Time CPU Consumption 100% 80% 60% 40% 20% 0% @dylanbeattie

happycode

Slide 50

Slide 50

Time CPU Consumption 100% 80% 60% 40% 20% 0% 10:00 11:00 12:00 13:00 14:00 15:00 @dylanbeattie

happycode

Slide 51

Slide 51

Time CPU Consumption 100% 80% 60% 40% 20% 0% Jan Feb Mar Apr May Jun Jul @dylanbeattie

happycode

Slide 52

Slide 52

@dylanbeattie

happycode

Slide 53

Slide 53

FATAL ERROR WARN INFO DEBUG @dylanbeattie

happycode

Slide 54

Slide 54

FATAL • Application is completely unresponsive • Multiple users affected with immediate effect • Immediate attention. Stop what you’re doing and look into it. @dylanbeattie

happycode

Slide 55

Slide 55

ERROR & WARN • They will happen. • ERROR – one person noticed, maybe? • WARN – nobody noticed but it’s still odd. • Individual messages probably aren’t useful @dylanbeattie

happycode

Slide 56

Slide 56

https://universitycompare.com/articles/worst

commuters

sit

next

tube/ @dylanbeattie

happycode

Slide 57

Slide 57

INFO • Everything’s fine • Startup , shutdown, cache recycle • In a perfect world, INFO is all you’ll ever see. @dylanbeattie

happycode

Slide 58

Slide 58

DEBUG http://hyperboleandahalf.blogspot.co.uk/ @dylanbeattie

happycode

Slide 59

Slide 59

http://hyperboleandahalf.blogspot.co.uk/ @dylanbeattie

happycode

Slide 60

Slide 60

@dylanbeattie

happycode

Slide 61

Slide 61

log.Fatal Log.Error log.Warn log.Info log.Debug ――――― Wake_Me_Up_At_4AM_On_A_Sunday () ――――― Apologize_To_User_And_Raise_A_Ticket () ――――
Tell_Me_If_This_Happens_1000_Times () ――――
Everything_Is_Fine_Just_Checking_In () ――――― Fill_My_C_Drive_With_Stack_Traces () Adapted from a post by Daniel Lebrero / https://labs.ig.com/logging

level

wrong

abstraction @dylanbeattie

happycode

Slide 62

Slide 62

The Rules Of

happycode @dylanbeattie

happycode

Slide 63

Slide 63

@dylanbeattie

happycode

Slide 64

Slide 64

@dylanbeattie

happycode

Slide 65

Slide 65

@dylanbeattie

happycode

Slide 66

Slide 66

interllisense . Sandboxes Oxfordian Kissuth via Wikimedia Commons : https://commons.wikimedia.org/wiki/File:Hyde_Park_sign_post.jpg @dylanbeattie

happycode

Slide 67

Slide 67

@dylanbeattie

happycode

Slide 68

Slide 68

@dylanbeattie

happycode

Slide 69

Slide 69

Life, Liberty, and the Pursuit of APIness The Secret to Happy Code Dylan Beattie @dylanbeattie www.dylanbeattie.net dot net sheff