Real world evolutionary design with python


That's me!

Wassel Alazhar

Developer

 

@wasselovski

https://github.com/jcraftsman

 

What do you expect?

You will be happy if ...

2 minutes

 

Objectives

  • How design can help us
  • Python is a real programming language

What I don't like about Design

More accurately: which kind of design I don't like

BIG Upfront Design

  • Endless discussions
  • Focus on the solution
  • Solving the wrong problem
  • Speculative development (YAGNI)
  • A lot of frustration

 

public class AbstractCommonManagerImpl extends AbstractCommonManager {

No Design

True story

  • Loosing flexibility
  • More rigidity
  • Too fragile
  • Tight coupling
  • Low cohesion
  • Mixing responsibilities

 

 

No Design

  1. It is messy but it is working (Why fix it if it is not broken!?)
  2. We will clean it later (later = never)
  3. The mess slows you down

We should take time to go fast (or to just keep moving)

How did we get here?

Gotta get out of this

Evolutionary Design

Software is alive

How to make it evolve in a natural way

Evolutionary Design

 

  • Not a one shot decision
  • Continuous and emerging
  • Early and often

 

 

There will be refactoring!

Don't think you know!

  • Incorporate feedback!
  • We all have our design bias (OO, FP, CQRS, Microservice, Event, non functional, hexagonal...)
  • We are heavily biased towards the vocabulary we are comfortable with

Focus on the problem not the solution

Don't think you know!

All non-trivial abstractions, to some degree, are leaky. (*)

  1. Identify the axis of changes
  2. Then implement the abstractions that will protect you from these changes (e.g. Domain vs Infrastructure)

Abstraction vs Details

(*)The law of leaky abstractions by Joel Spolsky

Deductive vs Inductive

General principles

Specific instances

Deductive

Inductive

Deductive vs Inductive

Theory

Confirmation

Deductive

Inductive

Hypothesis

Observation

Observation

Theory

Pattern

Hypothesis

Playtime

The use case

https://github.com/jcraftsman/evolutionary-design-workshop

Find documents, fast!

Our agents have a high risk job.

They provide us with pictures of the documents we need.

 

Finding a document by searching for a text it contains is huge amount
of work.

Plug into the IS

In the intelligence center,
we already have a search engine.

 

What we need is a tool that analyses the pictures of the documents and notifies the search engine.

The "rules"

What do you think about deductive approach?

10 minutes

 

Good for ...

Disadvantages

Not suitable for ...

Advantages

Deductive
Evolutionary Design

  • Breakdown of a logic into its parts
  • Decomposing complexity
  • Deducing abstractions inside a bounded context
  • Focus on the interactions
  • Collaboration behaviour is important not implementation
  • Nothing comes outside the box

Inductive
Evolutionary Design

  1. Start from small details
  2. Generalize non accidental duplication
  3. Evolve small behavior into design concepts
  4. Generalize design concepts
  5. Evolve design concepts into components

source: http://blog.adrianbolboaca.ro

Inductive
Evolutionary Design

  • Scalar => Primitive type (string, int, array)
  • Primitive type => Field or parameter
  • Field => Settings class
  • Parameter => Data structure
  • Logic => Pure function
  • Pure function => Class function
  • Class => Component

Example of incremental design decisions:

source: http://blog.adrianbolboaca.ro

Inductive
Evolutionary Design

  • Risk mitigation
  • Early validation of requirements
  • Behavior is important not implementation
  • Focus more on state behavior than the collaboration
  • Most Valuable things first

Inductive and Deductive
Evolutionary Design

You don't have to choose

You can use them both

What about architecture

Architecture is a term that lots of people
try to define...
There are two common elements:

1 - The highest-level breakdown of a system
into its parts

2 - Decisions that are hard to change ...

 

Decisions that developers wish they could get right early...
The subjectivity comes in here as well because, if you find something that is easier to change than you once thought, then it's no longer architectural ...

Source: Patterns of Enterprise Application  Architectue by Martin Fowler

Take away

Forget about the big upfront design, but don't forget to think about design

Evolutionary design is about the decisions that emerge from a living code in order to evolve it and keep mastering its complexity 

Made with Slides.com