when code cries: listening to code

63
BT10 Concurrent Session 11/14/2013 3:45 PM "When Code Cries: Listening to Code" Presented by: Cory Foy Cory Foy, LLC Brought to you by: 340 Corporate Way, Suite 300, Orange Park, FL 32073 8882688770 9042780524 [email protected] www.sqe.com

Upload: techwellpresentations

Post on 21-May-2015

52 views

Category:

Technology


3 download

DESCRIPTION

What is the best way to learn a new programming language or improve coding skills with the language you already use? Cory Foy has developed a new method for learning—and teaching—new programming languages and improving programmer expertise on their current languages. His approach focuses on preparing the learner to listen to what the code is saying and, thereby, changing how we approach the language. To learn a natural language, we would not start by studying prepositions, nouns, and verbs. Instead we would apply real-world scenarios: ‘How do I say, “Where's the kitchen” in German?’ In the same way, we need a directed approach to study and absorb code examples to gain insight into what the programming language wants our code to say. With Cory’s “listening” approaches, you’ll help your code to come alive by naturally resolving the forces that are present in the problems you are working to solve.

TRANSCRIPT

Page 1: When Code Cries: Listening to Code

 

BT10 Concurrent Session 11/14/2013 3:45 PM 

     

"When Code Cries: Listening to Code"

   

Presented by:

Cory Foy Cory Foy, LLC

        

Brought to you by:  

  

340 Corporate Way, Suite 300, Orange Park, FL 32073 888‐268‐8770 ∙ 904‐278‐0524 ∙ [email protected] ∙ www.sqe.com

Page 2: When Code Cries: Listening to Code

Cory Foy Cory Foy, LLC

A passionate technical executive, developer, blogger, and speaker, Cory Foy has more than sixteen years of software and technology experience, and ten years of agile and lean methods experience. His background includes work in the health care, financial, and technology sectors, serving as a Premier Field Engineer and Team System Ranger for Microsoft; consulting with DirecTV, Stratos Global, and Invensys as a senior consultant for Net Objectives; and architecting solutions for organizations such as MIT's College of Engineering while at 8th Light. Cory's blog coryfoy.com was ranked as one of the top 100 Agile blogs. You can find Cory on Twitter @cory_foy and on LinkedIn at linkedin.com/in/coryfoy.

Page 4: When Code Cries: Listening to Code

Bad Code

Page 5: When Code Cries: Listening to Code

Is this quality code?

Page 6: When Code Cries: Listening to Code

Is this quality code?

Page 7: When Code Cries: Listening to Code

Is this quality code?

“Code that actually gets used”

Page 8: When Code Cries: Listening to Code

Is this quality code?

“Code that actually gets used”

“Lots of merged in pull requests”

Page 9: When Code Cries: Listening to Code

Is this quality code?

“Code that actually gets used”

“Lots of merged in pull requests”

“Quality code makes me say, "hmm," not

"ick."”

Page 10: When Code Cries: Listening to Code

Is this quality code?

“Code that actually gets used”

“Lots of merged in pull requests”

“Quality code makes me say, "hmm," not

"ick."”

“If, when used, it pleases the user”

Page 11: When Code Cries: Listening to Code

“The specific patterns out of which a building or a town is made may be alive or dead. To the extent they are

alive, they let our inner forces loose, and set us free; but when they are dead, they keep us locked in inner

conflict.”Christopher Alexander - “The Timeless Way of Building”

Page 12: When Code Cries: Listening to Code
Page 13: When Code Cries: Listening to Code
Page 14: When Code Cries: Listening to Code

Code Smells

Page 15: When Code Cries: Listening to Code

Code Talks

Page 16: When Code Cries: Listening to Code

Code Cries

Page 17: When Code Cries: Listening to Code

Because No One Understands What It Is

Saying

Code Cries

Page 18: When Code Cries: Listening to Code

So?

Page 19: When Code Cries: Listening to Code

So?

Page 20: When Code Cries: Listening to Code

So?

Page 22: When Code Cries: Listening to Code
Page 23: When Code Cries: Listening to Code
Page 24: When Code Cries: Listening to Code

“...we have so far beset ourselves with rules, and concepts, and ideas of what must be done to make a

building or a town alive, that we have become afraid of what will happen naturally, and convinced that we must

work within a “system” and with “methods” since without them our surroundings will come tumbling

down in chaos.”Christopher Alexander - “The Timeless Way of Building”

Page 25: When Code Cries: Listening to Code

Ten Thousand Hours

Page 26: When Code Cries: Listening to Code

Ten Thousand Hours

Ten Thousand Hours

Page 27: When Code Cries: Listening to Code
Page 28: When Code Cries: Listening to Code
Page 29: When Code Cries: Listening to Code
Page 30: When Code Cries: Listening to Code
Page 31: When Code Cries: Listening to Code

Functional ProgrammingImperative Programming

Logic ProgrammingStatic Typing

Dynamic Typing

Page 32: When Code Cries: Listening to Code

Coding Standards Define Dialects

Page 33: When Code Cries: Listening to Code

BICS

CALP

Page 34: When Code Cries: Listening to Code

BICS

CALP

Page 35: When Code Cries: Listening to Code

BICS

CALP

ContextReduced

ContextEmbedded

Page 36: When Code Cries: Listening to Code

BICS

CALP

ContextReduced

ContextEmbedded

Cognitively Undemanding

Cognitively Demanding

- Copying from the board- Reading a Map- Face to Face Conversation- Selecting food in the lunchroom

Page 37: When Code Cries: Listening to Code

BICS

CALP

ContextReduced

ContextEmbedded

Cognitively Undemanding

Cognitively Demanding

- Copying from the board- Reading a Map- Face to Face Conversation- Selecting food in the lunchroom

- Following a class schedule- Telephone Conversation- Oral Presentations- Getting an absence excuse

Page 38: When Code Cries: Listening to Code

BICS

CALP

ContextReduced

ContextEmbedded

Cognitively Undemanding

Cognitively Demanding

- Copying from the board- Reading a Map- Face to Face Conversation- Selecting food in the lunchroom

- Following a class schedule- Telephone Conversation- Oral Presentations- Getting an absence excuse

- Demonstrations- Basic Math Computations- Science Experiements

Page 39: When Code Cries: Listening to Code

BICS

CALP

ContextReduced

ContextEmbedded

Cognitively Undemanding

Cognitively Demanding

- Copying from the board- Reading a Map- Face to Face Conversation- Selecting food in the lunchroom

- Following a class schedule- Telephone Conversation- Oral Presentations- Getting an absence excuse

- Demonstrations- Basic Math Computations- Science Experiements

- Standardized Tests- Math Concepts and Applications- Listening to a Lecture

Page 40: When Code Cries: Listening to Code

BICS

CALP

ContextReduced

ContextEmbedded

Cognitively Undemanding

Cognitively Demanding

Page 41: When Code Cries: Listening to Code

BICS

CALP

ContextReduced

ContextEmbedded

Cognitively Undemanding

Cognitively Demanding

Foy-Z

Page 42: When Code Cries: Listening to Code

BICS

CALP

ContextReduced

ContextEmbedded

Cognitively Undemanding

Cognitively Demanding

Katas

Foy-Z

Page 43: When Code Cries: Listening to Code

BICS

CALP

ContextReduced

ContextEmbedded

Cognitively Undemanding

Cognitively Demanding

Katas Koans

Foy-Z

Page 44: When Code Cries: Listening to Code

BICS

CALP

ContextReduced

ContextEmbedded

Cognitively Undemanding

Cognitively Demanding

Katas Koans

Adding a new Feature

Foy-Z

Page 45: When Code Cries: Listening to Code

BICS

CALP

ContextReduced

ContextEmbedded

Cognitively Undemanding

Cognitively Demanding

Katas Koans

Adding a new Feature

Listening to Code

Foy-Z

Page 46: When Code Cries: Listening to Code

Listening to Code

http://www.flickr.com/photos/jn2race/263149573

Page 47: When Code Cries: Listening to Code

Listening to Code

Decide to listen

http://www.flickr.com/photos/jn2race/263149573

Page 48: When Code Cries: Listening to Code

Listening to Code

Decide to listen Listen for the whole message

http://www.flickr.com/photos/jn2race/263149573

Page 49: When Code Cries: Listening to Code

Listening to Code

Let go of your own personal

agenda

Decide to listen Listen for the whole message

http://www.flickr.com/photos/jn2race/263149573

Page 50: When Code Cries: Listening to Code

Listening to Code

Let go of your own personal

agenda

Decide to listen Listen for the whole message

Be patient

http://www.flickr.com/photos/jn2race/263149573

Page 51: When Code Cries: Listening to Code

Listening to Code

Let go of your own personal

agenda

Decide to listen

Be curious

Listen for the whole message

Be patient

http://www.flickr.com/photos/jn2race/263149573

Page 52: When Code Cries: Listening to Code

Listening to Code

Let go of your own personal

agenda

Decide to listen

Be curious

Listen for the whole message

Be patient

Test for understanding

http://www.flickr.com/photos/jn2race/263149573

Page 53: When Code Cries: Listening to Code

4 Rules of Simple Design

Does this code express all of the ideas we want to

express?

Are there concepts from our domain

that can be expressed?

Page 54: When Code Cries: Listening to Code

Commonality/Variability Analysis

What is common? What varies?

Is it easy to swap the things that vary?

Is it easy to identify the things that are

common?

Page 55: When Code Cries: Listening to Code

Fowler’s Perspectives (from UML Distilled)

Are we operating at the right level -

Conceptual, Specification or Implementation?

Page 56: When Code Cries: Listening to Code

SOLID Principles

Do we have duplication

(implementation or conceptual)?

Single responsibilities?

LoD violations?

LSP violations?

Page 57: When Code Cries: Listening to Code
Page 58: When Code Cries: Listening to Code

To Listen, We Must Understand

Page 59: When Code Cries: Listening to Code

To Listen, We Must Understand

To Understand, We Must Practice

Page 60: When Code Cries: Listening to Code

To Listen, We Must Understand

To Understand, We Must Practice

To Practice, We Must Have Context

Page 61: When Code Cries: Listening to Code

To Listen, We Must Understand

To Understand, We Must Practice

To Practice, We Must Have Context

Page 62: When Code Cries: Listening to Code

To Listen, We Must Understand

To Understand, We Must Practice

To Practice, We Must Have Context