the art of code
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 PresentationTRANSCRIPT
![Page 1: The Art of Code](https://reader036.vdocuments.site/reader036/viewer/2022062309/56813b47550346895da42c29/html5/thumbnails/1.jpg)
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](https://reader036.vdocuments.site/reader036/viewer/2022062309/56813b47550346895da42c29/html5/thumbnails/2.jpg)
![Page 3: The Art of Code](https://reader036.vdocuments.site/reader036/viewer/2022062309/56813b47550346895da42c29/html5/thumbnails/3.jpg)
“Hmm! I’m not quite sure what the artist is trying to say here”
![Page 4: The Art of Code](https://reader036.vdocuments.site/reader036/viewer/2022062309/56813b47550346895da42c29/html5/thumbnails/4.jpg)
““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](https://reader036.vdocuments.site/reader036/viewer/2022062309/56813b47550346895da42c29/html5/thumbnails/5.jpg)
Code Quality: WTF’s / Code Quality: WTF’s / MinuteMinute
![Page 6: The Art of Code](https://reader036.vdocuments.site/reader036/viewer/2022062309/56813b47550346895da42c29/html5/thumbnails/6.jpg)
Chopin’s WaterlooChopin’s Waterloo
![Page 7: The Art of Code](https://reader036.vdocuments.site/reader036/viewer/2022062309/56813b47550346895da42c29/html5/thumbnails/7.jpg)
No CommentNo Comment
// Increment value.value++;
![Page 8: The Art of Code](https://reader036.vdocuments.site/reader036/viewer/2022062309/56813b47550346895da42c29/html5/thumbnails/8.jpg)
Brace YourselfBrace Yourself
if (x == 1) { if (y == 2) { if (z == 3) { do_something(x, y, z); } }}
![Page 9: The Art of Code](https://reader036.vdocuments.site/reader036/viewer/2022062309/56813b47550346895da42c29/html5/thumbnails/9.jpg)
Inversion of ControlInversion of Control
// Automatically generated// code.//// DO NOT EDIT!
![Page 10: The Art of Code](https://reader036.vdocuments.site/reader036/viewer/2022062309/56813b47550346895da42c29/html5/thumbnails/10.jpg)
Cast AwayCast Away
Man survivor("Tom Hanks");
Island& desertIsland = reinterpret_cast<Island&> (survivor);
![Page 11: The Art of Code](https://reader036.vdocuments.site/reader036/viewer/2022062309/56813b47550346895da42c29/html5/thumbnails/11.jpg)
Pure GarbagePure Garbage
public sealed class Litter{ public bool IsRecyclable { get { return true; } }}
![Page 12: The Art of Code](https://reader036.vdocuments.site/reader036/viewer/2022062309/56813b47550346895da42c29/html5/thumbnails/12.jpg)
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](https://reader036.vdocuments.site/reader036/viewer/2022062309/56813b47550346895da42c29/html5/thumbnails/13.jpg)
On ReflectionOn Reflection
using DependencyInjection;
DI.Container .RegisterType<Mirror>() .As .InstanceOf<IMirror>() .SingleInstance;
![Page 14: The Art of Code](https://reader036.vdocuments.site/reader036/viewer/2022062309/56813b47550346895da42c29/html5/thumbnails/14.jpg)
Tabs or Spaces?Tabs or Spaces?
![Page 15: The Art of Code](https://reader036.vdocuments.site/reader036/viewer/2022062309/56813b47550346895da42c29/html5/thumbnails/15.jpg)
Blog:Blog:
http://chrisoldwood.blogspot.comhttp://chrisoldwood.blogspot.com
@chrisoldwood / [email protected]@chrisoldwood / [email protected]