SlideShare a Scribd company logo
When Code Cries
Cory Foy
@cory_foy
foyc@coryfoy.com
http://www.coryfoy.com

@cory_foy

foyc@coryfoy.com

Thursday, November 14, 13

Reading from Timeless Way. Then: All of us here are technologists in some way. We desire to
build things that people will use. Living software. But if you look at our industry, the fruit of
our labors is not living software. The majority of software out there has a common attribute.
It is:

1
Bad Code

@cory_foy

foyc@coryfoy.com

Thursday, November 14, 13

Bad Code is the bane of the software industry. Why is it that, over time, code becomes harder
and harder to work with - and how can we prevent ours from ending up with the same fate?
To answer that, perhaps we should start with identifying what quality code is. So, is this
quality code?

2
Is this quality code?

@cory_foy

foyc@coryfoy.com

Thursday, November 14, 13

Why do we like Easy to Change code? Because it is a lower cognitive burden. Because writing
code is hard enough, as we’ll see.

3
Is this quality code?

@cory_foy

foyc@coryfoy.com

Thursday, November 14, 13

Why do we like Easy to Change code? Because it is a lower cognitive burden. Because writing
code is hard enough, as we’ll see.

3
Cognitively Undemanding
Where we want our
software
Context
Embedded

Context
Reduced

Modifying Software we
wrote

@cory_foy

Modifying Software we
didn’t write

Cognitively Demanding

foyc@coryfoy.com

Thursday, November 14, 13

We want code that is in the upper right quadrant. But, if we’re lucky to be modifying our own
code, it’s in the lower left. Worse case, we don’t even have the context, so it’s in the lower
right. Now, if we have tests, that helps increase the context. But when we don’t, we can end
up with code that looks like

4
Cognitively Undemanding
Where we want our
software
Context
Embedded

Context
Reduced

Modifying Software we
wrote

@cory_foy

Modifying Software we
didn’t write

Cognitively Demanding

foyc@coryfoy.com

Thursday, November 14, 13

We want code that is in the upper right quadrant. But, if we’re lucky to be modifying our own
code, it’s in the lower left. Worse case, we don’t even have the context, so it’s in the lower
right. Now, if we have tests, that helps increase the context. But when we don’t, we can end
up with code that looks like

4
Cognitively Undemanding
Where we want our
software
Context
Embedded

Context
Reduced

Modifying Software we
wrote

@cory_foy

Modifying Software we
didn’t write

Cognitively Demanding

foyc@coryfoy.com

Thursday, November 14, 13

We want code that is in the upper right quadrant. But, if we’re lucky to be modifying our own
code, it’s in the lower left. Worse case, we don’t even have the context, so it’s in the lower
right. Now, if we have tests, that helps increase the context. But when we don’t, we can end
up with code that looks like

4
Cognitively Undemanding
Where we want our
software
Context
Embedded

Context
Reduced

Modifying Software we
wrote

@cory_foy

Modifying Software we
didn’t write

Cognitively Demanding

foyc@coryfoy.com

Thursday, November 14, 13

We want code that is in the upper right quadrant. But, if we’re lucky to be modifying our own
code, it’s in the lower left. Worse case, we don’t even have the context, so it’s in the lower
right. Now, if we have tests, that helps increase the context. But when we don’t, we can end
up with code that looks like

4
@cory_foy
Thursday, November 14, 13

foyc@coryfoy.com
5

Code that isn’t a joy. That is anti-joy. Code which is frustrating to be around. This is not code
that is alive - this is code which has problems. And these problems - we tend to name them
something. When we see something not right in code, what do we say?
@cory_foy
Thursday, November 14, 13

foyc@coryfoy.com
5

Code that isn’t a joy. That is anti-joy. Code which is frustrating to be around. This is not code
that is alive - this is code which has problems. And these problems - we tend to name them
something. When we see something not right in code, what do we say?
@cory_foy
Thursday, November 14, 13

foyc@coryfoy.com
5

Code that isn’t a joy. That is anti-joy. Code which is frustrating to be around. This is not code
that is alive - this is code which has problems. And these problems - we tend to name them
something. When we see something not right in code, what do we say?
@cory_foy
Thursday, November 14, 13

foyc@coryfoy.com
5

Code that isn’t a joy. That is anti-joy. Code which is frustrating to be around. This is not code
that is alive - this is code which has problems. And these problems - we tend to name them
something. When we see something not right in code, what do we say?
@cory_foy
Thursday, November 14, 13

foyc@coryfoy.com
5

Code that isn’t a joy. That is anti-joy. Code which is frustrating to be around. This is not code
that is alive - this is code which has problems. And these problems - we tend to name them
something. When we see something not right in code, what do we say?
@cory_foy
Thursday, November 14, 13

foyc@coryfoy.com
5

Code that isn’t a joy. That is anti-joy. Code which is frustrating to be around. This is not code
that is alive - this is code which has problems. And these problems - we tend to name them
something. When we see something not right in code, what do we say?
@cory_foy
Thursday, November 14, 13

foyc@coryfoy.com
5

Code that isn’t a joy. That is anti-joy. Code which is frustrating to be around. This is not code
that is alive - this is code which has problems. And these problems - we tend to name them
something. When we see something not right in code, what do we say?
@cory_foy
Thursday, November 14, 13

foyc@coryfoy.com
5

Code that isn’t a joy. That is anti-joy. Code which is frustrating to be around. This is not code
that is alive - this is code which has problems. And these problems - we tend to name them
something. When we see something not right in code, what do we say?
Code Smells

@cory_foy
Thursday, November 14, 13

foyc@coryfoy.com
6

Right - “Smelly Code”. But what I’d like to do today is reframe the discussion slightly. Instead
of telling our code that it smells, let’s recognize something else - our code is trying to talk to
us.
Code Talks

@cory_foy

foyc@coryfoy.com

Thursday, November 14, 13

And imagine trying to talk to someone about something important - say, the building is on
fire - and them not understanding your strange gestures and telling you you are smelly.
Would that make you happy? It doesn’t make our code happy. And if I can take some poetic
license, I’d even say that code cries

7
Code Cries

@cory_foy
Thursday, November 14, 13

foyc@coryfoy.com
8

And our code cries not because it is smelly, but because no one understands what it is trying
to say. It’s trying to point out what it wants to do, what is important, and how to use it. And it
isn’t happy about that! Too often we try to force what we want, what we think is best.
Code Cries
Because No One
Understands What It Is
Saying
@cory_foy
Thursday, November 14, 13

foyc@coryfoy.com
8

And our code cries not because it is smelly, but because no one understands what it is trying
to say. It’s trying to point out what it wants to do, what is important, and how to use it. And it
isn’t happy about that! Too often we try to force what we want, what we think is best.
“...we have so far beset ourselves with rules, and
concepts, and ideas...that we have become afraid of
what will happen naturally, and convinced that we must
work within a “system” and with “methods” [or] our
surroundings will come tumbling down in chaos.”
Christopher Alexander - “The Timeless Way of Building”

@cory_foy
Thursday, November 14, 13

foyc@coryfoy.com
9

We turn to our UML and architecture diagrams and design documents, trying to brute force a
system that will work, afraid that if we don’t - chaos. But nature *dictates* an iterative design
- one where the best path is not only discovered, but continually chosen. We literally can not
build software any other way. 
@cory_foy
Thursday, November 14, 13

foyc@coryfoy.com
10

This is a map of the Mississippi River in the United States. What’s special about it is that it is all of the routes the
river has run through the years. We create a design. We settle down, build a house, have a family. But the code
doesn't want that. It has plans beyond our design. And if we don't listen to those plans, our days will become filled
with holding off the impending - and inevitable - change (http://www.adammandelman.net/tag/harold-fisk/)
@cory_foy
Thursday, November 14, 13

foyc@coryfoy.com
11

For example, in 2011, the Mississippi River tried to change course, I believe to the Orange
area. And it normally would have - except for the millions of dollars the Army Corp of
Engineers spent to erect dams, flood farm fields and otherwise keep it on the course best for
us - not for it. But trying to brute force design into nature’s iterative process isn’t the only
problem. (10k next)
@cory_foy
Thursday, November 14, 13

foyc@coryfoy.com
12

There’s a common figure that is given to developers about what it takes to become great in
software. Does anyone know that number? <Click> This is the number of hours to “master” a
skill. But as much as we tout this, we don’t really act like this is important. People new to
software either get this
Ten Thousand Hours

@cory_foy
Thursday, November 14, 13

foyc@coryfoy.com
12

There’s a common figure that is given to developers about what it takes to become great in
software. Does anyone know that number? <Click> This is the number of hours to “master” a
skill. But as much as we tout this, we don’t really act like this is important. People new to
software either get this
bloody

@cory_foy
Thursday, November 14, 13

So, confusion and frustration, or this

foyc@coryfoy.com
13
@cory_foy

foyc@coryfoy.com

Thursday, November 14, 13

Empty promises! (Beaker story). Can you imagine learning C++ in 24 hours? Well, you might
be able to learn syntax, but building great software isn’t just about learning syntax. Or
diagrams. At the start of the talk, I quoted Alexander talking about a Timeless Way of
Building - and that this way - this timeless way - is the only way buildings - or software that are alive can be built. And if we go right to the kernel of that way, he says

14
@cory_foy

foyc@coryfoy.com

Thursday, November 14, 13

Empty promises! (Beaker story). Can you imagine learning C++ in 24 hours? Well, you might
be able to learn syntax, but building great software isn’t just about learning syntax. Or
diagrams. At the start of the talk, I quoted Alexander talking about a Timeless Way of
Building - and that this way - this timeless way - is the only way buildings - or software that are alive can be built. And if we go right to the kernel of that way, he says

14
@cory_foy

foyc@coryfoy.com

Thursday, November 14, 13

Empty promises! (Beaker story). Can you imagine learning C++ in 24 hours? Well, you might
be able to learn syntax, but building great software isn’t just about learning syntax. Or
diagrams. At the start of the talk, I quoted Alexander talking about a Timeless Way of
Building - and that this way - this timeless way - is the only way buildings - or software that are alive can be built. And if we go right to the kernel of that way, he says

14
@cory_foy

foyc@coryfoy.com

Thursday, November 14, 13

Empty promises! (Beaker story). Can you imagine learning C++ in 24 hours? Well, you might
be able to learn syntax, but building great software isn’t just about learning syntax. Or
diagrams. At the start of the talk, I quoted Alexander talking about a Timeless Way of
Building - and that this way - this timeless way - is the only way buildings - or software that are alive can be built. And if we go right to the kernel of that way, he says

14
“To make a building {alive}...the
builder must let go of all his
willful images, and start with a
void...At this stage the building’s
life will come directly from your
language”
Christopher Alexander - “The Timeless Way of Building”

@cory_foy

foyc@coryfoy.com

Thursday, November 14, 13

So for us to be able to build great software, we have to be willing to let go of the diagrams.
Of the syntax. Of the “Point A, Point B, flow”. And let go of the fear

15
“You are able to do this only
when you no longer fear that
nothing will happen”
Christopher Alexander - “The Timeless Way of Building”

@cory_foy

foyc@coryfoy.com

Thursday, November 14, 13

of the fear that if we let go, nothing will happen. Or chaos will happen. So, how do we get to
the point where we feel comfortable enough to let go. And, more importantly, how do we
teach others to get to that point? I think that the way that we do that is by recognizing that
the heart of programming isn’t code, but communication. That’s why we call them
programming languages. And we can learn a lot from how people learn languages to help us
along our ten thousand hour path to get to the point where we can build alive systems by
letting go

16
Imperative Programming
Functional Programming
Logic Programming
Dynamic Typing
Static Typing

@cory_foy

foyc@coryfoy.com

Thursday, November 14, 13

This first is the understanding of how languages/paradigms affect our viewpoints. Roman
Jakobson points out “Languages differ...must convey vs what they may convey”. “dinner with
a neighbor last night”, doesn’t reveal if it was a male or female. But if I said in German, I
would be obliged to (Nachbar vs Nachbarin). Functional: context of reduction of terms.
Imperative: statement of the process, and logic: statement of the result. Static: abstractions
sooner, dynamic: abstraction to be held off

17
Coding Standards Define Dialects

@cory_foy
Thursday, November 14, 13

foyc@coryfoy.com
18

The second is that even within languages we have dialects. We have to agree on what that
common dialect is going to be. This is traditionally the essence of coding standards - what is
our agreed upon dialect?
Coding Standards Define Dialects

@cory_foy
Thursday, November 14, 13

foyc@coryfoy.com
18

The second is that even within languages we have dialects. We have to agree on what that
common dialect is going to be. This is traditionally the essence of coding standards - what is
our agreed upon dialect?
Coding Standards Define Dialects

@cory_foy
Thursday, November 14, 13

foyc@coryfoy.com
18

The second is that even within languages we have dialects. We have to agree on what that
common dialect is going to be. This is traditionally the essence of coding standards - what is
our agreed upon dialect?
BICS

CALP
@cory_foy

foyc@coryfoy.com

Thursday, November 14, 13

The third is that the way we approach and learn languages is somewhat haphazard. You only
need to look at any programming language book to see they all do them differently. But the
process of learning a natural language is well known, and standardized regardless of the
language. We can apply a similar framework to develop the skills we need to listen and
understand our code

19
BICS

CALP
@cory_foy

foyc@coryfoy.com

Thursday, November 14, 13

The third is that the way we approach and learn languages is somewhat haphazard. You only
need to look at any programming language book to see they all do them differently. But the
process of learning a natural language is well known, and standardized regardless of the
language. We can apply a similar framework to develop the skills we need to listen and
understand our code

19
BICS

Context
Embedded

Context
Reduced

CALP
@cory_foy

foyc@coryfoy.com

Thursday, November 14, 13

The third is that the way we approach and learn languages is somewhat haphazard. You only
need to look at any programming language book to see they all do them differently. But the
process of learning a natural language is well known, and standardized regardless of the
language. We can apply a similar framework to develop the skills we need to listen and
understand our code

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

BICS

Context
Embedded

Context
Reduced

CALP
@cory_foy

Cognitively Demanding

foyc@coryfoy.com

Thursday, November 14, 13

The third is that the way we approach and learn languages is somewhat haphazard. You only
need to look at any programming language book to see they all do them differently. But the
process of learning a natural language is well known, and standardized regardless of the
language. We can apply a similar framework to develop the skills we need to listen and
understand our code

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

BICS

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

Context
Embedded

Context
Reduced

CALP
@cory_foy

Cognitively Demanding

foyc@coryfoy.com

Thursday, November 14, 13

The third is that the way we approach and learn languages is somewhat haphazard. You only
need to look at any programming language book to see they all do them differently. But the
process of learning a natural language is well known, and standardized regardless of the
language. We can apply a similar framework to develop the skills we need to listen and
understand our code

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

BICS

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

Context
Embedded

Context
Reduced

- Demonstrations
- Basic Math
Computations
- Science Experiments
CALP
@cory_foy

Cognitively Demanding

foyc@coryfoy.com

Thursday, November 14, 13

The third is that the way we approach and learn languages is somewhat haphazard. You only
need to look at any programming language book to see they all do them differently. But the
process of learning a natural language is well known, and standardized regardless of the
language. We can apply a similar framework to develop the skills we need to listen and
understand our code

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

BICS

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

Context
Embedded

Context
Reduced

- Demonstrations
- Basic Math
Computations
- Science Experiments

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

@cory_foy

Cognitively Demanding

foyc@coryfoy.com

Thursday, November 14, 13

The third is that the way we approach and learn languages is somewhat haphazard. You only
need to look at any programming language book to see they all do them differently. But the
process of learning a natural language is well known, and standardized regardless of the
language. We can apply a similar framework to develop the skills we need to listen and
understand our code

19
Cognitively Undemanding
BICS

Context
Embedded

Context
Reduced

CALP
@cory_foy

Cognitively Demanding

foyc@coryfoy.com

Thursday, November 14, 13

This framework, which I’m calling the “Foy-Z” model (with great irreverence), looks like this.
We need to start by providing context. Katas provide a container to operate with in. Koans
provide language specific nuances. Principles help us analyze our code in a higher context
way, while patterns forces us to think about our overall goals. So let’s look at these a little
more.

20
Foy-Z

Cognitively Undemanding
BICS

Context
Embedded

Context
Reduced

CALP
@cory_foy

Cognitively Demanding

foyc@coryfoy.com

Thursday, November 14, 13

This framework, which I’m calling the “Foy-Z” model (with great irreverence), looks like this.
We need to start by providing context. Katas provide a container to operate with in. Koans
provide language specific nuances. Principles help us analyze our code in a higher context
way, while patterns forces us to think about our overall goals. So let’s look at these a little
more.

20
Foy-Z

Cognitively Undemanding
BICS

Katas
Context
Embedded

Context
Reduced

CALP
@cory_foy

Cognitively Demanding

foyc@coryfoy.com

Thursday, November 14, 13

This framework, which I’m calling the “Foy-Z” model (with great irreverence), looks like this.
We need to start by providing context. Katas provide a container to operate with in. Koans
provide language specific nuances. Principles help us analyze our code in a higher context
way, while patterns forces us to think about our overall goals. So let’s look at these a little
more.

20
Foy-Z

Cognitively Undemanding
BICS

Katas

Koans

Context
Embedded

Context
Reduced

CALP
@cory_foy

Cognitively Demanding

foyc@coryfoy.com

Thursday, November 14, 13

This framework, which I’m calling the “Foy-Z” model (with great irreverence), looks like this.
We need to start by providing context. Katas provide a container to operate with in. Koans
provide language specific nuances. Principles help us analyze our code in a higher context
way, while patterns forces us to think about our overall goals. So let’s look at these a little
more.

20
Foy-Z

Cognitively Undemanding
BICS

Katas

Koans

Context
Embedded

Context
Reduced

Principles
CALP
@cory_foy

Cognitively Demanding

foyc@coryfoy.com

Thursday, November 14, 13

This framework, which I’m calling the “Foy-Z” model (with great irreverence), looks like this.
We need to start by providing context. Katas provide a container to operate with in. Koans
provide language specific nuances. Principles help us analyze our code in a higher context
way, while patterns forces us to think about our overall goals. So let’s look at these a little
more.

20
Foy-Z

Cognitively Undemanding
BICS

Katas

Koans

Context
Embedded

Context
Reduced

Principles

Patterns
CALP

@cory_foy

Cognitively Demanding

foyc@coryfoy.com

Thursday, November 14, 13

This framework, which I’m calling the “Foy-Z” model (with great irreverence), looks like this.
We need to start by providing context. Katas provide a container to operate with in. Koans
provide language specific nuances. Principles help us analyze our code in a higher context
way, while patterns forces us to think about our overall goals. So let’s look at these a little
more.

20
Katas

@cory_foy

foyc@coryfoy.com

Thursday, November 14, 13

Let’s start with Katas. First described in the software world by Pragmatic Dave Thomas, they
offer the ability to practice without the solution being the cognitive challenge. In short, they
allow developers to practice varying externally motivated viewpoints.

21
Conway’s Game of Life

- Infinite Grid of Cells
- Each Cell has two states - alive or dead
- Interacts with neighbors in a well known way

http://en.wikipedia.org/wiki/Conway%27s_Game_of_Life

@cory_foy
Thursday, November 14, 13

foyc@coryfoy.com
22
Conway’s Game of Life

- Infinite Grid of Cells
- Each Cell has two states - alive or dead
- Interacts with neighbors in a well known way

http://en.wikipedia.org/wiki/Conway%27s_Game_of_Life

@cory_foy
Thursday, November 14, 13

foyc@coryfoy.com
22
Conway’s Game of Life

- Infinite Grid of Cells
- Each Cell has two states - alive or dead
- Interacts with neighbors in a well known way

http://en.wikipedia.org/wiki/Conway%27s_Game_of_Life

@cory_foy
Thursday, November 14, 13

foyc@coryfoy.com
22
Conway’s Game of Life

- Infinite Grid of Cells
- Each Cell has two states - alive or dead
- Interacts with neighbors in a well known way

http://en.wikipedia.org/wiki/Conway%27s_Game_of_Life

@cory_foy
Thursday, November 14, 13

foyc@coryfoy.com
22
Conway’s Game of Life - If Statement

@cory_foy
Thursday, November 14, 13

foyc@coryfoy.com
23
Conway’s Game of Life - If Statement

@cory_foy
Thursday, November 14, 13

foyc@coryfoy.com
23
Conway’s Game of Life - No Conditional

@cory_foy
Thursday, November 14, 13

foyc@coryfoy.com
24
Foy-Z

Cognitively Undemanding
BICS

Katas
Context
Embedded

Context
Reduced

CALP
@cory_foy

Cognitively Demanding

foyc@coryfoy.com

Thursday, November 14, 13

So Katas allow us to not focus on solving the problem, but instead using the problem to
explore the space of viewpoints. The context is very high - we cognitively understand the
problem, so we can focus on practice. But at some point we need more - and that’s where

25
Foy-Z

Cognitively Undemanding
BICS

Katas

Koans

Context
Embedded

Context
Reduced

CALP
@cory_foy

Cognitively Demanding

foyc@coryfoy.com

Thursday, November 14, 13

So Katas allow us to not focus on solving the problem, but instead using the problem to
explore the space of viewpoints. The context is very high - we cognitively understand the
problem, so we can focus on practice. But at some point we need more - and that’s where

25
Koans

@cory_foy
Thursday, November 14, 13

foyc@coryfoy.com
26

Koans come in. Koans provide language-specific nuances - the grammar if you will. They
tend to be language specific, but lower context. It’s like practicing nouns and verbs - great to
do, but much better if you have some context to put them in. For example (next Edgecase
Koans)
https://github.com/neo/ruby_koans

@cory_foy

foyc@coryfoy.com

Thursday, November 14, 13

one of the more famous software Koans was by Edgecase (now called Neo). You can see in
the structure it was very specific to the Ruby language - arrays, assets, blocks, etc.

27
Ruby Koans Asserts

@cory_foy
Thursday, November 14, 13

foyc@coryfoy.com
28
Ruby Koans Arrays

@cory_foy
Thursday, November 14, 13

foyc@coryfoy.com
29
Foy-Z

Cognitively Undemanding
BICS

Katas

Koans

Context
Embedded

Context
Reduced

CALP
@cory_foy

Cognitively Demanding

foyc@coryfoy.com

Thursday, November 14, 13

So far, we’ve stayed in the BICS realm. BUT! We’ve learned something interesting. The Koans
taught us Ruby array management, and we needed that for our exercise, so let’s revisit the
Katas

30
Conway’s Game of Life - With Map

@cory_foy
Thursday, November 14, 13

foyc@coryfoy.com
31
Conway’s Game of Life - With Map

@cory_foy
Thursday, November 14, 13

foyc@coryfoy.com
31
Foy-Z

Cognitively Undemanding
BICS

Katas

Koans

Context
Embedded

Context
Reduced

CALP
@cory_foy

Cognitively Demanding

foyc@coryfoy.com

Thursday, November 14, 13

At this point, we have enough basic skills that we can begin to get into cognitively
demanding work. We have the context, and the grammar, but we don’t know the optimal
ways to apply the grammar. That’s where coding principles come in to play

32
Foy-Z

Cognitively Undemanding
BICS

Katas

Koans

Context
Embedded

Context
Reduced

Principles
CALP
@cory_foy

Cognitively Demanding

foyc@coryfoy.com

Thursday, November 14, 13

At this point, we have enough basic skills that we can begin to get into cognitively
demanding work. We have the context, and the grammar, but we don’t know the optimal
ways to apply the grammar. That’s where coding principles come in to play

32
Principles

@cory_foy

foyc@coryfoy.com

Thursday, November 14, 13

Our principles guide us in how we apply our code within the context of what we’re writing.

33
SOLID Principles
Do we have
duplication
(implementation or
conceptual)?
Single
responsibilities?
LoD violations?
LSP violations?
@cory_foy
Thursday, November 14, 13

Transition to patterns

foyc@coryfoy.com
34
4 Rules of Simple Design
Does this code express all of the ideas
we want to express?

@cory_foy
Thursday, November 14, 13

Patterns. 4 Rules of Simple Design. Fowler. SOLID

foyc@coryfoy.com
35
4 Rules of Simple Design
Does this code express all of the ideas
we want to express?

@cory_foy
Thursday, November 14, 13

Patterns. 4 Rules of Simple Design. Fowler. SOLID

foyc@coryfoy.com
35
4 Rules of Simple Design
Does this code express all of the ideas
we want to express?

@cory_foy
Thursday, November 14, 13

Patterns. 4 Rules of Simple Design. Fowler. SOLID

foyc@coryfoy.com
35
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?

@cory_foy
Thursday, November 14, 13

Patterns. 4 Rules of Simple Design. Fowler. SOLID

foyc@coryfoy.com
35
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?

@cory_foy
Thursday, November 14, 13

Patterns. 4 Rules of Simple Design. Fowler. SOLID

foyc@coryfoy.com
35
Fowler’s Perspectives (from UML Distilled)

Are we operating at
the right level Conceptual,
Specification or
Implementation?

@cory_foy
Thursday, November 14, 13

Patterns. 4 Rules of Simple Design. Fowler. SOLID

foyc@coryfoy.com
36
Fowler’s Perspectives (from UML Distilled)

Are we operating at
the right level Conceptual,
Specification or
Implementation?

@cory_foy
Thursday, November 14, 13

Patterns. 4 Rules of Simple Design. Fowler. SOLID

foyc@coryfoy.com
36
Foy-Z

Cognitively Undemanding
BICS

Katas

Koans

Context
Embedded

Context
Reduced

Principles
CALP
@cory_foy

Cognitively Demanding

foyc@coryfoy.com

Thursday, November 14, 13

At this point, we have enough basic skills that we can begin to get into cognitively
demanding work. As I mentioned earlier, Design Patterns

37
Foy-Z

Cognitively Undemanding
BICS

Katas

Koans

Context
Embedded

Context
Reduced

Principles

Patterns
CALP

@cory_foy

Cognitively Demanding

foyc@coryfoy.com

Thursday, November 14, 13

At this point, we have enough basic skills that we can begin to get into cognitively
demanding work. As I mentioned earlier, Design Patterns

37
Patterns

@cory_foy
Thursday, November 14, 13

foyc@coryfoy.com
38

Design Patterns provide a guide for the forces encountered. What does that mean? We have a
tendency to think of Design Patterns as recipes to make our code look a certain way. But
@cory_foy
Thursday, November 14, 13

Patterns are something else.

foyc@coryfoy.com
39
Naming something the name of a pattern
does not make it that pattern

@cory_foy
Thursday, November 14, 13

Patterns are something else.

foyc@coryfoy.com
39
Naming something the name of a pattern
does not make it that pattern
Putting patterns in our code does not
make our code good

@cory_foy
Thursday, November 14, 13

Patterns are something else.

foyc@coryfoy.com
39
Porch Swing

@cory_foy
Thursday, November 14, 13

foyc@coryfoy.com
40
Porch Swing

@cory_foy
Thursday, November 14, 13

foyc@coryfoy.com
40
Swimming Pool

@cory_foy
Thursday, November 14, 13

foyc@coryfoy.com
41
Swimming Pool

@cory_foy
Thursday, November 14, 13

foyc@coryfoy.com
41
Hedge Trimmer

@cory_foy
Thursday, November 14, 13

Not a pattern, but a death trap (next GoF Book / Structure of Patterns)

foyc@coryfoy.com
42
Hedge Trimmer

@cory_foy
Thursday, November 14, 13

Not a pattern, but a death trap (next GoF Book / Structure of Patterns)

foyc@coryfoy.com
42
• Pattern Name
• Intent
• Also Known As
• Motivation / Forces
• Applicability
• Structure
• Participants
• Collaboration
• Consequences
• Implementation
• Sample Code
• Known Uses
• Related Patterns
@cory_foy

foyc@coryfoy.com

Thursday, November 14, 13

The GoF Book wasn’t a beginners guide. It was Erich’s PhD Thesis. Patterns are designed to
put into form the forces you may run into while building code. What does that mean?

43
Server

@cory_foy

foyc@coryfoy.com

Thursday, November 14, 13

Let’s imagine a mobile application to upload pictures. So what forces are at play here? We
know we have to associate multiple pictures to data. Data can have new types added, which
need to be available on all other phones. The phone needs to be able to send the pictures to
the server, as well as send and receive data updates. And deal with offline conditions.

44
- Countries
- Products
- Locations

Server

@cory_foy

foyc@coryfoy.com

Thursday, November 14, 13

Let’s imagine a mobile application to upload pictures. So what forces are at play here? We
know we have to associate multiple pictures to data. Data can have new types added, which
need to be available on all other phones. The phone needs to be able to send the pictures to
the server, as well as send and receive data updates. And deal with offline conditions.

44
- Countries
- Products
- Locations

- Send Data
- Receive Data
Server

@cory_foy

foyc@coryfoy.com

Thursday, November 14, 13

Let’s imagine a mobile application to upload pictures. So what forces are at play here? We
know we have to associate multiple pictures to data. Data can have new types added, which
need to be available on all other phones. The phone needs to be able to send the pictures to
the server, as well as send and receive data updates. And deal with offline conditions.

44
Multiple
Pictures
- Countries
- Products
- Locations

- Send Data
- Receive Data
Server

@cory_foy

foyc@coryfoy.com

Thursday, November 14, 13

Let’s imagine a mobile application to upload pictures. So what forces are at play here? We
know we have to associate multiple pictures to data. Data can have new types added, which
need to be available on all other phones. The phone needs to be able to send the pictures to
the server, as well as send and receive data updates. And deal with offline conditions.

44
Multiple
Pictures
- Countries
- Products
- Locations

Send
Pictures
- Send Data
- Receive Data
Server

@cory_foy

foyc@coryfoy.com

Thursday, November 14, 13

Let’s imagine a mobile application to upload pictures. So what forces are at play here? We
know we have to associate multiple pictures to data. Data can have new types added, which
need to be available on all other phones. The phone needs to be able to send the pictures to
the server, as well as send and receive data updates. And deal with offline conditions.

44
Multiple
Pictures
- Countries
- Products
- Locations

Send
Pictures
- Send Data
- Receive Data
Server

@cory_foy

Storage Options

foyc@coryfoy.com

Thursday, November 14, 13

Let’s imagine a mobile application to upload pictures. So what forces are at play here? We
know we have to associate multiple pictures to data. Data can have new types added, which
need to be available on all other phones. The phone needs to be able to send the pictures to
the server, as well as send and receive data updates. And deal with offline conditions.

44
Offline

@cory_foy

foyc@coryfoy.com

Thursday, November 14, 13

One way is by knowing the forces at play and comparing them to previous events. For
example, the phone (or server) could be offline. What can we do if we are offline?

45
Offline
Not allow send

@cory_foy

Queue items to send

foyc@coryfoy.com

Thursday, November 14, 13

One way is by knowing the forces at play and comparing them to previous events. For
example, the phone (or server) could be offline. What can we do if we are offline?

45
Offline
Not allow send

Automatically

@cory_foy

Queue items to send

Manually

foyc@coryfoy.com

Thursday, November 14, 13

One way is by knowing the forces at play and comparing them to previous events. For
example, the phone (or server) could be offline. What can we do if we are offline?

45
Offline
Not allow send

Automatically

Queue items to send

Manually
Forces:
- User has to remember to
send
- User can’t do other tasks
until sent
- User has to send each one

@cory_foy

foyc@coryfoy.com

Thursday, November 14, 13

One way is by knowing the forces at play and comparing them to previous events. For
example, the phone (or server) could be offline. What can we do if we are offline?

45
Offline
Not allow send

Automatically
Forces:
- Store multiple requests
- Schedule to run them
- Handle failed requests
- Allow user to see
status
@cory_foy

Queue items to send

Manually
Forces:
- User has to remember to
send
- User can’t do other tasks
until sent
- User has to send each one
foyc@coryfoy.com

Thursday, November 14, 13

One way is by knowing the forces at play and comparing them to previous events. For
example, the phone (or server) could be offline. What can we do if we are offline?

45
http://www.soapatterns.org/asynchronous_queuing.php

@cory_foy

foyc@coryfoy.com

Thursday, November 14, 13

So the patterns we choose are a result of the forces we are trying to resolve - the forces
inherent in the solution itself.

46
Foy-Z

Cognitively Undemanding
BICS

Context
Embedded

Context
Reduced

CALP
@cory_foy

Cognitively Demanding

foyc@coryfoy.com

Thursday, November 14, 13

So now that we’ve got a framework on how to get the point of understanding, now what?
Well, our code is getting happier, because

47
@cory_foy
Thursday, November 14, 13

we’ve begun addressing some of the key issues in being able to listen to it.

foyc@coryfoy.com
48
We don’t
understand the
language

@cory_foy
Thursday, November 14, 13

we’ve begun addressing some of the key issues in being able to listen to it.

foyc@coryfoy.com
48
We don’t
understand the
language
We don’t have
common context

@cory_foy
Thursday, November 14, 13

we’ve begun addressing some of the key issues in being able to listen to it.

foyc@coryfoy.com
48
We don’t
understand the
language
We don’t have
common context

We don’t know
the grammar

@cory_foy
Thursday, November 14, 13

we’ve begun addressing some of the key issues in being able to listen to it.

foyc@coryfoy.com
48
We don’t
understand the
language
We don’t have
common context

We don’t know
the grammar

We don’t know
how to apply the
grammar

@cory_foy
Thursday, November 14, 13

we’ve begun addressing some of the key issues in being able to listen to it.

foyc@coryfoy.com
48
We don’t
understand the
language
We don’t have
common context

We don’t know
how to apply the
grammar

We don’t know
the grammar

We don’t know
what’s
appropriate

@cory_foy
Thursday, November 14, 13

we’ve begun addressing some of the key issues in being able to listen to it.

foyc@coryfoy.com
48
http://www.flickr.com/photos/jakeandlindsay/5524669257

@cory_foy
Thursday, November 14, 13

foyc@coryfoy.com
49

So how to we apply it? How do we use that to now let go? First, diagrams aren’t bad. There’s
nothing wrong with sketching out a plan. But, “No plan survives first contact with the enemy”.
So pay attention to the forces more than the plan.
http://www.soapatterns.org/asynchronous_queuing.php

@cory_foy
Thursday, November 14, 13

foyc@coryfoy.com
50

For example, looking at this pattern again, notice the impacts. We may say to ourselves, we
want an Aysnc Queue, so fine, be on the lookout for that. But don’t blindly just shove an
async queue in. Watch for your code to tell you it needs it. (This also applies to databases and
many other things we “Know we need”)
http://marchoeijmans.blogspot.com/2013/03/test-driven-development-tdd.html
(Although I disagree with the article)

@cory_foy

foyc@coryfoy.com

Thursday, November 14, 13

Second: If you haven’t done TDD, or aren’t doing it, I’d highly recommend spending some
time with Katas trying it out. What I find powerful is that it makes no qualms about your
design. Don’t write a design, and then write tests to prove you are writing your design. Let
the tests guide you. See what design emerges from them.

51
@cory_foy

foyc@coryfoy.com

Thursday, November 14, 13

Third: Technical Vision. In a team environment, you want to make sure you all are on the
same page. Traditionally we’ve built software bottom up. But this doesn’t give us an
opportunity to learn. “Tracer Bullets”

52
Database

@cory_foy

foyc@coryfoy.com

Thursday, November 14, 13

Third: Technical Vision. In a team environment, you want to make sure you all are on the
same page. Traditionally we’ve built software bottom up. But this doesn’t give us an
opportunity to learn. “Tracer Bullets”

52
Stored Procedures
Database

@cory_foy

foyc@coryfoy.com

Thursday, November 14, 13

Third: Technical Vision. In a team environment, you want to make sure you all are on the
same page. Traditionally we’ve built software bottom up. But this doesn’t give us an
opportunity to learn. “Tracer Bullets”

52
Service Layer
Stored Procedures
Database

@cory_foy

foyc@coryfoy.com

Thursday, November 14, 13

Third: Technical Vision. In a team environment, you want to make sure you all are on the
same page. Traditionally we’ve built software bottom up. But this doesn’t give us an
opportunity to learn. “Tracer Bullets”

52
API Layer
Service Layer
Stored Procedures
Database

@cory_foy

foyc@coryfoy.com

Thursday, November 14, 13

Third: Technical Vision. In a team environment, you want to make sure you all are on the
same page. Traditionally we’ve built software bottom up. But this doesn’t give us an
opportunity to learn. “Tracer Bullets”

52
Front End Layer
API Layer
Service Layer
Stored Procedures
Database

@cory_foy

foyc@coryfoy.com

Thursday, November 14, 13

Third: Technical Vision. In a team environment, you want to make sure you all are on the
same page. Traditionally we’ve built software bottom up. But this doesn’t give us an
opportunity to learn. “Tracer Bullets”

52
Front End Layer
API Layer
Service Layer
Stored Procedures
Database

@cory_foy

foyc@coryfoy.com

Thursday, November 14, 13

Third: Technical Vision. In a team environment, you want to make sure you all are on the
same page. Traditionally we’ve built software bottom up. But this doesn’t give us an
opportunity to learn. “Tracer Bullets”

52
Front End Layer
API Layer
Service Layer
Stored Procedures
Database

@cory_foy

foyc@coryfoy.com

Thursday, November 14, 13

Third: Technical Vision. In a team environment, you want to make sure you all are on the
same page. Traditionally we’ve built software bottom up. But this doesn’t give us an
opportunity to learn. “Tracer Bullets”

52
Front End Layer
API Layer
Service Layer
Stored Procedures
Database

@cory_foy

foyc@coryfoy.com

Thursday, November 14, 13

Third: Technical Vision. In a team environment, you want to make sure you all are on the
same page. Traditionally we’ve built software bottom up. But this doesn’t give us an
opportunity to learn. “Tracer Bullets”

52
Front End Layer
API Layer
Service Layer
Stored Procedures
Database

@cory_foy

foyc@coryfoy.com

Thursday, November 14, 13

Third: Technical Vision. In a team environment, you want to make sure you all are on the
same page. Traditionally we’ve built software bottom up. But this doesn’t give us an
opportunity to learn. “Tracer Bullets”

52
Front End Layer
API Layer
Service Layer
Stored Procedures
Database

@cory_foy

foyc@coryfoy.com

Thursday, November 14, 13

Third: Technical Vision. In a team environment, you want to make sure you all are on the
same page. Traditionally we’ve built software bottom up. But this doesn’t give us an
opportunity to learn. “Tracer Bullets”

52
Front End Layer
API Layer
Service Layer
Stored Procedures
Database

@cory_foy

foyc@coryfoy.com

Thursday, November 14, 13

There’s nothing wrong with a vision. And as you work on slices, you can check against the
overall vision to see if you are on the path you expected, or if your vision needs to change.
Not the code, but the vision.

53
Vision
Front End Layer
API Layer
Service Layer
Stored Procedures
Database

@cory_foy

foyc@coryfoy.com

Thursday, November 14, 13

There’s nothing wrong with a vision. And as you work on slices, you can check against the
overall vision to see if you are on the path you expected, or if your vision needs to change.
Not the code, but the vision.

53
Vision
Front End Layer
API Layer
Service Layer
Stored Procedures
Database

@cory_foy

foyc@coryfoy.com

Thursday, November 14, 13

There’s nothing wrong with a vision. And as you work on slices, you can check against the
overall vision to see if you are on the path you expected, or if your vision needs to change.
Not the code, but the vision.

53
Vision
Front End Layer
API Layer
Service Layer
Stored Procedures
Database

@cory_foy

foyc@coryfoy.com

Thursday, November 14, 13

There’s nothing wrong with a vision. And as you work on slices, you can check against the
overall vision to see if you are on the path you expected, or if your vision needs to change.
Not the code, but the vision.

53
Pay attention to the forces
Let the code (and tests!) guide your design
Develop a vision, but use it as a guide, not a whipping post

@cory_foy
Thursday, November 14, 13

foyc@coryfoy.com
54

These things together, along with the solid understanding of the different paradigms and
approaches are going to get you to the point where you can let go of the “willful images” and
start really listening to your code. And when you listen to your code
@cory_foy

foyc@coryfoy.com

Thursday, November 14, 13

you end up with happy code. And when you don’t, you end up with unhappy code, baffled at
why you are even bothering to build it if you aren’t going to listen.

55
if coder_listens?

@cory_foy

foyc@coryfoy.com

Thursday, November 14, 13

you end up with happy code. And when you don’t, you end up with unhappy code, baffled at
why you are even bothering to build it if you aren’t going to listen.

55
if coder_listens?
puts “:-)”

@cory_foy

foyc@coryfoy.com

Thursday, November 14, 13

you end up with happy code. And when you don’t, you end up with unhappy code, baffled at
why you are even bothering to build it if you aren’t going to listen.

55
if coder_listens?
puts “:-)”
else

@cory_foy

foyc@coryfoy.com

Thursday, November 14, 13

you end up with happy code. And when you don’t, you end up with unhappy code, baffled at
why you are even bothering to build it if you aren’t going to listen.

55
if coder_listens?
puts “:-)”
else
puts “:`-(“

@cory_foy

foyc@coryfoy.com

Thursday, November 14, 13

you end up with happy code. And when you don’t, you end up with unhappy code, baffled at
why you are even bothering to build it if you aren’t going to listen.

55
if coder_listens?
puts “:-)”
else
puts “:`-(“
end

@cory_foy

foyc@coryfoy.com

Thursday, November 14, 13

you end up with happy code. And when you don’t, you end up with unhappy code, baffled at
why you are even bothering to build it if you aren’t going to listen.

55
if coder_listens?
puts “:-)”
else
puts “:`-(“
end

@cory_foy

foyc@coryfoy.com

Thursday, November 14, 13

you end up with happy code. And when you don’t, you end up with unhappy code, baffled at
why you are even bothering to build it if you aren’t going to listen.

55
Cory Foy
(@cory_foy)
foyc@coryfoy.com
www.coryfoy.com

@cory_foy
Thursday, November 14, 13

foyc@coryfoy.com
56

More Related Content

Similar to SQE Boston - When Code Cries

9 deadly practices for which you will be grateful
9 deadly practices for which you will be grateful9 deadly practices for which you will be grateful
9 deadly practices for which you will be grateful
Krzysztof Piwowar
 
Flask First-Timer
Flask First-TimerFlask First-Timer
Flask First-Timer
Aijaz Ansari
 
Five Ways to Get Better Data From Our Users
Five Ways to Get Better Data From Our UsersFive Ways to Get Better Data From Our Users
Five Ways to Get Better Data From Our Users
Sajid Reshamwala
 
Essay Writing-A Day At The Seaside
Essay Writing-A Day At The SeasideEssay Writing-A Day At The Seaside
Essay Writing-A Day At The Seaside
Sarah Camacho
 
Psychology for designers or 3 predictions from psychology for the future of ...
Psychology for designers or 3 predictions from psychology  for the future of ...Psychology for designers or 3 predictions from psychology  for the future of ...
Psychology for designers or 3 predictions from psychology for the future of ...
Joe Leech
 
Psychology for designers or 3 predictions from psychology for the future of ...
Psychology for designers or 3 predictions from psychology  for the future of ...Psychology for designers or 3 predictions from psychology  for the future of ...
Psychology for designers or 3 predictions from psychology for the future of ...
cxpartners
 
10 Common Grammar Questions NATIVE speakers have!.pdf
10 Common Grammar Questions NATIVE speakers have!.pdf10 Common Grammar Questions NATIVE speakers have!.pdf
10 Common Grammar Questions NATIVE speakers have!.pdf
MaraElenaSnchezHuert
 
Tickets Make Ops Unnecessarily Miserable: The Journey to Self-Service
Tickets Make Ops Unnecessarily Miserable: The Journey to Self-ServiceTickets Make Ops Unnecessarily Miserable: The Journey to Self-Service
Tickets Make Ops Unnecessarily Miserable: The Journey to Self-Service
Rundeck
 
LeadDev NYC 2022: Calling Out a Terrible On-call System
LeadDev NYC 2022: Calling Out a Terrible On-call SystemLeadDev NYC 2022: Calling Out a Terrible On-call System
LeadDev NYC 2022: Calling Out a Terrible On-call System
Molly Struve
 
DIY Marketing Tips
DIY Marketing TipsDIY Marketing Tips
DIY Marketing Tips
James Keddington
 
Immutable Laws
Immutable LawsImmutable Laws
Immutable Laws
Biztek
 
Lined Writing Paper With Picture Space. Online assignment writing service.
Lined Writing Paper With Picture Space. Online assignment writing service.Lined Writing Paper With Picture Space. Online assignment writing service.
Lined Writing Paper With Picture Space. Online assignment writing service.
Rebecca Harris
 
We need to Talk about Frank
We need to Talk about FrankWe need to Talk about Frank
We need to Talk about Frank
Emma Howell
 
SpeakUp – A Mobile App Facilitating Audience Interaction
SpeakUp – A Mobile App Facilitating Audience InteractionSpeakUp – A Mobile App Facilitating Audience Interaction
SpeakUp – A Mobile App Facilitating Audience Interaction
Sten Govaerts
 
Christian Heilmann - Building human interfaces powered by AI - Codemotion Ber...
Christian Heilmann - Building human interfaces powered by AI - Codemotion Ber...Christian Heilmann - Building human interfaces powered by AI - Codemotion Ber...
Christian Heilmann - Building human interfaces powered by AI - Codemotion Ber...
Codemotion
 
Model storming - a different approach to collaborative model discovery (Vilni...
Model storming - a different approach to collaborative model discovery (Vilni...Model storming - a different approach to collaborative model discovery (Vilni...
Model storming - a different approach to collaborative model discovery (Vilni...
Alberto Brandolini
 
Designing Great APIs: Learning from Jony Ive, Orwell, and the Kano Model
Designing Great APIs: Learning from Jony Ive, Orwell, and the Kano ModelDesigning Great APIs: Learning from Jony Ive, Orwell, and the Kano Model
Designing Great APIs: Learning from Jony Ive, Orwell, and the Kano Model
Jonathan Dahl
 
Hacker To Founder - Filipino Technical Co-Founders at Work
Hacker To Founder - Filipino Technical Co-Founders at WorkHacker To Founder - Filipino Technical Co-Founders at Work
Hacker To Founder - Filipino Technical Co-Founders at Work
Paul Pajo
 
D3 Design By Games Agile India Pune 2005
D3 Design By Games   Agile India   Pune 2005D3 Design By Games   Agile India   Pune 2005
D3 Design By Games Agile India Pune 2005
Henry Jacob
 
10 Signs that your startup is likely to fail
10 Signs that your startup is likely to fail10 Signs that your startup is likely to fail
10 Signs that your startup is likely to fail
Milan Vrekic
 

Similar to SQE Boston - When Code Cries (20)

9 deadly practices for which you will be grateful
9 deadly practices for which you will be grateful9 deadly practices for which you will be grateful
9 deadly practices for which you will be grateful
 
Flask First-Timer
Flask First-TimerFlask First-Timer
Flask First-Timer
 
Five Ways to Get Better Data From Our Users
Five Ways to Get Better Data From Our UsersFive Ways to Get Better Data From Our Users
Five Ways to Get Better Data From Our Users
 
Essay Writing-A Day At The Seaside
Essay Writing-A Day At The SeasideEssay Writing-A Day At The Seaside
Essay Writing-A Day At The Seaside
 
Psychology for designers or 3 predictions from psychology for the future of ...
Psychology for designers or 3 predictions from psychology  for the future of ...Psychology for designers or 3 predictions from psychology  for the future of ...
Psychology for designers or 3 predictions from psychology for the future of ...
 
Psychology for designers or 3 predictions from psychology for the future of ...
Psychology for designers or 3 predictions from psychology  for the future of ...Psychology for designers or 3 predictions from psychology  for the future of ...
Psychology for designers or 3 predictions from psychology for the future of ...
 
10 Common Grammar Questions NATIVE speakers have!.pdf
10 Common Grammar Questions NATIVE speakers have!.pdf10 Common Grammar Questions NATIVE speakers have!.pdf
10 Common Grammar Questions NATIVE speakers have!.pdf
 
Tickets Make Ops Unnecessarily Miserable: The Journey to Self-Service
Tickets Make Ops Unnecessarily Miserable: The Journey to Self-ServiceTickets Make Ops Unnecessarily Miserable: The Journey to Self-Service
Tickets Make Ops Unnecessarily Miserable: The Journey to Self-Service
 
LeadDev NYC 2022: Calling Out a Terrible On-call System
LeadDev NYC 2022: Calling Out a Terrible On-call SystemLeadDev NYC 2022: Calling Out a Terrible On-call System
LeadDev NYC 2022: Calling Out a Terrible On-call System
 
DIY Marketing Tips
DIY Marketing TipsDIY Marketing Tips
DIY Marketing Tips
 
Immutable Laws
Immutable LawsImmutable Laws
Immutable Laws
 
Lined Writing Paper With Picture Space. Online assignment writing service.
Lined Writing Paper With Picture Space. Online assignment writing service.Lined Writing Paper With Picture Space. Online assignment writing service.
Lined Writing Paper With Picture Space. Online assignment writing service.
 
We need to Talk about Frank
We need to Talk about FrankWe need to Talk about Frank
We need to Talk about Frank
 
SpeakUp – A Mobile App Facilitating Audience Interaction
SpeakUp – A Mobile App Facilitating Audience InteractionSpeakUp – A Mobile App Facilitating Audience Interaction
SpeakUp – A Mobile App Facilitating Audience Interaction
 
Christian Heilmann - Building human interfaces powered by AI - Codemotion Ber...
Christian Heilmann - Building human interfaces powered by AI - Codemotion Ber...Christian Heilmann - Building human interfaces powered by AI - Codemotion Ber...
Christian Heilmann - Building human interfaces powered by AI - Codemotion Ber...
 
Model storming - a different approach to collaborative model discovery (Vilni...
Model storming - a different approach to collaborative model discovery (Vilni...Model storming - a different approach to collaborative model discovery (Vilni...
Model storming - a different approach to collaborative model discovery (Vilni...
 
Designing Great APIs: Learning from Jony Ive, Orwell, and the Kano Model
Designing Great APIs: Learning from Jony Ive, Orwell, and the Kano ModelDesigning Great APIs: Learning from Jony Ive, Orwell, and the Kano Model
Designing Great APIs: Learning from Jony Ive, Orwell, and the Kano Model
 
Hacker To Founder - Filipino Technical Co-Founders at Work
Hacker To Founder - Filipino Technical Co-Founders at WorkHacker To Founder - Filipino Technical Co-Founders at Work
Hacker To Founder - Filipino Technical Co-Founders at Work
 
D3 Design By Games Agile India Pune 2005
D3 Design By Games   Agile India   Pune 2005D3 Design By Games   Agile India   Pune 2005
D3 Design By Games Agile India Pune 2005
 
10 Signs that your startup is likely to fail
10 Signs that your startup is likely to fail10 Signs that your startup is likely to fail
10 Signs that your startup is likely to fail
 

More from Cory Foy

Defending Commoditization: Mapping Gameplays and Strategies to Stay Ahead in ...
Defending Commoditization: Mapping Gameplays and Strategies to Stay Ahead in ...Defending Commoditization: Mapping Gameplays and Strategies to Stay Ahead in ...
Defending Commoditization: Mapping Gameplays and Strategies to Stay Ahead in ...
Cory Foy
 
Stratgic Play - Doing the Right Thing at the Right Time
Stratgic Play - Doing the Right Thing at the Right TimeStratgic Play - Doing the Right Thing at the Right Time
Stratgic Play - Doing the Right Thing at the Right Time
Cory Foy
 
Continuous Deployment and Testing Workshop from Better Software West
Continuous Deployment and Testing Workshop from Better Software WestContinuous Deployment and Testing Workshop from Better Software West
Continuous Deployment and Testing Workshop from Better Software West
Cory Foy
 
Choosing Between Scrum and Kanban - TriAgile 2015
Choosing Between Scrum and Kanban - TriAgile 2015Choosing Between Scrum and Kanban - TriAgile 2015
Choosing Between Scrum and Kanban - TriAgile 2015
Cory Foy
 
Code Katas
Code KatasCode Katas
Code Katas
Cory Foy
 
Distributed Agility
Distributed AgilityDistributed Agility
Distributed Agility
Cory Foy
 
Kanban for DevOps
Kanban for DevOpsKanban for DevOps
Kanban for DevOps
Cory Foy
 
Ruby and OO for Beginners
Ruby and OO for BeginnersRuby and OO for Beginners
Ruby and OO for Beginners
Cory Foy
 
Agile Roots: The Agile Mindset - Agility Across the Organization
Agile Roots: The Agile Mindset - Agility Across the OrganizationAgile Roots: The Agile Mindset - Agility Across the Organization
Agile Roots: The Agile Mindset - Agility Across the Organization
Cory Foy
 
Triangle.rb - How Secure is Your Rails Site, Anyway?
Triangle.rb - How Secure is Your Rails Site, Anyway?Triangle.rb - How Secure is Your Rails Site, Anyway?
Triangle.rb - How Secure is Your Rails Site, Anyway?
Cory Foy
 
Scrum vs Kanban - Implementing Agility at Scale
Scrum vs Kanban - Implementing Agility at ScaleScrum vs Kanban - Implementing Agility at Scale
Scrum vs Kanban - Implementing Agility at Scale
Cory Foy
 
Patterns in Rails
Patterns in RailsPatterns in Rails
Patterns in Rails
Cory Foy
 
When Code Cries
When Code CriesWhen Code Cries
When Code Cries
Cory Foy
 
Ruby for C# Developers
Ruby for C# DevelopersRuby for C# Developers
Ruby for C# Developers
Cory Foy
 
Getting Unstuck: Working with Legacy Code and Data
Getting Unstuck: Working with Legacy Code and DataGetting Unstuck: Working with Legacy Code and Data
Getting Unstuck: Working with Legacy Code and Data
Cory Foy
 
Mud Tires: Getting Traction in Legacy Code
Mud Tires: Getting Traction in Legacy CodeMud Tires: Getting Traction in Legacy Code
Mud Tires: Getting Traction in Legacy Code
Cory Foy
 
Fostering Software Craftsmanship
Fostering Software CraftsmanshipFostering Software Craftsmanship
Fostering Software Craftsmanship
Cory Foy
 
Delivering What's Right
Delivering What's RightDelivering What's Right
Delivering What's Right
Cory Foy
 
Koans and Katas, Oh My! From Øredev 2010
Koans and Katas, Oh My! From Øredev 2010Koans and Katas, Oh My! From Øredev 2010
Koans and Katas, Oh My! From Øredev 2010
Cory Foy
 
Technically Distributed - Tools and Techniques for Distributed Teams
Technically Distributed - Tools and Techniques for Distributed TeamsTechnically Distributed - Tools and Techniques for Distributed Teams
Technically Distributed - Tools and Techniques for Distributed Teams
Cory Foy
 

More from Cory Foy (20)

Defending Commoditization: Mapping Gameplays and Strategies to Stay Ahead in ...
Defending Commoditization: Mapping Gameplays and Strategies to Stay Ahead in ...Defending Commoditization: Mapping Gameplays and Strategies to Stay Ahead in ...
Defending Commoditization: Mapping Gameplays and Strategies to Stay Ahead in ...
 
Stratgic Play - Doing the Right Thing at the Right Time
Stratgic Play - Doing the Right Thing at the Right TimeStratgic Play - Doing the Right Thing at the Right Time
Stratgic Play - Doing the Right Thing at the Right Time
 
Continuous Deployment and Testing Workshop from Better Software West
Continuous Deployment and Testing Workshop from Better Software WestContinuous Deployment and Testing Workshop from Better Software West
Continuous Deployment and Testing Workshop from Better Software West
 
Choosing Between Scrum and Kanban - TriAgile 2015
Choosing Between Scrum and Kanban - TriAgile 2015Choosing Between Scrum and Kanban - TriAgile 2015
Choosing Between Scrum and Kanban - TriAgile 2015
 
Code Katas
Code KatasCode Katas
Code Katas
 
Distributed Agility
Distributed AgilityDistributed Agility
Distributed Agility
 
Kanban for DevOps
Kanban for DevOpsKanban for DevOps
Kanban for DevOps
 
Ruby and OO for Beginners
Ruby and OO for BeginnersRuby and OO for Beginners
Ruby and OO for Beginners
 
Agile Roots: The Agile Mindset - Agility Across the Organization
Agile Roots: The Agile Mindset - Agility Across the OrganizationAgile Roots: The Agile Mindset - Agility Across the Organization
Agile Roots: The Agile Mindset - Agility Across the Organization
 
Triangle.rb - How Secure is Your Rails Site, Anyway?
Triangle.rb - How Secure is Your Rails Site, Anyway?Triangle.rb - How Secure is Your Rails Site, Anyway?
Triangle.rb - How Secure is Your Rails Site, Anyway?
 
Scrum vs Kanban - Implementing Agility at Scale
Scrum vs Kanban - Implementing Agility at ScaleScrum vs Kanban - Implementing Agility at Scale
Scrum vs Kanban - Implementing Agility at Scale
 
Patterns in Rails
Patterns in RailsPatterns in Rails
Patterns in Rails
 
When Code Cries
When Code CriesWhen Code Cries
When Code Cries
 
Ruby for C# Developers
Ruby for C# DevelopersRuby for C# Developers
Ruby for C# Developers
 
Getting Unstuck: Working with Legacy Code and Data
Getting Unstuck: Working with Legacy Code and DataGetting Unstuck: Working with Legacy Code and Data
Getting Unstuck: Working with Legacy Code and Data
 
Mud Tires: Getting Traction in Legacy Code
Mud Tires: Getting Traction in Legacy CodeMud Tires: Getting Traction in Legacy Code
Mud Tires: Getting Traction in Legacy Code
 
Fostering Software Craftsmanship
Fostering Software CraftsmanshipFostering Software Craftsmanship
Fostering Software Craftsmanship
 
Delivering What's Right
Delivering What's RightDelivering What's Right
Delivering What's Right
 
Koans and Katas, Oh My! From Øredev 2010
Koans and Katas, Oh My! From Øredev 2010Koans and Katas, Oh My! From Øredev 2010
Koans and Katas, Oh My! From Øredev 2010
 
Technically Distributed - Tools and Techniques for Distributed Teams
Technically Distributed - Tools and Techniques for Distributed TeamsTechnically Distributed - Tools and Techniques for Distributed Teams
Technically Distributed - Tools and Techniques for Distributed Teams
 

Recently uploaded

Freshworks Rethinks NoSQL for Rapid Scaling & Cost-Efficiency
Freshworks Rethinks NoSQL for Rapid Scaling & Cost-EfficiencyFreshworks Rethinks NoSQL for Rapid Scaling & Cost-Efficiency
Freshworks Rethinks NoSQL for Rapid Scaling & Cost-Efficiency
ScyllaDB
 
Fueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte WebinarFueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte Webinar
Zilliz
 
Y-Combinator seed pitch deck template PP
Y-Combinator seed pitch deck template PPY-Combinator seed pitch deck template PP
Y-Combinator seed pitch deck template PP
c5vrf27qcz
 
Essentials of Automations: Exploring Attributes & Automation Parameters
Essentials of Automations: Exploring Attributes & Automation ParametersEssentials of Automations: Exploring Attributes & Automation Parameters
Essentials of Automations: Exploring Attributes & Automation Parameters
Safe Software
 
GraphRAG for LifeSciences Hands-On with the Clinical Knowledge Graph
GraphRAG for LifeSciences Hands-On with the Clinical Knowledge GraphGraphRAG for LifeSciences Hands-On with the Clinical Knowledge Graph
GraphRAG for LifeSciences Hands-On with the Clinical Knowledge Graph
Neo4j
 
Digital Banking in the Cloud: How Citizens Bank Unlocked Their Mainframe
Digital Banking in the Cloud: How Citizens Bank Unlocked Their MainframeDigital Banking in the Cloud: How Citizens Bank Unlocked Their Mainframe
Digital Banking in the Cloud: How Citizens Bank Unlocked Their Mainframe
Precisely
 
Generating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and MilvusGenerating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and Milvus
Zilliz
 
JavaLand 2024: Application Development Green Masterplan
JavaLand 2024: Application Development Green MasterplanJavaLand 2024: Application Development Green Masterplan
JavaLand 2024: Application Development Green Masterplan
Miro Wengner
 
What is an RPA CoE? Session 1 – CoE Vision
What is an RPA CoE?  Session 1 – CoE VisionWhat is an RPA CoE?  Session 1 – CoE Vision
What is an RPA CoE? Session 1 – CoE Vision
DianaGray10
 
Skybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoptionSkybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoption
Tatiana Kojar
 
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdfHow to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
Chart Kalyan
 
Biomedical Knowledge Graphs for Data Scientists and Bioinformaticians
Biomedical Knowledge Graphs for Data Scientists and BioinformaticiansBiomedical Knowledge Graphs for Data Scientists and Bioinformaticians
Biomedical Knowledge Graphs for Data Scientists and Bioinformaticians
Neo4j
 
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAUHCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
panagenda
 
Main news related to the CCS TSI 2023 (2023/1695)
Main news related to the CCS TSI 2023 (2023/1695)Main news related to the CCS TSI 2023 (2023/1695)
Main news related to the CCS TSI 2023 (2023/1695)
Jakub Marek
 
zkStudyClub - LatticeFold: A Lattice-based Folding Scheme and its Application...
zkStudyClub - LatticeFold: A Lattice-based Folding Scheme and its Application...zkStudyClub - LatticeFold: A Lattice-based Folding Scheme and its Application...
zkStudyClub - LatticeFold: A Lattice-based Folding Scheme and its Application...
Alex Pruden
 
Choosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptxChoosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptx
Brandon Minnick, MBA
 
Harnessing the Power of NLP and Knowledge Graphs for Opioid Research
Harnessing the Power of NLP and Knowledge Graphs for Opioid ResearchHarnessing the Power of NLP and Knowledge Graphs for Opioid Research
Harnessing the Power of NLP and Knowledge Graphs for Opioid Research
Neo4j
 
Columbus Data & Analytics Wednesdays - June 2024
Columbus Data & Analytics Wednesdays - June 2024Columbus Data & Analytics Wednesdays - June 2024
Columbus Data & Analytics Wednesdays - June 2024
Jason Packer
 
Northern Engraving | Nameplate Manufacturing Process - 2024
Northern Engraving | Nameplate Manufacturing Process - 2024Northern Engraving | Nameplate Manufacturing Process - 2024
Northern Engraving | Nameplate Manufacturing Process - 2024
Northern Engraving
 

Recently uploaded (20)

Freshworks Rethinks NoSQL for Rapid Scaling & Cost-Efficiency
Freshworks Rethinks NoSQL for Rapid Scaling & Cost-EfficiencyFreshworks Rethinks NoSQL for Rapid Scaling & Cost-Efficiency
Freshworks Rethinks NoSQL for Rapid Scaling & Cost-Efficiency
 
Fueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte WebinarFueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte Webinar
 
Artificial Intelligence and Electronic Warfare
Artificial Intelligence and Electronic WarfareArtificial Intelligence and Electronic Warfare
Artificial Intelligence and Electronic Warfare
 
Y-Combinator seed pitch deck template PP
Y-Combinator seed pitch deck template PPY-Combinator seed pitch deck template PP
Y-Combinator seed pitch deck template PP
 
Essentials of Automations: Exploring Attributes & Automation Parameters
Essentials of Automations: Exploring Attributes & Automation ParametersEssentials of Automations: Exploring Attributes & Automation Parameters
Essentials of Automations: Exploring Attributes & Automation Parameters
 
GraphRAG for LifeSciences Hands-On with the Clinical Knowledge Graph
GraphRAG for LifeSciences Hands-On with the Clinical Knowledge GraphGraphRAG for LifeSciences Hands-On with the Clinical Knowledge Graph
GraphRAG for LifeSciences Hands-On with the Clinical Knowledge Graph
 
Digital Banking in the Cloud: How Citizens Bank Unlocked Their Mainframe
Digital Banking in the Cloud: How Citizens Bank Unlocked Their MainframeDigital Banking in the Cloud: How Citizens Bank Unlocked Their Mainframe
Digital Banking in the Cloud: How Citizens Bank Unlocked Their Mainframe
 
Generating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and MilvusGenerating privacy-protected synthetic data using Secludy and Milvus
Generating privacy-protected synthetic data using Secludy and Milvus
 
JavaLand 2024: Application Development Green Masterplan
JavaLand 2024: Application Development Green MasterplanJavaLand 2024: Application Development Green Masterplan
JavaLand 2024: Application Development Green Masterplan
 
What is an RPA CoE? Session 1 – CoE Vision
What is an RPA CoE?  Session 1 – CoE VisionWhat is an RPA CoE?  Session 1 – CoE Vision
What is an RPA CoE? Session 1 – CoE Vision
 
Skybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoptionSkybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoption
 
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdfHow to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
How to Interpret Trends in the Kalyan Rajdhani Mix Chart.pdf
 
Biomedical Knowledge Graphs for Data Scientists and Bioinformaticians
Biomedical Knowledge Graphs for Data Scientists and BioinformaticiansBiomedical Knowledge Graphs for Data Scientists and Bioinformaticians
Biomedical Knowledge Graphs for Data Scientists and Bioinformaticians
 
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAUHCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
 
Main news related to the CCS TSI 2023 (2023/1695)
Main news related to the CCS TSI 2023 (2023/1695)Main news related to the CCS TSI 2023 (2023/1695)
Main news related to the CCS TSI 2023 (2023/1695)
 
zkStudyClub - LatticeFold: A Lattice-based Folding Scheme and its Application...
zkStudyClub - LatticeFold: A Lattice-based Folding Scheme and its Application...zkStudyClub - LatticeFold: A Lattice-based Folding Scheme and its Application...
zkStudyClub - LatticeFold: A Lattice-based Folding Scheme and its Application...
 
Choosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptxChoosing The Best AWS Service For Your Website + API.pptx
Choosing The Best AWS Service For Your Website + API.pptx
 
Harnessing the Power of NLP and Knowledge Graphs for Opioid Research
Harnessing the Power of NLP and Knowledge Graphs for Opioid ResearchHarnessing the Power of NLP and Knowledge Graphs for Opioid Research
Harnessing the Power of NLP and Knowledge Graphs for Opioid Research
 
Columbus Data & Analytics Wednesdays - June 2024
Columbus Data & Analytics Wednesdays - June 2024Columbus Data & Analytics Wednesdays - June 2024
Columbus Data & Analytics Wednesdays - June 2024
 
Northern Engraving | Nameplate Manufacturing Process - 2024
Northern Engraving | Nameplate Manufacturing Process - 2024Northern Engraving | Nameplate Manufacturing Process - 2024
Northern Engraving | Nameplate Manufacturing Process - 2024
 

SQE Boston - When Code Cries

  • 1. When Code Cries Cory Foy @cory_foy foyc@coryfoy.com http://www.coryfoy.com @cory_foy foyc@coryfoy.com Thursday, November 14, 13 Reading from Timeless Way. Then: All of us here are technologists in some way. We desire to build things that people will use. Living software. But if you look at our industry, the fruit of our labors is not living software. The majority of software out there has a common attribute. It is: 1
  • 2. Bad Code @cory_foy foyc@coryfoy.com Thursday, November 14, 13 Bad Code is the bane of the software industry. Why is it that, over time, code becomes harder and harder to work with - and how can we prevent ours from ending up with the same fate? To answer that, perhaps we should start with identifying what quality code is. So, is this quality code? 2
  • 3. Is this quality code? @cory_foy foyc@coryfoy.com Thursday, November 14, 13 Why do we like Easy to Change code? Because it is a lower cognitive burden. Because writing code is hard enough, as we’ll see. 3
  • 4. Is this quality code? @cory_foy foyc@coryfoy.com Thursday, November 14, 13 Why do we like Easy to Change code? Because it is a lower cognitive burden. Because writing code is hard enough, as we’ll see. 3
  • 5. Cognitively Undemanding Where we want our software Context Embedded Context Reduced Modifying Software we wrote @cory_foy Modifying Software we didn’t write Cognitively Demanding foyc@coryfoy.com Thursday, November 14, 13 We want code that is in the upper right quadrant. But, if we’re lucky to be modifying our own code, it’s in the lower left. Worse case, we don’t even have the context, so it’s in the lower right. Now, if we have tests, that helps increase the context. But when we don’t, we can end up with code that looks like 4
  • 6. Cognitively Undemanding Where we want our software Context Embedded Context Reduced Modifying Software we wrote @cory_foy Modifying Software we didn’t write Cognitively Demanding foyc@coryfoy.com Thursday, November 14, 13 We want code that is in the upper right quadrant. But, if we’re lucky to be modifying our own code, it’s in the lower left. Worse case, we don’t even have the context, so it’s in the lower right. Now, if we have tests, that helps increase the context. But when we don’t, we can end up with code that looks like 4
  • 7. Cognitively Undemanding Where we want our software Context Embedded Context Reduced Modifying Software we wrote @cory_foy Modifying Software we didn’t write Cognitively Demanding foyc@coryfoy.com Thursday, November 14, 13 We want code that is in the upper right quadrant. But, if we’re lucky to be modifying our own code, it’s in the lower left. Worse case, we don’t even have the context, so it’s in the lower right. Now, if we have tests, that helps increase the context. But when we don’t, we can end up with code that looks like 4
  • 8. Cognitively Undemanding Where we want our software Context Embedded Context Reduced Modifying Software we wrote @cory_foy Modifying Software we didn’t write Cognitively Demanding foyc@coryfoy.com Thursday, November 14, 13 We want code that is in the upper right quadrant. But, if we’re lucky to be modifying our own code, it’s in the lower left. Worse case, we don’t even have the context, so it’s in the lower right. Now, if we have tests, that helps increase the context. But when we don’t, we can end up with code that looks like 4
  • 9. @cory_foy Thursday, November 14, 13 foyc@coryfoy.com 5 Code that isn’t a joy. That is anti-joy. Code which is frustrating to be around. This is not code that is alive - this is code which has problems. And these problems - we tend to name them something. When we see something not right in code, what do we say?
  • 10. @cory_foy Thursday, November 14, 13 foyc@coryfoy.com 5 Code that isn’t a joy. That is anti-joy. Code which is frustrating to be around. This is not code that is alive - this is code which has problems. And these problems - we tend to name them something. When we see something not right in code, what do we say?
  • 11. @cory_foy Thursday, November 14, 13 foyc@coryfoy.com 5 Code that isn’t a joy. That is anti-joy. Code which is frustrating to be around. This is not code that is alive - this is code which has problems. And these problems - we tend to name them something. When we see something not right in code, what do we say?
  • 12. @cory_foy Thursday, November 14, 13 foyc@coryfoy.com 5 Code that isn’t a joy. That is anti-joy. Code which is frustrating to be around. This is not code that is alive - this is code which has problems. And these problems - we tend to name them something. When we see something not right in code, what do we say?
  • 13. @cory_foy Thursday, November 14, 13 foyc@coryfoy.com 5 Code that isn’t a joy. That is anti-joy. Code which is frustrating to be around. This is not code that is alive - this is code which has problems. And these problems - we tend to name them something. When we see something not right in code, what do we say?
  • 14. @cory_foy Thursday, November 14, 13 foyc@coryfoy.com 5 Code that isn’t a joy. That is anti-joy. Code which is frustrating to be around. This is not code that is alive - this is code which has problems. And these problems - we tend to name them something. When we see something not right in code, what do we say?
  • 15. @cory_foy Thursday, November 14, 13 foyc@coryfoy.com 5 Code that isn’t a joy. That is anti-joy. Code which is frustrating to be around. This is not code that is alive - this is code which has problems. And these problems - we tend to name them something. When we see something not right in code, what do we say?
  • 16. @cory_foy Thursday, November 14, 13 foyc@coryfoy.com 5 Code that isn’t a joy. That is anti-joy. Code which is frustrating to be around. This is not code that is alive - this is code which has problems. And these problems - we tend to name them something. When we see something not right in code, what do we say?
  • 17. Code Smells @cory_foy Thursday, November 14, 13 foyc@coryfoy.com 6 Right - “Smelly Code”. But what I’d like to do today is reframe the discussion slightly. Instead of telling our code that it smells, let’s recognize something else - our code is trying to talk to us.
  • 18. Code Talks @cory_foy foyc@coryfoy.com Thursday, November 14, 13 And imagine trying to talk to someone about something important - say, the building is on fire - and them not understanding your strange gestures and telling you you are smelly. Would that make you happy? It doesn’t make our code happy. And if I can take some poetic license, I’d even say that code cries 7
  • 19. Code Cries @cory_foy Thursday, November 14, 13 foyc@coryfoy.com 8 And our code cries not because it is smelly, but because no one understands what it is trying to say. It’s trying to point out what it wants to do, what is important, and how to use it. And it isn’t happy about that! Too often we try to force what we want, what we think is best.
  • 20. Code Cries Because No One Understands What It Is Saying @cory_foy Thursday, November 14, 13 foyc@coryfoy.com 8 And our code cries not because it is smelly, but because no one understands what it is trying to say. It’s trying to point out what it wants to do, what is important, and how to use it. And it isn’t happy about that! Too often we try to force what we want, what we think is best.
  • 21. “...we have so far beset ourselves with rules, and concepts, and ideas...that we have become afraid of what will happen naturally, and convinced that we must work within a “system” and with “methods” [or] our surroundings will come tumbling down in chaos.” Christopher Alexander - “The Timeless Way of Building” @cory_foy Thursday, November 14, 13 foyc@coryfoy.com 9 We turn to our UML and architecture diagrams and design documents, trying to brute force a system that will work, afraid that if we don’t - chaos. But nature *dictates* an iterative design - one where the best path is not only discovered, but continually chosen. We literally can not build software any other way. 
  • 22. @cory_foy Thursday, November 14, 13 foyc@coryfoy.com 10 This is a map of the Mississippi River in the United States. What’s special about it is that it is all of the routes the river has run through the years. We create a design. We settle down, build a house, have a family. But the code doesn't want that. It has plans beyond our design. And if we don't listen to those plans, our days will become filled with holding off the impending - and inevitable - change (http://www.adammandelman.net/tag/harold-fisk/)
  • 23. @cory_foy Thursday, November 14, 13 foyc@coryfoy.com 11 For example, in 2011, the Mississippi River tried to change course, I believe to the Orange area. And it normally would have - except for the millions of dollars the Army Corp of Engineers spent to erect dams, flood farm fields and otherwise keep it on the course best for us - not for it. But trying to brute force design into nature’s iterative process isn’t the only problem. (10k next)
  • 24. @cory_foy Thursday, November 14, 13 foyc@coryfoy.com 12 There’s a common figure that is given to developers about what it takes to become great in software. Does anyone know that number? <Click> This is the number of hours to “master” a skill. But as much as we tout this, we don’t really act like this is important. People new to software either get this
  • 25. Ten Thousand Hours @cory_foy Thursday, November 14, 13 foyc@coryfoy.com 12 There’s a common figure that is given to developers about what it takes to become great in software. Does anyone know that number? <Click> This is the number of hours to “master” a skill. But as much as we tout this, we don’t really act like this is important. People new to software either get this
  • 26. bloody @cory_foy Thursday, November 14, 13 So, confusion and frustration, or this foyc@coryfoy.com 13
  • 27. @cory_foy foyc@coryfoy.com Thursday, November 14, 13 Empty promises! (Beaker story). Can you imagine learning C++ in 24 hours? Well, you might be able to learn syntax, but building great software isn’t just about learning syntax. Or diagrams. At the start of the talk, I quoted Alexander talking about a Timeless Way of Building - and that this way - this timeless way - is the only way buildings - or software that are alive can be built. And if we go right to the kernel of that way, he says 14
  • 28. @cory_foy foyc@coryfoy.com Thursday, November 14, 13 Empty promises! (Beaker story). Can you imagine learning C++ in 24 hours? Well, you might be able to learn syntax, but building great software isn’t just about learning syntax. Or diagrams. At the start of the talk, I quoted Alexander talking about a Timeless Way of Building - and that this way - this timeless way - is the only way buildings - or software that are alive can be built. And if we go right to the kernel of that way, he says 14
  • 29. @cory_foy foyc@coryfoy.com Thursday, November 14, 13 Empty promises! (Beaker story). Can you imagine learning C++ in 24 hours? Well, you might be able to learn syntax, but building great software isn’t just about learning syntax. Or diagrams. At the start of the talk, I quoted Alexander talking about a Timeless Way of Building - and that this way - this timeless way - is the only way buildings - or software that are alive can be built. And if we go right to the kernel of that way, he says 14
  • 30. @cory_foy foyc@coryfoy.com Thursday, November 14, 13 Empty promises! (Beaker story). Can you imagine learning C++ in 24 hours? Well, you might be able to learn syntax, but building great software isn’t just about learning syntax. Or diagrams. At the start of the talk, I quoted Alexander talking about a Timeless Way of Building - and that this way - this timeless way - is the only way buildings - or software that are alive can be built. And if we go right to the kernel of that way, he says 14
  • 31. “To make a building {alive}...the builder must let go of all his willful images, and start with a void...At this stage the building’s life will come directly from your language” Christopher Alexander - “The Timeless Way of Building” @cory_foy foyc@coryfoy.com Thursday, November 14, 13 So for us to be able to build great software, we have to be willing to let go of the diagrams. Of the syntax. Of the “Point A, Point B, flow”. And let go of the fear 15
  • 32. “You are able to do this only when you no longer fear that nothing will happen” Christopher Alexander - “The Timeless Way of Building” @cory_foy foyc@coryfoy.com Thursday, November 14, 13 of the fear that if we let go, nothing will happen. Or chaos will happen. So, how do we get to the point where we feel comfortable enough to let go. And, more importantly, how do we teach others to get to that point? I think that the way that we do that is by recognizing that the heart of programming isn’t code, but communication. That’s why we call them programming languages. And we can learn a lot from how people learn languages to help us along our ten thousand hour path to get to the point where we can build alive systems by letting go 16
  • 33. Imperative Programming Functional Programming Logic Programming Dynamic Typing Static Typing @cory_foy foyc@coryfoy.com Thursday, November 14, 13 This first is the understanding of how languages/paradigms affect our viewpoints. Roman Jakobson points out “Languages differ...must convey vs what they may convey”. “dinner with a neighbor last night”, doesn’t reveal if it was a male or female. But if I said in German, I would be obliged to (Nachbar vs Nachbarin). Functional: context of reduction of terms. Imperative: statement of the process, and logic: statement of the result. Static: abstractions sooner, dynamic: abstraction to be held off 17
  • 34. Coding Standards Define Dialects @cory_foy Thursday, November 14, 13 foyc@coryfoy.com 18 The second is that even within languages we have dialects. We have to agree on what that common dialect is going to be. This is traditionally the essence of coding standards - what is our agreed upon dialect?
  • 35. Coding Standards Define Dialects @cory_foy Thursday, November 14, 13 foyc@coryfoy.com 18 The second is that even within languages we have dialects. We have to agree on what that common dialect is going to be. This is traditionally the essence of coding standards - what is our agreed upon dialect?
  • 36. Coding Standards Define Dialects @cory_foy Thursday, November 14, 13 foyc@coryfoy.com 18 The second is that even within languages we have dialects. We have to agree on what that common dialect is going to be. This is traditionally the essence of coding standards - what is our agreed upon dialect?
  • 37. BICS CALP @cory_foy foyc@coryfoy.com Thursday, November 14, 13 The third is that the way we approach and learn languages is somewhat haphazard. You only need to look at any programming language book to see they all do them differently. But the process of learning a natural language is well known, and standardized regardless of the language. We can apply a similar framework to develop the skills we need to listen and understand our code 19
  • 38. BICS CALP @cory_foy foyc@coryfoy.com Thursday, November 14, 13 The third is that the way we approach and learn languages is somewhat haphazard. You only need to look at any programming language book to see they all do them differently. But the process of learning a natural language is well known, and standardized regardless of the language. We can apply a similar framework to develop the skills we need to listen and understand our code 19
  • 39. BICS Context Embedded Context Reduced CALP @cory_foy foyc@coryfoy.com Thursday, November 14, 13 The third is that the way we approach and learn languages is somewhat haphazard. You only need to look at any programming language book to see they all do them differently. But the process of learning a natural language is well known, and standardized regardless of the language. We can apply a similar framework to develop the skills we need to listen and understand our code 19
  • 40. Cognitively Undemanding - Copying from the board - Reading a Map - Face to Face Conversation - Selecting food in the lunchroom BICS Context Embedded Context Reduced CALP @cory_foy Cognitively Demanding foyc@coryfoy.com Thursday, November 14, 13 The third is that the way we approach and learn languages is somewhat haphazard. You only need to look at any programming language book to see they all do them differently. But the process of learning a natural language is well known, and standardized regardless of the language. We can apply a similar framework to develop the skills we need to listen and understand our code 19
  • 41. Cognitively Undemanding - Copying from the board - Reading a Map - Face to Face Conversation - Selecting food in the lunchroom BICS - Following a class schedule - Telephone Conversation - Oral Presentations - Getting an absence excuse Context Embedded Context Reduced CALP @cory_foy Cognitively Demanding foyc@coryfoy.com Thursday, November 14, 13 The third is that the way we approach and learn languages is somewhat haphazard. You only need to look at any programming language book to see they all do them differently. But the process of learning a natural language is well known, and standardized regardless of the language. We can apply a similar framework to develop the skills we need to listen and understand our code 19
  • 42. Cognitively Undemanding - Copying from the board - Reading a Map - Face to Face Conversation - Selecting food in the lunchroom BICS - Following a class schedule - Telephone Conversation - Oral Presentations - Getting an absence excuse Context Embedded Context Reduced - Demonstrations - Basic Math Computations - Science Experiments CALP @cory_foy Cognitively Demanding foyc@coryfoy.com Thursday, November 14, 13 The third is that the way we approach and learn languages is somewhat haphazard. You only need to look at any programming language book to see they all do them differently. But the process of learning a natural language is well known, and standardized regardless of the language. We can apply a similar framework to develop the skills we need to listen and understand our code 19
  • 43. Cognitively Undemanding - Copying from the board - Reading a Map - Face to Face Conversation - Selecting food in the lunchroom BICS - Following a class schedule - Telephone Conversation - Oral Presentations - Getting an absence excuse Context Embedded Context Reduced - Demonstrations - Basic Math Computations - Science Experiments - Standardized Tests - Math Concepts and Applications - Listening to a Lecture CALP @cory_foy Cognitively Demanding foyc@coryfoy.com Thursday, November 14, 13 The third is that the way we approach and learn languages is somewhat haphazard. You only need to look at any programming language book to see they all do them differently. But the process of learning a natural language is well known, and standardized regardless of the language. We can apply a similar framework to develop the skills we need to listen and understand our code 19
  • 44. Cognitively Undemanding BICS Context Embedded Context Reduced CALP @cory_foy Cognitively Demanding foyc@coryfoy.com Thursday, November 14, 13 This framework, which I’m calling the “Foy-Z” model (with great irreverence), looks like this. We need to start by providing context. Katas provide a container to operate with in. Koans provide language specific nuances. Principles help us analyze our code in a higher context way, while patterns forces us to think about our overall goals. So let’s look at these a little more. 20
  • 45. Foy-Z Cognitively Undemanding BICS Context Embedded Context Reduced CALP @cory_foy Cognitively Demanding foyc@coryfoy.com Thursday, November 14, 13 This framework, which I’m calling the “Foy-Z” model (with great irreverence), looks like this. We need to start by providing context. Katas provide a container to operate with in. Koans provide language specific nuances. Principles help us analyze our code in a higher context way, while patterns forces us to think about our overall goals. So let’s look at these a little more. 20
  • 46. Foy-Z Cognitively Undemanding BICS Katas Context Embedded Context Reduced CALP @cory_foy Cognitively Demanding foyc@coryfoy.com Thursday, November 14, 13 This framework, which I’m calling the “Foy-Z” model (with great irreverence), looks like this. We need to start by providing context. Katas provide a container to operate with in. Koans provide language specific nuances. Principles help us analyze our code in a higher context way, while patterns forces us to think about our overall goals. So let’s look at these a little more. 20
  • 47. Foy-Z Cognitively Undemanding BICS Katas Koans Context Embedded Context Reduced CALP @cory_foy Cognitively Demanding foyc@coryfoy.com Thursday, November 14, 13 This framework, which I’m calling the “Foy-Z” model (with great irreverence), looks like this. We need to start by providing context. Katas provide a container to operate with in. Koans provide language specific nuances. Principles help us analyze our code in a higher context way, while patterns forces us to think about our overall goals. So let’s look at these a little more. 20
  • 48. Foy-Z Cognitively Undemanding BICS Katas Koans Context Embedded Context Reduced Principles CALP @cory_foy Cognitively Demanding foyc@coryfoy.com Thursday, November 14, 13 This framework, which I’m calling the “Foy-Z” model (with great irreverence), looks like this. We need to start by providing context. Katas provide a container to operate with in. Koans provide language specific nuances. Principles help us analyze our code in a higher context way, while patterns forces us to think about our overall goals. So let’s look at these a little more. 20
  • 49. Foy-Z Cognitively Undemanding BICS Katas Koans Context Embedded Context Reduced Principles Patterns CALP @cory_foy Cognitively Demanding foyc@coryfoy.com Thursday, November 14, 13 This framework, which I’m calling the “Foy-Z” model (with great irreverence), looks like this. We need to start by providing context. Katas provide a container to operate with in. Koans provide language specific nuances. Principles help us analyze our code in a higher context way, while patterns forces us to think about our overall goals. So let’s look at these a little more. 20
  • 50. Katas @cory_foy foyc@coryfoy.com Thursday, November 14, 13 Let’s start with Katas. First described in the software world by Pragmatic Dave Thomas, they offer the ability to practice without the solution being the cognitive challenge. In short, they allow developers to practice varying externally motivated viewpoints. 21
  • 51. Conway’s Game of Life - Infinite Grid of Cells - Each Cell has two states - alive or dead - Interacts with neighbors in a well known way http://en.wikipedia.org/wiki/Conway%27s_Game_of_Life @cory_foy Thursday, November 14, 13 foyc@coryfoy.com 22
  • 52. Conway’s Game of Life - Infinite Grid of Cells - Each Cell has two states - alive or dead - Interacts with neighbors in a well known way http://en.wikipedia.org/wiki/Conway%27s_Game_of_Life @cory_foy Thursday, November 14, 13 foyc@coryfoy.com 22
  • 53. Conway’s Game of Life - Infinite Grid of Cells - Each Cell has two states - alive or dead - Interacts with neighbors in a well known way http://en.wikipedia.org/wiki/Conway%27s_Game_of_Life @cory_foy Thursday, November 14, 13 foyc@coryfoy.com 22
  • 54. Conway’s Game of Life - Infinite Grid of Cells - Each Cell has two states - alive or dead - Interacts with neighbors in a well known way http://en.wikipedia.org/wiki/Conway%27s_Game_of_Life @cory_foy Thursday, November 14, 13 foyc@coryfoy.com 22
  • 55. Conway’s Game of Life - If Statement @cory_foy Thursday, November 14, 13 foyc@coryfoy.com 23
  • 56. Conway’s Game of Life - If Statement @cory_foy Thursday, November 14, 13 foyc@coryfoy.com 23
  • 57. Conway’s Game of Life - No Conditional @cory_foy Thursday, November 14, 13 foyc@coryfoy.com 24
  • 58. Foy-Z Cognitively Undemanding BICS Katas Context Embedded Context Reduced CALP @cory_foy Cognitively Demanding foyc@coryfoy.com Thursday, November 14, 13 So Katas allow us to not focus on solving the problem, but instead using the problem to explore the space of viewpoints. The context is very high - we cognitively understand the problem, so we can focus on practice. But at some point we need more - and that’s where 25
  • 59. Foy-Z Cognitively Undemanding BICS Katas Koans Context Embedded Context Reduced CALP @cory_foy Cognitively Demanding foyc@coryfoy.com Thursday, November 14, 13 So Katas allow us to not focus on solving the problem, but instead using the problem to explore the space of viewpoints. The context is very high - we cognitively understand the problem, so we can focus on practice. But at some point we need more - and that’s where 25
  • 60. Koans @cory_foy Thursday, November 14, 13 foyc@coryfoy.com 26 Koans come in. Koans provide language-specific nuances - the grammar if you will. They tend to be language specific, but lower context. It’s like practicing nouns and verbs - great to do, but much better if you have some context to put them in. For example (next Edgecase Koans)
  • 61. https://github.com/neo/ruby_koans @cory_foy foyc@coryfoy.com Thursday, November 14, 13 one of the more famous software Koans was by Edgecase (now called Neo). You can see in the structure it was very specific to the Ruby language - arrays, assets, blocks, etc. 27
  • 62. Ruby Koans Asserts @cory_foy Thursday, November 14, 13 foyc@coryfoy.com 28
  • 63. Ruby Koans Arrays @cory_foy Thursday, November 14, 13 foyc@coryfoy.com 29
  • 64. Foy-Z Cognitively Undemanding BICS Katas Koans Context Embedded Context Reduced CALP @cory_foy Cognitively Demanding foyc@coryfoy.com Thursday, November 14, 13 So far, we’ve stayed in the BICS realm. BUT! We’ve learned something interesting. The Koans taught us Ruby array management, and we needed that for our exercise, so let’s revisit the Katas 30
  • 65. Conway’s Game of Life - With Map @cory_foy Thursday, November 14, 13 foyc@coryfoy.com 31
  • 66. Conway’s Game of Life - With Map @cory_foy Thursday, November 14, 13 foyc@coryfoy.com 31
  • 67. Foy-Z Cognitively Undemanding BICS Katas Koans Context Embedded Context Reduced CALP @cory_foy Cognitively Demanding foyc@coryfoy.com Thursday, November 14, 13 At this point, we have enough basic skills that we can begin to get into cognitively demanding work. We have the context, and the grammar, but we don’t know the optimal ways to apply the grammar. That’s where coding principles come in to play 32
  • 68. Foy-Z Cognitively Undemanding BICS Katas Koans Context Embedded Context Reduced Principles CALP @cory_foy Cognitively Demanding foyc@coryfoy.com Thursday, November 14, 13 At this point, we have enough basic skills that we can begin to get into cognitively demanding work. We have the context, and the grammar, but we don’t know the optimal ways to apply the grammar. That’s where coding principles come in to play 32
  • 69. Principles @cory_foy foyc@coryfoy.com Thursday, November 14, 13 Our principles guide us in how we apply our code within the context of what we’re writing. 33
  • 70. SOLID Principles Do we have duplication (implementation or conceptual)? Single responsibilities? LoD violations? LSP violations? @cory_foy Thursday, November 14, 13 Transition to patterns foyc@coryfoy.com 34
  • 71. 4 Rules of Simple Design Does this code express all of the ideas we want to express? @cory_foy Thursday, November 14, 13 Patterns. 4 Rules of Simple Design. Fowler. SOLID foyc@coryfoy.com 35
  • 72. 4 Rules of Simple Design Does this code express all of the ideas we want to express? @cory_foy Thursday, November 14, 13 Patterns. 4 Rules of Simple Design. Fowler. SOLID foyc@coryfoy.com 35
  • 73. 4 Rules of Simple Design Does this code express all of the ideas we want to express? @cory_foy Thursday, November 14, 13 Patterns. 4 Rules of Simple Design. Fowler. SOLID foyc@coryfoy.com 35
  • 74. 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? @cory_foy Thursday, November 14, 13 Patterns. 4 Rules of Simple Design. Fowler. SOLID foyc@coryfoy.com 35
  • 75. 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? @cory_foy Thursday, November 14, 13 Patterns. 4 Rules of Simple Design. Fowler. SOLID foyc@coryfoy.com 35
  • 76. Fowler’s Perspectives (from UML Distilled) Are we operating at the right level Conceptual, Specification or Implementation? @cory_foy Thursday, November 14, 13 Patterns. 4 Rules of Simple Design. Fowler. SOLID foyc@coryfoy.com 36
  • 77. Fowler’s Perspectives (from UML Distilled) Are we operating at the right level Conceptual, Specification or Implementation? @cory_foy Thursday, November 14, 13 Patterns. 4 Rules of Simple Design. Fowler. SOLID foyc@coryfoy.com 36
  • 78. Foy-Z Cognitively Undemanding BICS Katas Koans Context Embedded Context Reduced Principles CALP @cory_foy Cognitively Demanding foyc@coryfoy.com Thursday, November 14, 13 At this point, we have enough basic skills that we can begin to get into cognitively demanding work. As I mentioned earlier, Design Patterns 37
  • 79. Foy-Z Cognitively Undemanding BICS Katas Koans Context Embedded Context Reduced Principles Patterns CALP @cory_foy Cognitively Demanding foyc@coryfoy.com Thursday, November 14, 13 At this point, we have enough basic skills that we can begin to get into cognitively demanding work. As I mentioned earlier, Design Patterns 37
  • 80. Patterns @cory_foy Thursday, November 14, 13 foyc@coryfoy.com 38 Design Patterns provide a guide for the forces encountered. What does that mean? We have a tendency to think of Design Patterns as recipes to make our code look a certain way. But
  • 81. @cory_foy Thursday, November 14, 13 Patterns are something else. foyc@coryfoy.com 39
  • 82. Naming something the name of a pattern does not make it that pattern @cory_foy Thursday, November 14, 13 Patterns are something else. foyc@coryfoy.com 39
  • 83. Naming something the name of a pattern does not make it that pattern Putting patterns in our code does not make our code good @cory_foy Thursday, November 14, 13 Patterns are something else. foyc@coryfoy.com 39
  • 84. Porch Swing @cory_foy Thursday, November 14, 13 foyc@coryfoy.com 40
  • 85. Porch Swing @cory_foy Thursday, November 14, 13 foyc@coryfoy.com 40
  • 86. Swimming Pool @cory_foy Thursday, November 14, 13 foyc@coryfoy.com 41
  • 87. Swimming Pool @cory_foy Thursday, November 14, 13 foyc@coryfoy.com 41
  • 88. Hedge Trimmer @cory_foy Thursday, November 14, 13 Not a pattern, but a death trap (next GoF Book / Structure of Patterns) foyc@coryfoy.com 42
  • 89. Hedge Trimmer @cory_foy Thursday, November 14, 13 Not a pattern, but a death trap (next GoF Book / Structure of Patterns) foyc@coryfoy.com 42
  • 90. • Pattern Name • Intent • Also Known As • Motivation / Forces • Applicability • Structure • Participants • Collaboration • Consequences • Implementation • Sample Code • Known Uses • Related Patterns @cory_foy foyc@coryfoy.com Thursday, November 14, 13 The GoF Book wasn’t a beginners guide. It was Erich’s PhD Thesis. Patterns are designed to put into form the forces you may run into while building code. What does that mean? 43
  • 91. Server @cory_foy foyc@coryfoy.com Thursday, November 14, 13 Let’s imagine a mobile application to upload pictures. So what forces are at play here? We know we have to associate multiple pictures to data. Data can have new types added, which need to be available on all other phones. The phone needs to be able to send the pictures to the server, as well as send and receive data updates. And deal with offline conditions. 44
  • 92. - Countries - Products - Locations Server @cory_foy foyc@coryfoy.com Thursday, November 14, 13 Let’s imagine a mobile application to upload pictures. So what forces are at play here? We know we have to associate multiple pictures to data. Data can have new types added, which need to be available on all other phones. The phone needs to be able to send the pictures to the server, as well as send and receive data updates. And deal with offline conditions. 44
  • 93. - Countries - Products - Locations - Send Data - Receive Data Server @cory_foy foyc@coryfoy.com Thursday, November 14, 13 Let’s imagine a mobile application to upload pictures. So what forces are at play here? We know we have to associate multiple pictures to data. Data can have new types added, which need to be available on all other phones. The phone needs to be able to send the pictures to the server, as well as send and receive data updates. And deal with offline conditions. 44
  • 94. Multiple Pictures - Countries - Products - Locations - Send Data - Receive Data Server @cory_foy foyc@coryfoy.com Thursday, November 14, 13 Let’s imagine a mobile application to upload pictures. So what forces are at play here? We know we have to associate multiple pictures to data. Data can have new types added, which need to be available on all other phones. The phone needs to be able to send the pictures to the server, as well as send and receive data updates. And deal with offline conditions. 44
  • 95. Multiple Pictures - Countries - Products - Locations Send Pictures - Send Data - Receive Data Server @cory_foy foyc@coryfoy.com Thursday, November 14, 13 Let’s imagine a mobile application to upload pictures. So what forces are at play here? We know we have to associate multiple pictures to data. Data can have new types added, which need to be available on all other phones. The phone needs to be able to send the pictures to the server, as well as send and receive data updates. And deal with offline conditions. 44
  • 96. Multiple Pictures - Countries - Products - Locations Send Pictures - Send Data - Receive Data Server @cory_foy Storage Options foyc@coryfoy.com Thursday, November 14, 13 Let’s imagine a mobile application to upload pictures. So what forces are at play here? We know we have to associate multiple pictures to data. Data can have new types added, which need to be available on all other phones. The phone needs to be able to send the pictures to the server, as well as send and receive data updates. And deal with offline conditions. 44
  • 97. Offline @cory_foy foyc@coryfoy.com Thursday, November 14, 13 One way is by knowing the forces at play and comparing them to previous events. For example, the phone (or server) could be offline. What can we do if we are offline? 45
  • 98. Offline Not allow send @cory_foy Queue items to send foyc@coryfoy.com Thursday, November 14, 13 One way is by knowing the forces at play and comparing them to previous events. For example, the phone (or server) could be offline. What can we do if we are offline? 45
  • 99. Offline Not allow send Automatically @cory_foy Queue items to send Manually foyc@coryfoy.com Thursday, November 14, 13 One way is by knowing the forces at play and comparing them to previous events. For example, the phone (or server) could be offline. What can we do if we are offline? 45
  • 100. Offline Not allow send Automatically Queue items to send Manually Forces: - User has to remember to send - User can’t do other tasks until sent - User has to send each one @cory_foy foyc@coryfoy.com Thursday, November 14, 13 One way is by knowing the forces at play and comparing them to previous events. For example, the phone (or server) could be offline. What can we do if we are offline? 45
  • 101. Offline Not allow send Automatically Forces: - Store multiple requests - Schedule to run them - Handle failed requests - Allow user to see status @cory_foy Queue items to send Manually Forces: - User has to remember to send - User can’t do other tasks until sent - User has to send each one foyc@coryfoy.com Thursday, November 14, 13 One way is by knowing the forces at play and comparing them to previous events. For example, the phone (or server) could be offline. What can we do if we are offline? 45
  • 102. http://www.soapatterns.org/asynchronous_queuing.php @cory_foy foyc@coryfoy.com Thursday, November 14, 13 So the patterns we choose are a result of the forces we are trying to resolve - the forces inherent in the solution itself. 46
  • 103. Foy-Z Cognitively Undemanding BICS Context Embedded Context Reduced CALP @cory_foy Cognitively Demanding foyc@coryfoy.com Thursday, November 14, 13 So now that we’ve got a framework on how to get the point of understanding, now what? Well, our code is getting happier, because 47
  • 104. @cory_foy Thursday, November 14, 13 we’ve begun addressing some of the key issues in being able to listen to it. foyc@coryfoy.com 48
  • 105. We don’t understand the language @cory_foy Thursday, November 14, 13 we’ve begun addressing some of the key issues in being able to listen to it. foyc@coryfoy.com 48
  • 106. We don’t understand the language We don’t have common context @cory_foy Thursday, November 14, 13 we’ve begun addressing some of the key issues in being able to listen to it. foyc@coryfoy.com 48
  • 107. We don’t understand the language We don’t have common context We don’t know the grammar @cory_foy Thursday, November 14, 13 we’ve begun addressing some of the key issues in being able to listen to it. foyc@coryfoy.com 48
  • 108. We don’t understand the language We don’t have common context We don’t know the grammar We don’t know how to apply the grammar @cory_foy Thursday, November 14, 13 we’ve begun addressing some of the key issues in being able to listen to it. foyc@coryfoy.com 48
  • 109. We don’t understand the language We don’t have common context We don’t know how to apply the grammar We don’t know the grammar We don’t know what’s appropriate @cory_foy Thursday, November 14, 13 we’ve begun addressing some of the key issues in being able to listen to it. foyc@coryfoy.com 48
  • 110. http://www.flickr.com/photos/jakeandlindsay/5524669257 @cory_foy Thursday, November 14, 13 foyc@coryfoy.com 49 So how to we apply it? How do we use that to now let go? First, diagrams aren’t bad. There’s nothing wrong with sketching out a plan. But, “No plan survives first contact with the enemy”. So pay attention to the forces more than the plan.
  • 111. http://www.soapatterns.org/asynchronous_queuing.php @cory_foy Thursday, November 14, 13 foyc@coryfoy.com 50 For example, looking at this pattern again, notice the impacts. We may say to ourselves, we want an Aysnc Queue, so fine, be on the lookout for that. But don’t blindly just shove an async queue in. Watch for your code to tell you it needs it. (This also applies to databases and many other things we “Know we need”)
  • 112. http://marchoeijmans.blogspot.com/2013/03/test-driven-development-tdd.html (Although I disagree with the article) @cory_foy foyc@coryfoy.com Thursday, November 14, 13 Second: If you haven’t done TDD, or aren’t doing it, I’d highly recommend spending some time with Katas trying it out. What I find powerful is that it makes no qualms about your design. Don’t write a design, and then write tests to prove you are writing your design. Let the tests guide you. See what design emerges from them. 51
  • 113. @cory_foy foyc@coryfoy.com Thursday, November 14, 13 Third: Technical Vision. In a team environment, you want to make sure you all are on the same page. Traditionally we’ve built software bottom up. But this doesn’t give us an opportunity to learn. “Tracer Bullets” 52
  • 114. Database @cory_foy foyc@coryfoy.com Thursday, November 14, 13 Third: Technical Vision. In a team environment, you want to make sure you all are on the same page. Traditionally we’ve built software bottom up. But this doesn’t give us an opportunity to learn. “Tracer Bullets” 52
  • 115. Stored Procedures Database @cory_foy foyc@coryfoy.com Thursday, November 14, 13 Third: Technical Vision. In a team environment, you want to make sure you all are on the same page. Traditionally we’ve built software bottom up. But this doesn’t give us an opportunity to learn. “Tracer Bullets” 52
  • 116. Service Layer Stored Procedures Database @cory_foy foyc@coryfoy.com Thursday, November 14, 13 Third: Technical Vision. In a team environment, you want to make sure you all are on the same page. Traditionally we’ve built software bottom up. But this doesn’t give us an opportunity to learn. “Tracer Bullets” 52
  • 117. API Layer Service Layer Stored Procedures Database @cory_foy foyc@coryfoy.com Thursday, November 14, 13 Third: Technical Vision. In a team environment, you want to make sure you all are on the same page. Traditionally we’ve built software bottom up. But this doesn’t give us an opportunity to learn. “Tracer Bullets” 52
  • 118. Front End Layer API Layer Service Layer Stored Procedures Database @cory_foy foyc@coryfoy.com Thursday, November 14, 13 Third: Technical Vision. In a team environment, you want to make sure you all are on the same page. Traditionally we’ve built software bottom up. But this doesn’t give us an opportunity to learn. “Tracer Bullets” 52
  • 119. Front End Layer API Layer Service Layer Stored Procedures Database @cory_foy foyc@coryfoy.com Thursday, November 14, 13 Third: Technical Vision. In a team environment, you want to make sure you all are on the same page. Traditionally we’ve built software bottom up. But this doesn’t give us an opportunity to learn. “Tracer Bullets” 52
  • 120. Front End Layer API Layer Service Layer Stored Procedures Database @cory_foy foyc@coryfoy.com Thursday, November 14, 13 Third: Technical Vision. In a team environment, you want to make sure you all are on the same page. Traditionally we’ve built software bottom up. But this doesn’t give us an opportunity to learn. “Tracer Bullets” 52
  • 121. Front End Layer API Layer Service Layer Stored Procedures Database @cory_foy foyc@coryfoy.com Thursday, November 14, 13 Third: Technical Vision. In a team environment, you want to make sure you all are on the same page. Traditionally we’ve built software bottom up. But this doesn’t give us an opportunity to learn. “Tracer Bullets” 52
  • 122. Front End Layer API Layer Service Layer Stored Procedures Database @cory_foy foyc@coryfoy.com Thursday, November 14, 13 Third: Technical Vision. In a team environment, you want to make sure you all are on the same page. Traditionally we’ve built software bottom up. But this doesn’t give us an opportunity to learn. “Tracer Bullets” 52
  • 123. Front End Layer API Layer Service Layer Stored Procedures Database @cory_foy foyc@coryfoy.com Thursday, November 14, 13 Third: Technical Vision. In a team environment, you want to make sure you all are on the same page. Traditionally we’ve built software bottom up. But this doesn’t give us an opportunity to learn. “Tracer Bullets” 52
  • 124. Front End Layer API Layer Service Layer Stored Procedures Database @cory_foy foyc@coryfoy.com Thursday, November 14, 13 There’s nothing wrong with a vision. And as you work on slices, you can check against the overall vision to see if you are on the path you expected, or if your vision needs to change. Not the code, but the vision. 53
  • 125. Vision Front End Layer API Layer Service Layer Stored Procedures Database @cory_foy foyc@coryfoy.com Thursday, November 14, 13 There’s nothing wrong with a vision. And as you work on slices, you can check against the overall vision to see if you are on the path you expected, or if your vision needs to change. Not the code, but the vision. 53
  • 126. Vision Front End Layer API Layer Service Layer Stored Procedures Database @cory_foy foyc@coryfoy.com Thursday, November 14, 13 There’s nothing wrong with a vision. And as you work on slices, you can check against the overall vision to see if you are on the path you expected, or if your vision needs to change. Not the code, but the vision. 53
  • 127. Vision Front End Layer API Layer Service Layer Stored Procedures Database @cory_foy foyc@coryfoy.com Thursday, November 14, 13 There’s nothing wrong with a vision. And as you work on slices, you can check against the overall vision to see if you are on the path you expected, or if your vision needs to change. Not the code, but the vision. 53
  • 128. Pay attention to the forces Let the code (and tests!) guide your design Develop a vision, but use it as a guide, not a whipping post @cory_foy Thursday, November 14, 13 foyc@coryfoy.com 54 These things together, along with the solid understanding of the different paradigms and approaches are going to get you to the point where you can let go of the “willful images” and start really listening to your code. And when you listen to your code
  • 129. @cory_foy foyc@coryfoy.com Thursday, November 14, 13 you end up with happy code. And when you don’t, you end up with unhappy code, baffled at why you are even bothering to build it if you aren’t going to listen. 55
  • 130. if coder_listens? @cory_foy foyc@coryfoy.com Thursday, November 14, 13 you end up with happy code. And when you don’t, you end up with unhappy code, baffled at why you are even bothering to build it if you aren’t going to listen. 55
  • 131. if coder_listens? puts “:-)” @cory_foy foyc@coryfoy.com Thursday, November 14, 13 you end up with happy code. And when you don’t, you end up with unhappy code, baffled at why you are even bothering to build it if you aren’t going to listen. 55
  • 132. if coder_listens? puts “:-)” else @cory_foy foyc@coryfoy.com Thursday, November 14, 13 you end up with happy code. And when you don’t, you end up with unhappy code, baffled at why you are even bothering to build it if you aren’t going to listen. 55
  • 133. if coder_listens? puts “:-)” else puts “:`-(“ @cory_foy foyc@coryfoy.com Thursday, November 14, 13 you end up with happy code. And when you don’t, you end up with unhappy code, baffled at why you are even bothering to build it if you aren’t going to listen. 55
  • 134. if coder_listens? puts “:-)” else puts “:`-(“ end @cory_foy foyc@coryfoy.com Thursday, November 14, 13 you end up with happy code. And when you don’t, you end up with unhappy code, baffled at why you are even bothering to build it if you aren’t going to listen. 55
  • 135. if coder_listens? puts “:-)” else puts “:`-(“ end @cory_foy foyc@coryfoy.com Thursday, November 14, 13 you end up with happy code. And when you don’t, you end up with unhappy code, baffled at why you are even bothering to build it if you aren’t going to listen. 55