15
The Art of Code The Art of Code Chris Oldwood Chris Oldwood ACCU Conference 2014 ACCU Conference 2014 @chrisoldwood / [email protected] @chrisoldwood / [email protected]

The Art of Code

  • Upload
    ledell

  • View
    36

  • Download
    0

Embed Size (px)

DESCRIPTION

The Art of Code. Chris Oldwood ACCU Conference 2014. @chrisoldwood / [email protected]. “Hmm! I’m not quite sure what the artist is trying to say here”. “Programs must be written for people to read, and only incidentally for machines to execute” -- Hal Abelson. Code Quality: WTF’s / Minute. - PowerPoint PPT Presentation

Citation preview

Page 1: The Art of Code

The Art of CodeThe Art of Code

Chris OldwoodChris Oldwood

ACCU Conference 2014ACCU Conference 2014

@chrisoldwood / [email protected]@chrisoldwood / [email protected]

Page 2: The Art of Code
Page 3: The Art of Code

“Hmm! I’m not quite sure what the artist is trying to say here”

Page 4: The Art of Code

““Programs must be written Programs must be written for people to read, and for people to read, and only incidentally for only incidentally for machines to execute”machines to execute”

-- -- Hal AbelsonHal Abelson

Page 5: The Art of Code

Code Quality: WTF’s / Code Quality: WTF’s / MinuteMinute

Page 6: The Art of Code

Chopin’s WaterlooChopin’s Waterloo

Page 7: The Art of Code

No CommentNo Comment

// Increment value.value++;

Page 8: The Art of Code

Brace YourselfBrace Yourself

if (x == 1) { if (y == 2) { if (z == 3) { do_something(x, y, z); } }}

Page 9: The Art of Code

Inversion of ControlInversion of Control

// Automatically generated// code.//// DO NOT EDIT!

Page 10: The Art of Code

Cast AwayCast Away

Man survivor("Tom Hanks");

Island& desertIsland = reinterpret_cast<Island&> (survivor);

Page 11: The Art of Code

Pure GarbagePure Garbage

public sealed class Litter{ public bool IsRecyclable { get { return true; } }}

Page 12: The Art of Code

The Missing LINQThe Missing LINQ

var names = new List<string>();

for (int i=0; i!=length; i+=1){ string name = customers[i]; names.Add(name);}

Page 13: The Art of Code

On ReflectionOn Reflection

using DependencyInjection;

DI.Container .RegisterType<Mirror>() .As .InstanceOf<IMirror>() .SingleInstance;

Page 14: The Art of Code

Tabs or Spaces?Tabs or Spaces?

Page 15: The Art of Code

Blog:Blog:

http://chrisoldwood.blogspot.comhttp://chrisoldwood.blogspot.com

@chrisoldwood / [email protected]@chrisoldwood / [email protected]