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
The Art of CodeThe Art of Code
Chris OldwoodChris Oldwood
ACCU Conference 2014ACCU Conference 2014
@chrisoldwood / [email protected]@chrisoldwood / [email protected]
“Hmm! I’m not quite sure what the artist is trying to say here”
““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
Code Quality: WTF’s / Code Quality: WTF’s / MinuteMinute
Chopin’s WaterlooChopin’s Waterloo
No CommentNo Comment
// Increment value.value++;
Brace YourselfBrace Yourself
if (x == 1) { if (y == 2) { if (z == 3) { do_something(x, y, z); } }}
Inversion of ControlInversion of Control
// Automatically generated// code.//// DO NOT EDIT!
Cast AwayCast Away
Man survivor("Tom Hanks");
Island& desertIsland = reinterpret_cast<Island&> (survivor);
Pure GarbagePure Garbage
public sealed class Litter{ public bool IsRecyclable { get { return true; } }}
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);}
On ReflectionOn Reflection
using DependencyInjection;
DI.Container .RegisterType<Mirror>() .As .InstanceOf<IMirror>() .SingleInstance;
Tabs or Spaces?Tabs or Spaces?
Blog:Blog:
http://chrisoldwood.blogspot.comhttp://chrisoldwood.blogspot.com
@chrisoldwood / [email protected]@chrisoldwood / [email protected]