44
All things that are not code

All things that are not code

Embed Size (px)

Citation preview

Page 1: All things that are not code

All things that are not code

Page 2: All things that are not code

!code

Page 3: All things that are not code

Eyal Keren

BASIC - first bug

PERL - first time I couldn’t read my code

JAVA - first unit test

Vim

TDDCTO & Co-founder @ Rollout.io

@ekeren (github)

Page 4: All things that are not code

Once upon a time…While working @Intel

Page 5: All things that are not code

Once upon a time...

public class MyClass

public double calculateAnswer(String question)

//real code

return answer;

Page 6: All things that are not code

public class MyClass

static Logger log = Logger.getLogger(MyClass.class.getName());

public double calculateAnswer(String question)log.debug("in calculateAnswer");//real code

return answer;

Once upon a time...

Page 7: All things that are not code

public class MyClass

static Logger log = Logger.getLogger(MyClass.class.getName());

public double calculateAnswer(String question)log.debug("in calculateAnswer");//real code

log.debug("out calculateAnswer");

return answer;

Once upon a time...

Page 8: All things that are not code

public class MyClass

static Logger log = Logger.getLogger(MyClass.class.getName());

public double calculateAnswer(String question)log.debug("in calculateAnswer question=" ,question);//real code

log.debug("out calculateAnswer answer=" ,answer);

return answer;

Once upon a time...

Page 9: All things that are not code

public class MyClass

static Logger log = Logger.getLogger(MyClass.class.getName());

public double calculateAnswer(String question)//real code

return answer;

Once upon a time...

Page 10: All things that are not code
Page 11: All things that are not code

new system >> old system

Page 12: All things that are not code

new system >> old system

Less mistakes Less performance cost

Less data to process Less code

Page 13: All things that are not code

new system >> old system

Less mistakes Less performance cost

Less data to process Less untestable code

Page 14: All things that are not code
Page 15: All things that are not code

This talk

boolean function isCode()

return true; // TODO implement

Page 16: All things that are not code

if (!code)

// TODO implement

This talk

Page 17: All things that are not code

• Once upon a time..

• !code by examples

• Why Mobile?

• !code definition

• Q&A

Agenda

Page 18: All things that are not code

Rate UsWhen a user press the restart button on a high

score, let’s trigger rate us

Page 19: All things that are not code

Rate UsWhen a user press the restart button on a high

score, let’s trigger rate us

Definition

R&D

PMResults

Implementation

QA

Release

Page 20: All things that are not code

Rate UsWhen a user press the restart button on a high

score, let’s trigger rate us

Definition

R&D

PMResults

Implementation

QA

Release

Page 21: All things that are not code

• Methods are decorated on demand (before/after/inside)

• You can define actions for decoration

• Call these actions based on available data

• Decoration are safe and guarded

• Gradually rollout the decoration

• Zero performance hit

Imagine an Engine…

Page 22: All things that are not code

Rate Us Demo

Page 23: All things that are not code
Page 24: All things that are not code

!code

Page 25: All things that are not code

Not all code is created equal

Page 26: All things that are not code

Are these even necessary?

Rate Us

Testing CodeReview QA

Automated

Page 27: All things that are not code

YES - because we are humans

Are these even necessary?

Rate Us

Testing CodeReview QA

Automated

Page 28: All things that are not code

Not all code is created equal

Page 29: All things that are not code

The Power of !code

Page 30: All things that are not code

Profiling

Page 31: All things that are not code

Profiling

public void transactionA()

start_trace(“business_trans_A”);

doA();

doB();

doC();

doD();

end_trace(“business_trans_A”);

Page 32: All things that are not code

Profiling

public void takesALongTimeInProduction()

start_trace(“business_no_1”);

doA();

doB();

doC();

doD();

end_trace(“business_no_1”);

public void doA()

start_trace(“diag_AB”);

//real code

public void doB()

//real code

end_trace(“diag_AB”);

public void doC()

start_trace(“diag_C”);

//real code

end_trace(“diag_C”);

public void doD()

//real code

Page 33: All things that are not code

(Sounds familiar?)

Profiling

Get results intoNR dashboard

Set diag on1% of users

Figure outyour next step

Removediag traces

Page 34: All things that are not code

LogsUse cases

Automatic logging

• View controller life cycle

• Memory warnings

• System notifications

Upload your logs when something happens

• If the flow gets here with this value

• Until you get 5 logs of this issue

Page 35: All things that are not code

Rollout

Page 36: All things that are not code

Mixpanel Surveys

Apptimize

Intercom

HelpShift

LeanPlum

Rollout

iRateMixpanel analytics

Mixpanel A/B

Launchdarkly

Parse config

ConfigoLinkedIn

Facebook

ZenDesk

Insert.io

Elasticode

Google Tag Manager

Segment

Page 37: All things that are not code

Mixpanel Surveys

Apptimize

Intercom

HelpShift

LeanPlum

Rollout

iRateMixpanel analytics

Mixpanel A/B

Launchdarkly

Parse config

ConfigoLinkedIn

Facebook

ZenDesk

Insert.io

Elasticode

Google Tag Manager

Segment

Github/Jira for !Code

Page 38: All things that are not code

Why Mobile ?

Page 39: All things that are not code

Why Mobile first ?

Page 40: All things that are not code

Why Mobile first ?

Page 41: All things that are not code

/ NSString *fragmentShaderString = [NSString stringWithContentsOfFile:fragShaderPathnameencoding:NSUTF8StringEncoding error:nil];; if ((self = [self initWithVertexShaderString:vertexShaderStringfragmentShaderString:fragmentShaderString])) return self;; // END:init // START:compile -­(BOOL)compileShader:(GLuint *)shader type:(GLenum)type string:(NSString *)shaderString // CFAbsoluteTime startTime = CFAbsoluteTimeGetCurrent();; GLint status;; const GLchar *source;; source = (GLchar *)[shaderString UTF8String];; if (!source) NSLog(@"Failed to load vertex shader");; return NO;; *shader = glCreateShader(type);; glShaderSource(*shader, 1, &source, NULL);; glCompileShader(*shader);; glGetShaderiv(*shader, GL_COMPILE_STATUS, &status);; if (status != GL_TRUE) GLint logLength;; glGetShaderiv(*shader, GL_INFO_LOG_LENGTH, &logLength);; if (logLength > 0)

GLchar *log = (GLchar *)malloc(logLength);; glGetShaderInfoLog(*shader, logLength, &logLength, log);; NSLog(@"Shader compile log:\n%s", log);; free(log);; // CFAbsoluteTime linkTime = (CFAbsoluteTimeGetCurrent() -­ startTime);; //

NSLog(@"Compiled in %f ms", linkTime * 1000.0);; return status == GL_TRUE;; // END:compile #pragma mark -­ // START:addattribute -­ (void)addAttribute:(NSString *)attributeName if (![attributes containsObject:attributeName]) [attributes addObject:attributeName];; glBindAttribLocation(program, (GLuint)[attributes indexOfObject:attributeName], [attributeName UTF8String]);; // END:addattribute // START:indexmethods -­ (GLuint)attributeIndex:(NSString *)attributeName return (GLuint)[attributes indexOfObject:attributeName];; -­ (GLuint)uniformIndex:(NSString *)uniformName return glGetUniformLocation(program, [uniformName UTF8String]);; // END:indexmethods #pragma mark -­ // START:link -­ (BOOL)link // CFAbsoluteTime startTime = CFAbsoluteTimeGetCurrent();; GLint status;; glLinkProgram(program);; glGetProgramiv(program, GL_LINK_STATUS, &status);; if (status == GL_FALSE) return NO;; if (vertShader) glDeleteShader(vertShader);; vertShader = 0;; if (fragShader) glDeleteShader(fragShader);; fragShader = 0;; self.initialized = YES;; // CFAbsoluteTime linkTime = (CFAbsoluteTimeGetCurrent() -­ startTime);; //

!code

Page 42: All things that are not code

!code Smells if C do A

• C:

• Remotely configured

• opinionated

• A:

• Volatile

• Not testable

• Doesn’t change the application behavior

Page 43: All things that are not code

Look for !CodeMixpanelSurveys

Apptimize

Intercom

HelpShift

LeanPlum

Rollout

iRateMixpanel analytics

Mixpanel A/B

Launchdarkly

Parse config

ConfigoLinkedIn

Facebook

ZenDesk

Insert.io

Elasticode

Page 44: All things that are not code

Q&A