SlideShare ist ein Scribd-Unternehmen logo
1 von 65
Carlo Pescio @CarloPescio http://physicsofsoftware.com
Carlo Pescio
On Growth and Software
(or: applying some Physics of Software)
Carlo Pescio @CarloPescio http://physicsofsoftware.com
Inspired by a classic
Carlo Pescio @CarloPescio http://physicsofsoftware.com
Form as a Diagram of Forces
Carlo Pescio @CarloPescio http://physicsofsoftware.com
Form as a Recipe for Reaction
My own little step – don’t blame D’Arcy 
Material and shape encode reactions to “forces”
Carlo Pescio @CarloPescio http://physicsofsoftware.com
Form as a Recipe for Growth
Carlo Pescio @CarloPescio http://physicsofsoftware.com
Good ol’ book
+ - U
U
Carlo Pescio @CarloPescio http://physicsofsoftware.com
The ring binder
U
D
D
U
U
C
C
Carlo Pescio @CarloPescio http://physicsofsoftware.com
Growth Model
Carlo Pescio @CarloPescio http://physicsofsoftware.com
Growth Model
Carlo Pescio @CarloPescio http://physicsofsoftware.com
[Mis]Aligned Growth Model
(ideal) growth in
decision space
(actual) growth in
artifact space
Carlo Pescio @CarloPescio http://physicsofsoftware.com
“Growth” in computing
Extensibility Scalability
C/D features in code C/D run-time load
Code as artifacts Run-time behavior
C/D feature -> C/D load ->
C/D artifact C/D machines / CPU
Carlo Pescio @CarloPescio http://physicsofsoftware.com
Carlo Pescio @CarloPescio http://physicsofsoftware.com
Extensibility?
Carlo Pescio @CarloPescio http://physicsofsoftware.com
Symmetry in Growth [model]
Create feature
Delete feature
decision space
Create artifacts
Delete artifacts
artifact space
Carlo Pescio @CarloPescio http://physicsofsoftware.com
Why bother???
- Product families
- Plug-in architectures, 3rd party modules
- Modular understanding
- “zero impact” evolution
Carlo Pescio @CarloPescio http://physicsofsoftware.com
In practice?
A simple, specific problem
with a specific growth model.
Lessons here apply to similar growth models.
Not everything will / should follow this model.
The final shape is not universal
the method of investigation kinda is
Carlo Pescio @CarloPescio http://physicsofsoftware.com
Easy
Carlo Pescio @CarloPescio http://physicsofsoftware.com
Some physics required 
Carlo Pescio @CarloPescio http://physicsofsoftware.com
Vector drawing for dummies
Carlo Pescio @CarloPescio http://physicsofsoftware.com
Growth Model
- New shape types will come over time
- New behaviors will come over time
- Behaviors can be composed out of a fixed core
- That entire menu only requires {bounding box, move}
I’m dealing only with geometry right now
Carlo Pescio @CarloPescio http://physicsofsoftware.com
Context
We have an open, discrete set of “concepts”
{ Square, Triangle, Circle, … }
It’s open and so will grow by addition.
T3
T2
T1
+
+
T = { Ti }
Carlo Pescio @CarloPescio http://physicsofsoftware.com
In code?
How do we mirror in code?
• N types: OK
• N classes: OK
• N objects / prototypes: OK
• through closures / records of functions: ok as well
• Case classes: Maybe
• 1 sum type: NO
+
T = { Ti }
N trivial classes (Scala)
class Point( var x : Float,
var y : Float ) {}
class Box( var topLeft : Point,
var bottomRight : Point ) {}
class Circle( var center : Point,
var radius : Float ) {}
class Square( var topLeft : Point,
var side : Float ) {}
+
1 sum type (Haskell): nope
type Point = (Float,Float)
type Radius = Float
type Side = Float
data Shape =
Circle Point Radius |
Square Point Side
+ U
Carlo Pescio @CarloPescio http://physicsofsoftware.com
Context
We have a closed set of “core behaviors”
{ BoundingBox, Move, Scale, Rotate, Mirror }
^
H = { Hi }H
Carlo Pescio @CarloPescio http://physicsofsoftware.com
Context
“Core behaviors” depends on concepts.
More precisely: when we create/delete a concept,
we create/delete its implementation of core
behaviors.
^
Ti
C/D > HTi
T3
T2
T1
+
HT3
HT2
HT1
+
Carlo Pescio @CarloPescio http://physicsofsoftware.com
In code?
How do we mirror
• Member functions (class, objects): ok
• Functions (+ optional overloading): ok
• 1 function per behavior + pattern matching: NO
• That removes case classes from the table
^
Ti
C/D > HTi
Case classes (Scala): nope
abstract class Shape
case class Circle(center:Point, radius:Float) extends Shape
case class Square(topLeft:Point, side:Float) extends Shape
+
U
object moveTool {
def move( sh : Shape, newCenter : Point ) : Shape = {
sh match {
case Circle(center, radius) =>
new Circle( newCenter, radius);
case Square( topLeft, side) =>
new Square(Point(topLeft.x-side/2,
topLeft.y-side/2), side);
}
}
}
Carlo Pescio @CarloPescio http://physicsofsoftware.com
Context
We can:
a) create instances of those concepts and keep
them available for selection
b) select some of those instances (mixed
concepts) from a bounding box
c) apply composite behaviors to those (mixed)
instances
Carlo Pescio @CarloPescio http://physicsofsoftware.com
Context
a) We want to create instances and
keep them “available” for selection
In code:
• A single collection: OK
• A collection for each type: OK
A collection for each type is ok, as we still transfer
creation (of concept) into creation (of a new list).
Carlo Pescio @CarloPescio http://physicsofsoftware.com
Context
b) We want to select a (mixed) subset by
dragging a selection box.
So we need a selection function looping over all
the available shapes and checking their bounding
boxes (BB is a “core behavior” for shapes).
Carlo Pescio @CarloPescio http://physicsofsoftware.com
selection
box
f
selection
1 collection per type won’t work anymore
+
+
U
Same reasoning applies
to any of the composite
behaviors
shapes
selected
shapes
Carlo Pescio @CarloPescio http://physicsofsoftware.com
Context
We have an open set of “composite behaviors”
+
B = { Bi }
e.g.
{ align left, distribute horizontally, flip vertical}
They operate on collections of concepts
(instances).
^
Bi ≡ ·(H)
Carlo Pescio @CarloPescio http://physicsofsoftware.com
Context
+
T = { Ti }
*
+
B = { Bi }
^ +
(HTi)
·
C/D
Two problems with Bi here:
1) Works on a set of shapes
(same as selection)
2) Composed from a set of
type-dependent core
behaviors (same as
selection w/ BB)
Carlo Pescio @CarloPescio http://physicsofsoftware.com
A single collection of shapes
That would require either:
• A dynamic language
• mixing types is natural
• A way to form a placeholder type as substitute
for the individual types:
• Base type + subtypes
• Base class / interface + derived classes
• [objects as] Records of closures
• Existential types / Abstract types
Carlo Pescio @CarloPescio http://physicsofsoftware.com
Classes in Scala (easy)
abstract class Shape {
def explain() : String;
def boundingBox() : Box;
def moveCenter(newCenter:Point) :
Shape;
}
Classes in Scala (easy)
class Circle(private var center: Point,
private var radius: Float)
extends Shape {
def explain(): String =
{ "circle " + center.x + " " +
center.y + " " + radius; }
def boundingBox(): Box = { new Box(
Point(center.x-radius, center.y-radius),
Point(center.x+radius, center.y+radius)
); }
def moveCenter(newCenter: Point): Shape =
{ new Circle(newCenter, radius); }
}
Classes in Scala (easy)
class Square(private var topLeft: Point,
private var side: Float)
extends Shape {
def explain(): String =
{ "square " + topLeft.x + " " +
topLeft.y + " " + side; }
def boundingBox(): Box = { new Box(
topLeft,
Point(topLeft.x+side, topLeft.y+side)); }
def moveCenter(newCenter: Point): Shape =
{ new Square(Point(topLeft.x-side/2,
topLeft.y-side/2), side); }
}
Classes in Scala (easy)
object MainObject {
def main(args: Array[String]): Unit = {
val c1 = new Circle( Point(1,1), 4 ) ;
val s1 = new Square( Point(0,0), 4 ) ;
val sh : List[Shape] = List( c1, s1 );
var d : String = sh.map( s =>
s.moveCenter(Point(5,5)).explain()
).reduce((s1,s2) => s1 + " ; " + s2) ;
println( d ) ;
}
}
Records of Closures (Haskell)
type Point = (Float,Float)
type Box = (Point,Point)
data Shape = Shape {
explain :: String,
boundingBox :: Box,
moveCenter :: Point -> Shape
}
Records of Closures (Haskell)
circle :: Point -> Float -> Shape
circle (x,y) r =
Shape explain boundingBox moveCenter
where
explain = "circle " ++ show x ++ " "
++ show y ++ " " ++ show r
boundingBox = ( (x-r, y-r),
(x+r, y+r) )
moveCenter (x1,y1) = circle (x1, y1) r
Records of Closures (Haskell)
square :: Point -> Float -> Shape
square (t,l) s =
Shape explain boundingBox moveCenter
where
explain = "square " ++ show t ++ " "
++ show l ++ " " ++ show s
boundingBox = ( (t, l), (t+s, l+s) )
moveCenter (x1,y1) =
square (x1-s/2, y1-s/2) s
Carlo Pescio @CarloPescio http://physicsofsoftware.com
Records of Closures (Haskell)
main = do
let c1 = circle (1,1) 3
let s1 = square (1,1) 3
let sh = [ c1, s1 ]
putStrLn
(concat ( map (s ->
(explain (moveCenter s (5,5)))
++ " ; ") sh ) )
Existential type (Haskell)
type Point = (Float,Float)
type Box = (Point,Point)
class ShapeTC a where
explain :: a -> String
boundingBox :: a -> Box
moveCenter :: a -> Point -> Shape
data Shape = forall a. ShapeTC a => Shape a
instance ShapeTC Shape where
explain (Shape shape) = explain shape
boundingBox (Shape shape) = boundingBox shape
moveCenter (Shape shape) = moveCenter shape
Existential type (Haskell)
data Circle = Circle Point Float
instance ShapeTC Circle where
explain (Circle (x,y) r ) =
"circle " ++ show x ++ " " ++ show y ++
" " ++ show r
boundingBox (Circle (x,y) r) =
( (x-r, y-r), (x+r, y+r) )
moveCenter (Circle (x,y) r) (x1,y1) =
circle (x1, y1) r
circle :: Point -> Float -> Shape
circle (x,y) r = Shape (Circle (x,y) r)
Existential type (Haskell)
data Square = Square Point Float
instance ShapeTC Square where
explain (Square (t,l) s) =
"square " ++ show t ++ " " ++ show l ++
" " ++ show s
boundingBox (Square (t,l) s) =
( (t, l), (t+s, l+s) )
moveCenter (Square (t,l) s) (x1,y1) =
square (x1-s/2, y1-s/2) s
square :: Point -> Float -> Shape
square (t,l) s = Shape (Square (t,l) s)
Existential type (Haskell)
main = do
let c1 = circle (2,2) 3
let s1 = square (2,2) 3
let sh = [ c1, s1 ]
putStrLn
(concat ( map (s ->
(explain (moveCenter s (6,6)))
++ " ; ") sh ) )
“misaligned” growth model
B3
B2
B1
+
T3
T2
T1
+
HT3
HT2
HT1
+
UU
(madness)
B3
B2
B1
+
T3
T2
T1
+
HT3
HT2
HT1
+
OK 
H
B3
B2
B1
+
T
T3
T2
T1
+
HT3
HT2
HT1
+
Carlo Pescio @CarloPescio http://physicsofsoftware.com
Work in progress
^
Ha = { Hi }
+
T = { Ti }
*
+
B = { Bi }
^ +
HTi
·
C/D
^
Ta
+
T = { Ti }
*
+
B = { Bi }
^ +
(HTi)
·
C/D
Carlo Pescio @CarloPescio http://physicsofsoftware.com
Every type has identity (to keep it simple: name)
F knows identities in => F unstable
So:
- F should not know identities in
- F needs to operate on values of those types.
=> F must be isolated from type identity.
Identity and Isolation
+
T
+
T
Carlo Pescio @CarloPescio http://physicsofsoftware.com
Common techniques for isolation:
- Add a new “abstract type” Ta, make every Ti an
instance or subtype of Ta
- Requires late binding as F will only know Ta
- Relationship between Ti and Ta can be implicit
(structural conformance)
- Add a new concrete type Tc exposing only
functions, and bind every instance of Ti to an
instance of Tc
- That’s again providing late binding as F won’t know
the identity of the functions it’s calling
Isolation Techniques
Carlo Pescio @CarloPescio http://physicsofsoftware.com
structures vs paradigms
Carlo Pescio @CarloPescio http://physicsofsoftware.com
OO
SUCKS!
Carlo Pescio @CarloPescio http://physicsofsoftware.com
Get your trick question ready
1. The next time someone shows you a decent use
for OO-like polymorphism & encapsulation, what
can you say?
what about serialization in multiple formats?
Carlo Pescio @CarloPescio http://physicsofsoftware.com
Remember this?
Carlo Pescio @CarloPescio http://physicsofsoftware.com
Elastic yet bent !?
Carlo Pescio @CarloPescio http://physicsofsoftware.com
We only have geometry so far
I want rendering (new core behaviors!)
I may want only geometry
I may want only rendering
I may want both
=> Geometry and Rendering in distinct artifacts
Breaking the growth model
Carlo Pescio @CarloPescio http://physicsofsoftware.com
Growing and Breaking
partial class Circle
{
private readonly Point center;
private readonly double radius;
public Circle( Point center, double radius )
{
this.center = center;
this.radius = radius;
}
}
interface Shape
{
Shape Move(Point newCenter);
}
partial class Circle : Shape
{
public Shape Move(Point newCenter)
{
return new Circle(newCenter, radius);
}
}
interface Drawing
{
void Render();
}
partial class Circle : Drawing
{
public void Render()
{
Console.WriteLine(
"I'm a Circle with radius " +
radius.ToString());
}
}
static void Main(string[] args)
{
Shape c = new Circle(new Point(10, 10), 5);
Drawing d = c as Drawing;
d.Render();
}
constraint
Shape => Drawing
Carlo Pescio @CarloPescio http://physicsofsoftware.com
“Design Process”
I didn’t use
- Design principles
- Patterns
- Tests
- Religion
I only aimed for symmetry
- Features growth model
- Artifacts growth model
Break a symmetry
to get a symmetry 
Carlo Pescio @CarloPescio http://physicsofsoftware.com
…Monads 
Or polymorphism
Or existential types
Or type system constraints
Or many things yet to be invented
Just by understanding forces 
You may have invented…
Carlo Pescio @CarloPescio http://physicsofsoftware.com
Get in touch
@CarloPescio
carlo.pescio@gmail.com
http://physicsofsoftware.com
/forum

Weitere ähnliche Inhalte

Was ist angesagt?

The Ring programming language version 1.5.3 book - Part 36 of 184
The Ring programming language version 1.5.3 book - Part 36 of 184The Ring programming language version 1.5.3 book - Part 36 of 184
The Ring programming language version 1.5.3 book - Part 36 of 184Mahmoud Samir Fayed
 
The Ring programming language version 1.2 book - Part 24 of 84
The Ring programming language version 1.2 book - Part 24 of 84The Ring programming language version 1.2 book - Part 24 of 84
The Ring programming language version 1.2 book - Part 24 of 84Mahmoud Samir Fayed
 
Mikhail Khristophorov "Introduction to Regular Expressions"
Mikhail Khristophorov "Introduction to Regular Expressions"Mikhail Khristophorov "Introduction to Regular Expressions"
Mikhail Khristophorov "Introduction to Regular Expressions"LogeekNightUkraine
 
The Ring programming language version 1.5.4 book - Part 36 of 185
The Ring programming language version 1.5.4 book - Part 36 of 185The Ring programming language version 1.5.4 book - Part 36 of 185
The Ring programming language version 1.5.4 book - Part 36 of 185Mahmoud Samir Fayed
 
The Ring programming language version 1.5.2 book - Part 35 of 181
The Ring programming language version 1.5.2 book - Part 35 of 181The Ring programming language version 1.5.2 book - Part 35 of 181
The Ring programming language version 1.5.2 book - Part 35 of 181Mahmoud Samir Fayed
 
The Ring programming language version 1.6 book - Part 39 of 189
The Ring programming language version 1.6 book - Part 39 of 189The Ring programming language version 1.6 book - Part 39 of 189
The Ring programming language version 1.6 book - Part 39 of 189Mahmoud Samir Fayed
 
[Expert Fridays] Александр Чичигин - Как перестать бояться и полюбить COQ
[Expert Fridays] Александр Чичигин - Как перестать бояться и полюбить COQ[Expert Fridays] Александр Чичигин - Как перестать бояться и полюбить COQ
[Expert Fridays] Александр Чичигин - Как перестать бояться и полюбить COQProvectus
 
Scala or functional programming from a python developer's perspective
Scala or functional programming from a python developer's perspectiveScala or functional programming from a python developer's perspective
Scala or functional programming from a python developer's perspectivegabalese
 
The Ring programming language version 1.5.3 book - Part 30 of 184
The Ring programming language version 1.5.3 book - Part 30 of 184The Ring programming language version 1.5.3 book - Part 30 of 184
The Ring programming language version 1.5.3 book - Part 30 of 184Mahmoud Samir Fayed
 
JDD2015: Functional programing and Event Sourcing - a pair made in heaven - e...
JDD2015: Functional programing and Event Sourcing - a pair made in heaven - e...JDD2015: Functional programing and Event Sourcing - a pair made in heaven - e...
JDD2015: Functional programing and Event Sourcing - a pair made in heaven - e...PROIDEA
 
Optics with monocle - Modeling the part and the whole
Optics with monocle - Modeling the part and the wholeOptics with monocle - Modeling the part and the whole
Optics with monocle - Modeling the part and the wholeIlan Godik
 
Introduction to Monads in Scala (2)
Introduction to Monads in Scala (2)Introduction to Monads in Scala (2)
Introduction to Monads in Scala (2)stasimus
 
The Ring programming language version 1.5.4 book - Part 30 of 185
The Ring programming language version 1.5.4 book - Part 30 of 185The Ring programming language version 1.5.4 book - Part 30 of 185
The Ring programming language version 1.5.4 book - Part 30 of 185Mahmoud Samir Fayed
 
The Ring programming language version 1.9 book - Part 38 of 210
The Ring programming language version 1.9 book - Part 38 of 210The Ring programming language version 1.9 book - Part 38 of 210
The Ring programming language version 1.9 book - Part 38 of 210Mahmoud Samir Fayed
 
The Ring programming language version 1.8 book - Part 35 of 202
The Ring programming language version 1.8 book - Part 35 of 202The Ring programming language version 1.8 book - Part 35 of 202
The Ring programming language version 1.8 book - Part 35 of 202Mahmoud Samir Fayed
 
Scala基礎勉強会: Featherweight Scalaの紹介および型付け規則の決定可能性について
Scala基礎勉強会: Featherweight Scalaの紹介および型付け規則の決定可能性についてScala基礎勉強会: Featherweight Scalaの紹介および型付け規則の決定可能性について
Scala基礎勉強会: Featherweight Scalaの紹介および型付け規則の決定可能性についてHiroki Mizuno
 

Was ist angesagt? (20)

The Ring programming language version 1.5.3 book - Part 36 of 184
The Ring programming language version 1.5.3 book - Part 36 of 184The Ring programming language version 1.5.3 book - Part 36 of 184
The Ring programming language version 1.5.3 book - Part 36 of 184
 
The Ring programming language version 1.2 book - Part 24 of 84
The Ring programming language version 1.2 book - Part 24 of 84The Ring programming language version 1.2 book - Part 24 of 84
The Ring programming language version 1.2 book - Part 24 of 84
 
Mikhail Khristophorov "Introduction to Regular Expressions"
Mikhail Khristophorov "Introduction to Regular Expressions"Mikhail Khristophorov "Introduction to Regular Expressions"
Mikhail Khristophorov "Introduction to Regular Expressions"
 
The Ring programming language version 1.5.4 book - Part 36 of 185
The Ring programming language version 1.5.4 book - Part 36 of 185The Ring programming language version 1.5.4 book - Part 36 of 185
The Ring programming language version 1.5.4 book - Part 36 of 185
 
The Ring programming language version 1.5.2 book - Part 35 of 181
The Ring programming language version 1.5.2 book - Part 35 of 181The Ring programming language version 1.5.2 book - Part 35 of 181
The Ring programming language version 1.5.2 book - Part 35 of 181
 
SacalaZa #1
SacalaZa #1SacalaZa #1
SacalaZa #1
 
The Ring programming language version 1.6 book - Part 39 of 189
The Ring programming language version 1.6 book - Part 39 of 189The Ring programming language version 1.6 book - Part 39 of 189
The Ring programming language version 1.6 book - Part 39 of 189
 
[Expert Fridays] Александр Чичигин - Как перестать бояться и полюбить COQ
[Expert Fridays] Александр Чичигин - Как перестать бояться и полюбить COQ[Expert Fridays] Александр Чичигин - Как перестать бояться и полюбить COQ
[Expert Fridays] Александр Чичигин - Как перестать бояться и полюбить COQ
 
Scala by Luc Duponcheel
Scala by Luc DuponcheelScala by Luc Duponcheel
Scala by Luc Duponcheel
 
Scala or functional programming from a python developer's perspective
Scala or functional programming from a python developer's perspectiveScala or functional programming from a python developer's perspective
Scala or functional programming from a python developer's perspective
 
The Ring programming language version 1.5.3 book - Part 30 of 184
The Ring programming language version 1.5.3 book - Part 30 of 184The Ring programming language version 1.5.3 book - Part 30 of 184
The Ring programming language version 1.5.3 book - Part 30 of 184
 
JDD2015: Functional programing and Event Sourcing - a pair made in heaven - e...
JDD2015: Functional programing and Event Sourcing - a pair made in heaven - e...JDD2015: Functional programing and Event Sourcing - a pair made in heaven - e...
JDD2015: Functional programing and Event Sourcing - a pair made in heaven - e...
 
Optics with monocle - Modeling the part and the whole
Optics with monocle - Modeling the part and the wholeOptics with monocle - Modeling the part and the whole
Optics with monocle - Modeling the part and the whole
 
Introduction to Monads in Scala (2)
Introduction to Monads in Scala (2)Introduction to Monads in Scala (2)
Introduction to Monads in Scala (2)
 
The Ring programming language version 1.5.4 book - Part 30 of 185
The Ring programming language version 1.5.4 book - Part 30 of 185The Ring programming language version 1.5.4 book - Part 30 of 185
The Ring programming language version 1.5.4 book - Part 30 of 185
 
Scala 101
Scala 101Scala 101
Scala 101
 
The Ring programming language version 1.9 book - Part 38 of 210
The Ring programming language version 1.9 book - Part 38 of 210The Ring programming language version 1.9 book - Part 38 of 210
The Ring programming language version 1.9 book - Part 38 of 210
 
Data structures
Data structuresData structures
Data structures
 
The Ring programming language version 1.8 book - Part 35 of 202
The Ring programming language version 1.8 book - Part 35 of 202The Ring programming language version 1.8 book - Part 35 of 202
The Ring programming language version 1.8 book - Part 35 of 202
 
Scala基礎勉強会: Featherweight Scalaの紹介および型付け規則の決定可能性について
Scala基礎勉強会: Featherweight Scalaの紹介および型付け規則の決定可能性についてScala基礎勉強会: Featherweight Scalaの紹介および型付け規則の決定可能性について
Scala基礎勉強会: Featherweight Scalaの紹介および型付け規則の決定可能性について
 

Andere mochten auch

Design final review sculpture
Design final review sculptureDesign final review sculpture
Design final review sculptureRiverwood HS
 
Principle of design
Principle of designPrinciple of design
Principle of designMika Lee
 
Design printmaking terms pics
Design printmaking terms picsDesign printmaking terms pics
Design printmaking terms picsRiverwood HS
 
Introduction to sculpture
Introduction to sculpture Introduction to sculpture
Introduction to sculpture cequinn1
 
Lecture 1 b definition of principle of design
Lecture 1 b definition of principle of designLecture 1 b definition of principle of design
Lecture 1 b definition of principle of designWilfred Dexter Tanedo
 
STAND 2 - MANINDIGAN SA TAMANG PRINSIPYO - PTR VETTY GUTIERREZ - 7AM MABUHAY ...
STAND 2 - MANINDIGAN SA TAMANG PRINSIPYO - PTR VETTY GUTIERREZ - 7AM MABUHAY ...STAND 2 - MANINDIGAN SA TAMANG PRINSIPYO - PTR VETTY GUTIERREZ - 7AM MABUHAY ...
STAND 2 - MANINDIGAN SA TAMANG PRINSIPYO - PTR VETTY GUTIERREZ - 7AM MABUHAY ...Faithworks Christian Church
 
Sculpture(2)
Sculpture(2)Sculpture(2)
Sculpture(2)Dave Roen
 
Humanities 100: Sculpture and Architecture
Humanities 100: Sculpture and ArchitectureHumanities 100: Sculpture and Architecture
Humanities 100: Sculpture and ArchitectureAndrea May Malonzo
 
elemento ng sining
elemento ng sining elemento ng sining
elemento ng sining Maritoni Lat
 
Types of sculptures my report
Types of sculptures my reportTypes of sculptures my report
Types of sculptures my reportTootchie Sanchez
 
introduction to sculpture
introduction to sculptureintroduction to sculpture
introduction to sculptureshiveyb
 

Andere mochten auch (20)

Design final review sculpture
Design final review sculptureDesign final review sculpture
Design final review sculpture
 
Principle of design
Principle of designPrinciple of design
Principle of design
 
Design printmaking terms pics
Design printmaking terms picsDesign printmaking terms pics
Design printmaking terms pics
 
SCULPTURES
SCULPTURESSCULPTURES
SCULPTURES
 
Principles of design
Principles of designPrinciples of design
Principles of design
 
Sculpture Introduction
Sculpture IntroductionSculpture Introduction
Sculpture Introduction
 
Introduction to sculpture
Introduction to sculpture Introduction to sculpture
Introduction to sculpture
 
What is Sculpture?
What is Sculpture? What is Sculpture?
What is Sculpture?
 
Sculpture
SculptureSculpture
Sculpture
 
Lecture 1 b definition of principle of design
Lecture 1 b definition of principle of designLecture 1 b definition of principle of design
Lecture 1 b definition of principle of design
 
STAND 2 - MANINDIGAN SA TAMANG PRINSIPYO - PTR VETTY GUTIERREZ - 7AM MABUHAY ...
STAND 2 - MANINDIGAN SA TAMANG PRINSIPYO - PTR VETTY GUTIERREZ - 7AM MABUHAY ...STAND 2 - MANINDIGAN SA TAMANG PRINSIPYO - PTR VETTY GUTIERREZ - 7AM MABUHAY ...
STAND 2 - MANINDIGAN SA TAMANG PRINSIPYO - PTR VETTY GUTIERREZ - 7AM MABUHAY ...
 
Principles
PrinciplesPrinciples
Principles
 
Sculpture
SculptureSculpture
Sculpture
 
Sculpture(2)
Sculpture(2)Sculpture(2)
Sculpture(2)
 
Bec pelc sining
Bec pelc siningBec pelc sining
Bec pelc sining
 
Humanities 100: Sculpture and Architecture
Humanities 100: Sculpture and ArchitectureHumanities 100: Sculpture and Architecture
Humanities 100: Sculpture and Architecture
 
elemento ng sining
elemento ng sining elemento ng sining
elemento ng sining
 
Types of sculptures my report
Types of sculptures my reportTypes of sculptures my report
Types of sculptures my report
 
introduction to sculpture
introduction to sculptureintroduction to sculpture
introduction to sculpture
 
Sculpture ppt
Sculpture pptSculpture ppt
Sculpture ppt
 

Ähnlich wie On Growth and Software

Haskell retrospective
Haskell retrospectiveHaskell retrospective
Haskell retrospectivechenge2k
 
The Ring programming language version 1.2 book - Part 26 of 84
The Ring programming language version 1.2 book - Part 26 of 84The Ring programming language version 1.2 book - Part 26 of 84
The Ring programming language version 1.2 book - Part 26 of 84Mahmoud Samir Fayed
 
(How) can we benefit from adopting scala?
(How) can we benefit from adopting scala?(How) can we benefit from adopting scala?
(How) can we benefit from adopting scala?Tomasz Wrobel
 
Lambda? You Keep Using that Letter
Lambda? You Keep Using that LetterLambda? You Keep Using that Letter
Lambda? You Keep Using that LetterKevlin Henney
 
Sequence and Traverse - Part 2
Sequence and Traverse - Part 2Sequence and Traverse - Part 2
Sequence and Traverse - Part 2Philip Schwarz
 
Introduction to Scala for JCConf Taiwan
Introduction to Scala for JCConf TaiwanIntroduction to Scala for JCConf Taiwan
Introduction to Scala for JCConf TaiwanJimin Hsieh
 
High Wizardry in the Land of Scala
High Wizardry in the Land of ScalaHigh Wizardry in the Land of Scala
High Wizardry in the Land of Scaladjspiewak
 
The Object Oriented Paradigm in perspective
The Object Oriented Paradigm in perspectiveThe Object Oriented Paradigm in perspective
The Object Oriented Paradigm in perspectiveRuben Gonzalez Blanco
 
Real World Haskell: Lecture 4
Real World Haskell: Lecture 4Real World Haskell: Lecture 4
Real World Haskell: Lecture 4Bryan O'Sullivan
 
Empathic Programming - How to write comprehensible code
Empathic Programming - How to write comprehensible codeEmpathic Programming - How to write comprehensible code
Empathic Programming - How to write comprehensible codeMario Gleichmann
 
Rewriting Java In Scala
Rewriting Java In ScalaRewriting Java In Scala
Rewriting Java In ScalaSkills Matter
 
麻省理工C++公开教学课程(二)
麻省理工C++公开教学课程(二)麻省理工C++公开教学课程(二)
麻省理工C++公开教学课程(二)ProCharm
 

Ähnlich wie On Growth and Software (20)

DS MOD2 (1) (1).pptx
DS MOD2 (1) (1).pptxDS MOD2 (1) (1).pptx
DS MOD2 (1) (1).pptx
 
Haskell retrospective
Haskell retrospectiveHaskell retrospective
Haskell retrospective
 
Introduction to Scala
Introduction to ScalaIntroduction to Scala
Introduction to Scala
 
The Ring programming language version 1.2 book - Part 26 of 84
The Ring programming language version 1.2 book - Part 26 of 84The Ring programming language version 1.2 book - Part 26 of 84
The Ring programming language version 1.2 book - Part 26 of 84
 
Scala in Places API
Scala in Places APIScala in Places API
Scala in Places API
 
(How) can we benefit from adopting scala?
(How) can we benefit from adopting scala?(How) can we benefit from adopting scala?
(How) can we benefit from adopting scala?
 
SDC - Einführung in Scala
SDC - Einführung in ScalaSDC - Einführung in Scala
SDC - Einführung in Scala
 
A bit about Scala
A bit about ScalaA bit about Scala
A bit about Scala
 
Stacks
StacksStacks
Stacks
 
Lambda? You Keep Using that Letter
Lambda? You Keep Using that LetterLambda? You Keep Using that Letter
Lambda? You Keep Using that Letter
 
Scala - brief intro
Scala - brief introScala - brief intro
Scala - brief intro
 
Sequence and Traverse - Part 2
Sequence and Traverse - Part 2Sequence and Traverse - Part 2
Sequence and Traverse - Part 2
 
Introduction to Scala for JCConf Taiwan
Introduction to Scala for JCConf TaiwanIntroduction to Scala for JCConf Taiwan
Introduction to Scala for JCConf Taiwan
 
High Wizardry in the Land of Scala
High Wizardry in the Land of ScalaHigh Wizardry in the Land of Scala
High Wizardry in the Land of Scala
 
Slides
SlidesSlides
Slides
 
The Object Oriented Paradigm in perspective
The Object Oriented Paradigm in perspectiveThe Object Oriented Paradigm in perspective
The Object Oriented Paradigm in perspective
 
Real World Haskell: Lecture 4
Real World Haskell: Lecture 4Real World Haskell: Lecture 4
Real World Haskell: Lecture 4
 
Empathic Programming - How to write comprehensible code
Empathic Programming - How to write comprehensible codeEmpathic Programming - How to write comprehensible code
Empathic Programming - How to write comprehensible code
 
Rewriting Java In Scala
Rewriting Java In ScalaRewriting Java In Scala
Rewriting Java In Scala
 
麻省理工C++公开教学课程(二)
麻省理工C++公开教学课程(二)麻省理工C++公开教学课程(二)
麻省理工C++公开教学课程(二)
 

Kürzlich hochgeladen

The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfkalichargn70th171
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension AidPhilip Schwarz
 
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionIntroducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionOnePlan Solutions
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplatePresentation.STUDIO
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park masabamasaba
 
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfonteinmasabamasaba
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Steffen Staab
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfonteinmasabamasaba
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...Shane Coughlan
 
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyviewmasabamasaba
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...harshavardhanraghave
 
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareAnnouncing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareJim McKeeth
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisamasabamasaba
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesVictorSzoltysek
 
10 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 202410 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 2024Mind IT Systems
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️Delhi Call girls
 
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park masabamasaba
 
Exploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfExploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfproinshot.com
 

Kürzlich hochgeladen (20)

Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
 
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionIntroducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
 
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
 
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
 
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareAnnouncing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK Software
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
 
10 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 202410 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 2024
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
 
Exploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfExploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdf
 

On Growth and Software

  • 1. Carlo Pescio @CarloPescio http://physicsofsoftware.com Carlo Pescio On Growth and Software (or: applying some Physics of Software)
  • 2. Carlo Pescio @CarloPescio http://physicsofsoftware.com Inspired by a classic
  • 3. Carlo Pescio @CarloPescio http://physicsofsoftware.com Form as a Diagram of Forces
  • 4. Carlo Pescio @CarloPescio http://physicsofsoftware.com Form as a Recipe for Reaction My own little step – don’t blame D’Arcy  Material and shape encode reactions to “forces”
  • 5. Carlo Pescio @CarloPescio http://physicsofsoftware.com Form as a Recipe for Growth
  • 6. Carlo Pescio @CarloPescio http://physicsofsoftware.com Good ol’ book + - U U
  • 7. Carlo Pescio @CarloPescio http://physicsofsoftware.com The ring binder U D D U U C C
  • 8. Carlo Pescio @CarloPescio http://physicsofsoftware.com Growth Model
  • 9. Carlo Pescio @CarloPescio http://physicsofsoftware.com Growth Model
  • 10. Carlo Pescio @CarloPescio http://physicsofsoftware.com [Mis]Aligned Growth Model (ideal) growth in decision space (actual) growth in artifact space
  • 11. Carlo Pescio @CarloPescio http://physicsofsoftware.com “Growth” in computing Extensibility Scalability C/D features in code C/D run-time load Code as artifacts Run-time behavior C/D feature -> C/D load -> C/D artifact C/D machines / CPU
  • 12. Carlo Pescio @CarloPescio http://physicsofsoftware.com
  • 13. Carlo Pescio @CarloPescio http://physicsofsoftware.com Extensibility?
  • 14. Carlo Pescio @CarloPescio http://physicsofsoftware.com Symmetry in Growth [model] Create feature Delete feature decision space Create artifacts Delete artifacts artifact space
  • 15. Carlo Pescio @CarloPescio http://physicsofsoftware.com Why bother??? - Product families - Plug-in architectures, 3rd party modules - Modular understanding - “zero impact” evolution
  • 16. Carlo Pescio @CarloPescio http://physicsofsoftware.com In practice? A simple, specific problem with a specific growth model. Lessons here apply to similar growth models. Not everything will / should follow this model. The final shape is not universal the method of investigation kinda is
  • 17. Carlo Pescio @CarloPescio http://physicsofsoftware.com Easy
  • 18. Carlo Pescio @CarloPescio http://physicsofsoftware.com Some physics required 
  • 19. Carlo Pescio @CarloPescio http://physicsofsoftware.com Vector drawing for dummies
  • 20. Carlo Pescio @CarloPescio http://physicsofsoftware.com Growth Model - New shape types will come over time - New behaviors will come over time - Behaviors can be composed out of a fixed core - That entire menu only requires {bounding box, move} I’m dealing only with geometry right now
  • 21. Carlo Pescio @CarloPescio http://physicsofsoftware.com Context We have an open, discrete set of “concepts” { Square, Triangle, Circle, … } It’s open and so will grow by addition. T3 T2 T1 + + T = { Ti }
  • 22. Carlo Pescio @CarloPescio http://physicsofsoftware.com In code? How do we mirror in code? • N types: OK • N classes: OK • N objects / prototypes: OK • through closures / records of functions: ok as well • Case classes: Maybe • 1 sum type: NO + T = { Ti }
  • 23. N trivial classes (Scala) class Point( var x : Float, var y : Float ) {} class Box( var topLeft : Point, var bottomRight : Point ) {} class Circle( var center : Point, var radius : Float ) {} class Square( var topLeft : Point, var side : Float ) {} +
  • 24. 1 sum type (Haskell): nope type Point = (Float,Float) type Radius = Float type Side = Float data Shape = Circle Point Radius | Square Point Side + U
  • 25. Carlo Pescio @CarloPescio http://physicsofsoftware.com Context We have a closed set of “core behaviors” { BoundingBox, Move, Scale, Rotate, Mirror } ^ H = { Hi }H
  • 26. Carlo Pescio @CarloPescio http://physicsofsoftware.com Context “Core behaviors” depends on concepts. More precisely: when we create/delete a concept, we create/delete its implementation of core behaviors. ^ Ti C/D > HTi T3 T2 T1 + HT3 HT2 HT1 +
  • 27. Carlo Pescio @CarloPescio http://physicsofsoftware.com In code? How do we mirror • Member functions (class, objects): ok • Functions (+ optional overloading): ok • 1 function per behavior + pattern matching: NO • That removes case classes from the table ^ Ti C/D > HTi
  • 28. Case classes (Scala): nope abstract class Shape case class Circle(center:Point, radius:Float) extends Shape case class Square(topLeft:Point, side:Float) extends Shape + U object moveTool { def move( sh : Shape, newCenter : Point ) : Shape = { sh match { case Circle(center, radius) => new Circle( newCenter, radius); case Square( topLeft, side) => new Square(Point(topLeft.x-side/2, topLeft.y-side/2), side); } } }
  • 29. Carlo Pescio @CarloPescio http://physicsofsoftware.com Context We can: a) create instances of those concepts and keep them available for selection b) select some of those instances (mixed concepts) from a bounding box c) apply composite behaviors to those (mixed) instances
  • 30. Carlo Pescio @CarloPescio http://physicsofsoftware.com Context a) We want to create instances and keep them “available” for selection In code: • A single collection: OK • A collection for each type: OK A collection for each type is ok, as we still transfer creation (of concept) into creation (of a new list).
  • 31. Carlo Pescio @CarloPescio http://physicsofsoftware.com Context b) We want to select a (mixed) subset by dragging a selection box. So we need a selection function looping over all the available shapes and checking their bounding boxes (BB is a “core behavior” for shapes).
  • 32. Carlo Pescio @CarloPescio http://physicsofsoftware.com selection box f selection 1 collection per type won’t work anymore + + U Same reasoning applies to any of the composite behaviors shapes selected shapes
  • 33. Carlo Pescio @CarloPescio http://physicsofsoftware.com Context We have an open set of “composite behaviors” + B = { Bi } e.g. { align left, distribute horizontally, flip vertical} They operate on collections of concepts (instances). ^ Bi ≡ ·(H)
  • 34. Carlo Pescio @CarloPescio http://physicsofsoftware.com Context + T = { Ti } * + B = { Bi } ^ + (HTi) · C/D Two problems with Bi here: 1) Works on a set of shapes (same as selection) 2) Composed from a set of type-dependent core behaviors (same as selection w/ BB)
  • 35. Carlo Pescio @CarloPescio http://physicsofsoftware.com A single collection of shapes That would require either: • A dynamic language • mixing types is natural • A way to form a placeholder type as substitute for the individual types: • Base type + subtypes • Base class / interface + derived classes • [objects as] Records of closures • Existential types / Abstract types
  • 36. Carlo Pescio @CarloPescio http://physicsofsoftware.com Classes in Scala (easy) abstract class Shape { def explain() : String; def boundingBox() : Box; def moveCenter(newCenter:Point) : Shape; }
  • 37. Classes in Scala (easy) class Circle(private var center: Point, private var radius: Float) extends Shape { def explain(): String = { "circle " + center.x + " " + center.y + " " + radius; } def boundingBox(): Box = { new Box( Point(center.x-radius, center.y-radius), Point(center.x+radius, center.y+radius) ); } def moveCenter(newCenter: Point): Shape = { new Circle(newCenter, radius); } }
  • 38. Classes in Scala (easy) class Square(private var topLeft: Point, private var side: Float) extends Shape { def explain(): String = { "square " + topLeft.x + " " + topLeft.y + " " + side; } def boundingBox(): Box = { new Box( topLeft, Point(topLeft.x+side, topLeft.y+side)); } def moveCenter(newCenter: Point): Shape = { new Square(Point(topLeft.x-side/2, topLeft.y-side/2), side); } }
  • 39. Classes in Scala (easy) object MainObject { def main(args: Array[String]): Unit = { val c1 = new Circle( Point(1,1), 4 ) ; val s1 = new Square( Point(0,0), 4 ) ; val sh : List[Shape] = List( c1, s1 ); var d : String = sh.map( s => s.moveCenter(Point(5,5)).explain() ).reduce((s1,s2) => s1 + " ; " + s2) ; println( d ) ; } }
  • 40. Records of Closures (Haskell) type Point = (Float,Float) type Box = (Point,Point) data Shape = Shape { explain :: String, boundingBox :: Box, moveCenter :: Point -> Shape }
  • 41. Records of Closures (Haskell) circle :: Point -> Float -> Shape circle (x,y) r = Shape explain boundingBox moveCenter where explain = "circle " ++ show x ++ " " ++ show y ++ " " ++ show r boundingBox = ( (x-r, y-r), (x+r, y+r) ) moveCenter (x1,y1) = circle (x1, y1) r
  • 42. Records of Closures (Haskell) square :: Point -> Float -> Shape square (t,l) s = Shape explain boundingBox moveCenter where explain = "square " ++ show t ++ " " ++ show l ++ " " ++ show s boundingBox = ( (t, l), (t+s, l+s) ) moveCenter (x1,y1) = square (x1-s/2, y1-s/2) s
  • 43. Carlo Pescio @CarloPescio http://physicsofsoftware.com Records of Closures (Haskell) main = do let c1 = circle (1,1) 3 let s1 = square (1,1) 3 let sh = [ c1, s1 ] putStrLn (concat ( map (s -> (explain (moveCenter s (5,5))) ++ " ; ") sh ) )
  • 44. Existential type (Haskell) type Point = (Float,Float) type Box = (Point,Point) class ShapeTC a where explain :: a -> String boundingBox :: a -> Box moveCenter :: a -> Point -> Shape data Shape = forall a. ShapeTC a => Shape a instance ShapeTC Shape where explain (Shape shape) = explain shape boundingBox (Shape shape) = boundingBox shape moveCenter (Shape shape) = moveCenter shape
  • 45. Existential type (Haskell) data Circle = Circle Point Float instance ShapeTC Circle where explain (Circle (x,y) r ) = "circle " ++ show x ++ " " ++ show y ++ " " ++ show r boundingBox (Circle (x,y) r) = ( (x-r, y-r), (x+r, y+r) ) moveCenter (Circle (x,y) r) (x1,y1) = circle (x1, y1) r circle :: Point -> Float -> Shape circle (x,y) r = Shape (Circle (x,y) r)
  • 46. Existential type (Haskell) data Square = Square Point Float instance ShapeTC Square where explain (Square (t,l) s) = "square " ++ show t ++ " " ++ show l ++ " " ++ show s boundingBox (Square (t,l) s) = ( (t, l), (t+s, l+s) ) moveCenter (Square (t,l) s) (x1,y1) = square (x1-s/2, y1-s/2) s square :: Point -> Float -> Shape square (t,l) s = Shape (Square (t,l) s)
  • 47. Existential type (Haskell) main = do let c1 = circle (2,2) 3 let s1 = square (2,2) 3 let sh = [ c1, s1 ] putStrLn (concat ( map (s -> (explain (moveCenter s (6,6))) ++ " ; ") sh ) )
  • 51. Carlo Pescio @CarloPescio http://physicsofsoftware.com Work in progress ^ Ha = { Hi } + T = { Ti } * + B = { Bi } ^ + HTi · C/D ^ Ta + T = { Ti } * + B = { Bi } ^ + (HTi) · C/D
  • 52. Carlo Pescio @CarloPescio http://physicsofsoftware.com Every type has identity (to keep it simple: name) F knows identities in => F unstable So: - F should not know identities in - F needs to operate on values of those types. => F must be isolated from type identity. Identity and Isolation + T + T
  • 53. Carlo Pescio @CarloPescio http://physicsofsoftware.com Common techniques for isolation: - Add a new “abstract type” Ta, make every Ti an instance or subtype of Ta - Requires late binding as F will only know Ta - Relationship between Ti and Ta can be implicit (structural conformance) - Add a new concrete type Tc exposing only functions, and bind every instance of Ti to an instance of Tc - That’s again providing late binding as F won’t know the identity of the functions it’s calling Isolation Techniques
  • 54. Carlo Pescio @CarloPescio http://physicsofsoftware.com structures vs paradigms
  • 55. Carlo Pescio @CarloPescio http://physicsofsoftware.com OO SUCKS!
  • 56. Carlo Pescio @CarloPescio http://physicsofsoftware.com Get your trick question ready 1. The next time someone shows you a decent use for OO-like polymorphism & encapsulation, what can you say? what about serialization in multiple formats?
  • 57. Carlo Pescio @CarloPescio http://physicsofsoftware.com Remember this?
  • 58. Carlo Pescio @CarloPescio http://physicsofsoftware.com Elastic yet bent !?
  • 59. Carlo Pescio @CarloPescio http://physicsofsoftware.com We only have geometry so far I want rendering (new core behaviors!) I may want only geometry I may want only rendering I may want both => Geometry and Rendering in distinct artifacts Breaking the growth model
  • 60.
  • 61. Carlo Pescio @CarloPescio http://physicsofsoftware.com Growing and Breaking
  • 62. partial class Circle { private readonly Point center; private readonly double radius; public Circle( Point center, double radius ) { this.center = center; this.radius = radius; } } interface Shape { Shape Move(Point newCenter); } partial class Circle : Shape { public Shape Move(Point newCenter) { return new Circle(newCenter, radius); } } interface Drawing { void Render(); } partial class Circle : Drawing { public void Render() { Console.WriteLine( "I'm a Circle with radius " + radius.ToString()); } } static void Main(string[] args) { Shape c = new Circle(new Point(10, 10), 5); Drawing d = c as Drawing; d.Render(); } constraint Shape => Drawing
  • 63. Carlo Pescio @CarloPescio http://physicsofsoftware.com “Design Process” I didn’t use - Design principles - Patterns - Tests - Religion I only aimed for symmetry - Features growth model - Artifacts growth model Break a symmetry to get a symmetry 
  • 64. Carlo Pescio @CarloPescio http://physicsofsoftware.com …Monads  Or polymorphism Or existential types Or type system constraints Or many things yet to be invented Just by understanding forces  You may have invented…
  • 65. Carlo Pescio @CarloPescio http://physicsofsoftware.com Get in touch @CarloPescio carlo.pescio@gmail.com http://physicsofsoftware.com /forum