SlideShare a Scribd company logo
1 of 58
Download to read offline
ndc 2011
FLUID
The
Principles
Kevlin Henney
Anders Norås
FLUID
SOLID
contrasts with
S
O
L
ingle Responsibility Principle
pen / Closed Principle
iskov’s Substitution Principle
nterface Segregation Principle
ependency Inversion Principle
I
D
Bob might not be
your uncle
By A. NORÅS &
K. HENNEY
Ut enim ad minim veniam, quis nostrud exerc.
Irure dolor in reprehend incididunt ut labore et
dolore magna aliqua. Ut enim ad minim
veniam, quis nostrud exercitation ullamco
laboris nisi ut aliquip ex ea commodo
consequat. Duis aute irure dolor in
reprehenderit in voluptate velit esse molestaie
cillum. Tia non ob ea soluad incommod quae
egen ium improb fugiend. Officia deserunt
mollit anim id est laborum Et harumd dereud.
Neque pecun modut neque
Consectetuer arcu ipsum ornare pellentesque
vehicula, in vehicula diam, ornare magna erat
felis wisi a risus. Justo fermentum id. Malesuada
eleifend, tortor molestie, a fusce a vel et. Mauris
at suspendisse, neque aliquam faucibus
adipiscing, vivamus in. Wisi mattis leo suscipit
nec amet, nisl fermentum tempor ac a, augue in
eleifend in venenatis, cras sit id in vestibulum
felis. Molestie ornare amet vel id fusce, rem
volutpat platea. Magnis vel, lacinia nisl, vel
nostra nunc eleifend arcu leo, in dignissim
lorem vivamus laoreet.
Donec arcu risus diam amet sit. Congue tortor
cursus risus vestibulum commodo nisl, luctus
augue amet quis aenean odio etiammaecenas sit,
donec velit iusto, morbi felis elit et nibh.
Vestibulum volutpat dui lacus consectetuer ut,
mauris at etiam suspendisse, eu wisi rhoncus
eget nibh velit, eget posuere sem in a sit.
Sociosqu netus semper aenean
suspendisse dictum, arcu enim conubia
leo nulla ac nibh, purus hendrerit ut
mattis nec maecenas, quo ac, vivamus
praesent metus eget viverra ante.
Natoque placerat sed sit hendrerit,
dapibus eleifend velit molestiae leo a, ut
lorem sit et lacus aliquam. Sodales nulla
erat et luctus faucibus aperiam sapien.
Leo inceptos augue nec pulvinar rutrum
aliquam mauris, wisi hasellus fames ac,
commodo eligendi dictumst, dapibus
morbi auctor.
Ut enim ad minim veniam, quis nostrud
exerc. Irure dolor in reprehend
incididunt ut labore et dolore magna
aliqua. Ut enim ad minim veniam, quis
nostrud exercitation ullamco laboris nisi
ut aliquip ex ea commodo consequat.
Duis aute irure dolor in reprehenderit in
voluptate velit esse molestaie cillum. Tia
non ob ea soluad incommod quae egen
ium improb fugiend. Officia deserunt
mollit anim id est laborum Et harumd
dereud.
Etiam sit amet est
The Software Dev Times
“ALL THE NEWS THAT’S FIT TO DEPLOY” LATE EDITION
VOL XI...NO 12,345 OSLO, WEDNESDAY, JUNE 8, 2011 FREE AS IN BEER
SHOCK-SOLID!
MYSTERIOUS SOFTWARE CRAFTSMAN
COINED THE SOLID ACRONYM!
NO COMMENT. The software craftsman claimed to have discovered that a set of
principles could be abbreviated “SOLID”, declined to comment on the matter.
e
Bristol
Dictionary
of
Concise
English
prin·ci·ple /ˈprinsəpəl/ Noun
1. a fundamental truth
or proposition that
serves as the foundation
for a system of belief or
behaviour or for a chain
of reasoning.
2. morally correct
behaviour and attitudes.
3. a general scientific
theorem or law that has
n u m e r o u s s p e c i a l
applications across a
wide field.
4. a natural law forming
t h e b a s i s f o r t h e
construction or working
of a machine.
para·skevi·de·katri·a·ph
o·bia /ˈpærəskevidekaˈtriəˈfōbēə/Adjective, Noun
1. fear of Friday the
13th.
Etymology: e word
was devised by Dr.
Donald Dossey who told
his patients that "when
you learn to pronounce
it, you're cured.
FLUID
The
Principles
Kevlin Henney
Anders Norås
Guidelines
F L U I D
What are the
Guidelines?
F
L
U
I
D
F
L
U
I
D
Functional
public class HeatingSystem {
public void turnOn() ...
public void turnOff() ...
...
}
public class Timer {
public Timer(TimeOfDay toExpire, Runnable toDo) ...
public void run() ...
public void cancel() ...
...
}
Java
public class TurnOn implements Runnable {
private HeatingSystem toTurnOn;
public TurnOn(HeatingSystem toRun) {
toTurnOn = toRun;
}
public void run() {
toTurnOn.turnOn();
}
}
public class TurnOff implements Runnable {
private HeatingSystem toTurnOff;
public TurnOff(HeatingSystem toRun) {
toTurnOff = toRun;
}
public void run() {
toTurnOff.turnOff();
}
}
Java
Timer turningOn =
new Timer(timeOn, new TurnOn(heatingSystem));
Timer turningOff =
new Timer(timeOff, new TurnOff(heatingSystem));
Java
Timer turningOn =
new Timer(
timeToTurnOn,
new Runnable() {
public void run() {
heatingSystem.turnOn();
}
});
Timer turningOff =
new Timer(
timeToTurnOff,
new Runnable() {
public void run() {
heatingSystem.turnOff();
}
});
Java
void turnOn(void * toTurnOn)
{
static_cast<HeatingSystem *>(toTurnOn)->turnOn();
}
void turnOff(void * toTurnOff)
{
static_cast<HeatingSystem *>(toTurnOff)->turnOff();
}
C++
Timer turningOn(timeOn, &heatingSystem, turnOn);
Timer turningOff(timeOff, &heatingSystem, turnOff);
C++
class Timer
{
Timer(TimeOfDay toExpire, function<void()> toDo);
void run();
void cancel();
...
};
C++
Timer turningOn(
timeOn,
bind(
&HeatingSystem::turnOn,
&heatingSystem);
Timer turningOff(
timeOff,
bind(
&HeatingSystem::turnOff,
&heatingSystem);
C++
public class Timer
{
public Timer(
TimeOfDay toExpire, Action toDo) ...
public void Run() ...
public void Cancel() ...
...
}
C#
Timer turningOn =
new Timer(
timeOn, () => heatingSystem.TurnOn()
);
Timer turningOff =
new Timer(
timeOff, () => heatingSystem.TurnOff()
);
C#
Timer turningOn =
new Timer(
timeOn, heatingSystem.TurnOn
);
Timer turningOff =
new Timer(
timeOff, heatingSystem.TurnOff
);
C#
F
L
U
I
D
unctional
F
L
U
I
D
unctional
Loose
OOP to me means only
messaging, local retention
and protection and hiding of
state-process, and extreme
late-binding of all things. It
can be done in Smalltalk and
in LISP. There are possibly
other systems in which this
is possible, but I'm not
aware of them.
“
•Allan Kay
#include <windows.h>
#include <stdio.h>
typedef int (__cdecl *MYPROC)(LPWSTR);
VOID main(VOID)
{
HINSTANCE hinstLib;
MYPROC ProcAdd;
BOOL fFreeResult, fRunTimeLinkSuccess = FALSE;
hinstLib = LoadLibrary(TEXT("echo.dll"));
if (hinstLib != NULL)
{
ProcAdd = (MYPROC) GetProcAddress(hinstLib, "echo");
if (NULL != ProcAdd)
{
fRunTimeLinkSuccess = TRUE;
(ProcAdd) (L"Hello my world!n");
}
fFreeResult = FreeLibrary(hinstLib);
}
if (!fRunTimeLinkSuccess)
printf("Hello everybody's world!n");
}
C
class HeatingSystem {
def turnOn() { ... }
def turnOff() { ... }
}
def heater = new HeatingSystem()
def timer = new Timer()
def action = "turnOn"
timer.runAfter(1000) {
heater."$action"()
}
Groovy
class DiyStore
{
private $_bucket;
public function getPaintBucket()
{
if ($this->_bucket === null) {
$this->_bucket = $this->fillPaintBucket();
}
return $this->_bucket;
}
private function fillPaintBucket() {
// ...
}
}
PHP
NullObject.new().say().hello().to().
any().method_call().you().like()
Ruby
FLUID
The
Principles
Kevlin Henney
Anders Norås
GuidelinesSuggestions
F
U
L
I
D
unctional
oose
U
F
L
I
D
unctional
oose
Unit Testable
function GetNextFriday13th($from) {
[DateTime[]] $friday13ths = &{
foreach($i in 1..500) {
$from = $from.AddDays(1)
$from
}
} | ?{
$_.DayOfWeek -eq [DayOfWeek]::Friday -and $_.Day -eq 13
}
return $friday13ths[0]
}
PowerShell
[DateTime[][]] $inputsWithExpectations =
("2011-01-01", "2011-05-13"),
("2011-05-13", "2012-01-13"),
("2007-04-01", "2007-04-13"),
("2007-04-12", "2007-04-13"),
("2007-04-13", "2007-07-13"),
("2012-01-01", "2012-01-13"),
("2012-01-13", "2012-04-13"),
("2012-04-13", "2012-07-13"),
("2001-07-13", "2002-09-13")
PowerShell
$inputsWithExpectations | ?{
[String] $actual = GetNextFriday13th($_[0])
[String] $expected = $_[1]
$actual -ne $expected
}
PowerShell
F
L
U
I
D
unctional
oose
nit Testable
F
L
U
I
D
unctional
oose
nit Testable
Introspective
(define (eval exp env)
(cond ((self-evaluating? exp) exp)
((variable? exp) (lookup-variable-value exp env))
((quoted? exp) (text-of-quotation exp))
((assignment? exp) (eval-assignment exp env))
((definition? exp) (eval-definition exp env))
((if? exp) (eval-if exp env))
((lambda? exp))
(make-procedure (lambda-parameters exp)
(lambda-body exp)
env))
((begin? exp)
(eval-sequence (begin-actions exp) env))
((cond? exp) (eval (cond->if exp) env))
((application? exp)
(apply (eval (operator exp) env)
(list-of-values (operands exp) env)))
(else
(error "Unknown expression type -EVAL" exp))))
Scheme
function Shoebox() {
var things = ["Nike 42", "Adidas 41", "Adidas 43", "Paul Smith 41"];
def(this, "find", function(brand) {
var result = [];
for (var i=0; i<things.length; i++) {
if (things[i].indexOf(brand) !== -1) result.push(things[i]);
}
return result;
});
def(this, "find", function(brand,size) {
var result = [];
for (var i=0; i<things.length; i++) {
if (things[i].indexOf(brand) !== -1 || parseInt(things[i].match(/d+/),10) === size)
result.push(things[i]);
}
return result;
});
}
function def(obj, name, fn) {
var implFn = obj[name];
obj[name]=function() {
if (fn.length === arguments.length) return fn.apply(this,arguments);
else if (typeof implFn === "function") return implFn.apply(this,arguments);
};
};
JavaScript
Public Class Book
<Key> _
Public Property ISBN() As String
' ...
End Property
<StringLength(256)> _
Public Property Title() As String
' ...
End Property
Public Property AuthorSSN() As String
' ...
End Property
<RelatedTo(RelatedProperty := Books, Key := AuthorSSN, RelatedKey := SSN)> _
Public Property Author() As Person
' ...
End Property
End Class
Visual Basic
F
L
U
I
D
unctional
oose
nit Testable
ntrospective
F
L
U
I
D
unctional
oose
nit Testable
ntrospective
‘Dempotent
Asking a question
s h o u l d n o t
c h a n g e t h e
answer.
“
•Betrand Meyer
, and nor should
asking it twice!
Retweeted by
@kevlinhenney
(1 to 10).foldLeft(0)(_ + _)
Scala
F
L
U
I
D
unctional
oose
nit Testable
ntrospective
dempotent‘
e venerable master Qc Na was walking with his student, Anton.
Hoping to prompt the master into a discussion, Anton said "Master, I have
heard that objects are a very good thing — is this true?"
Qc Na looked pityingly at his student and replied, "Foolish pupil — objects
are merely a poor man's closures."
Chastised, Anton took his leave from his master and returned to his cell,
intent on studying closures. He carefully read the entire "Lambda: e
Ultimate..." series of papers and its cousins, and implemented a small
Scheme interpreter with a closure-based object system. He learned much,
and looked forward to informing his master of his progress.
On his next walk with Qc Na, Anton attempted to impress his master by
saying "Master, I have diligently studied the matter, and now understand
that objects are truly a poor man's closures."
Qc Na responded by hitting Anton with his stick, saying "When will you
learn? Closures are a poor man's object." At that moment, Anton became
enlightened.
http://people.csail.mit.edu/gregs/ll1-discuss-archive-html/msg03277.html
http://speakerrate.com/talks/7731
@anoras @kevlinhenney

More Related Content

What's hot

Tips on how to improve the performance of your custom modules for high volume...
Tips on how to improve the performance of your custom modules for high volume...Tips on how to improve the performance of your custom modules for high volume...
Tips on how to improve the performance of your custom modules for high volume...
Odoo
 

What's hot (8)

Advanced Testing
Advanced TestingAdvanced Testing
Advanced Testing
 
JVM Memory Management Details
JVM Memory Management DetailsJVM Memory Management Details
JVM Memory Management Details
 
Li̇nux-101
Li̇nux-101Li̇nux-101
Li̇nux-101
 
SOLID Principles and Design Patterns
SOLID Principles and Design PatternsSOLID Principles and Design Patterns
SOLID Principles and Design Patterns
 
Python basic
Python basicPython basic
Python basic
 
Python Introduction
Python IntroductionPython Introduction
Python Introduction
 
Test NG Framework Complete Walk Through
Test NG Framework Complete Walk ThroughTest NG Framework Complete Walk Through
Test NG Framework Complete Walk Through
 
Tips on how to improve the performance of your custom modules for high volume...
Tips on how to improve the performance of your custom modules for high volume...Tips on how to improve the performance of your custom modules for high volume...
Tips on how to improve the performance of your custom modules for high volume...
 

Viewers also liked

Viewers also liked (18)

A Tale of Three Patterns
A Tale of Three PatternsA Tale of Three Patterns
A Tale of Three Patterns
 
The web you were used to is gone. Architecture and strategy for your mobile c...
The web you were used to is gone. Architecture and strategy for your mobile c...The web you were used to is gone. Architecture and strategy for your mobile c...
The web you were used to is gone. Architecture and strategy for your mobile c...
 
Creating Stable Assignments
Creating Stable AssignmentsCreating Stable Assignments
Creating Stable Assignments
 
97 Things Every Programmer Should Know
97 Things Every Programmer Should Know97 Things Every Programmer Should Know
97 Things Every Programmer Should Know
 
Keynote: Small Is Beautiful - Kevlin Henney - Codemotion Rome 2015
Keynote: Small Is Beautiful - Kevlin Henney - Codemotion Rome 2015Keynote: Small Is Beautiful - Kevlin Henney - Codemotion Rome 2015
Keynote: Small Is Beautiful - Kevlin Henney - Codemotion Rome 2015
 
A Tale of Two Patterns
A Tale of Two PatternsA Tale of Two Patterns
A Tale of Two Patterns
 
DPC2007 Objects Of Desire (Kevlin Henney)
DPC2007 Objects Of Desire (Kevlin Henney)DPC2007 Objects Of Desire (Kevlin Henney)
DPC2007 Objects Of Desire (Kevlin Henney)
 
Seven Ineffective Coding Habits of Many Java Programmers
Seven Ineffective Coding Habits of Many Java ProgrammersSeven Ineffective Coding Habits of Many Java Programmers
Seven Ineffective Coding Habits of Many Java Programmers
 
Patterns of Value
Patterns of ValuePatterns of Value
Patterns of Value
 
SOLID Deconstruction
SOLID DeconstructionSOLID Deconstruction
SOLID Deconstruction
 
Worse Is Better, for Better or for Worse
Worse Is Better, for Better or for WorseWorse Is Better, for Better or for Worse
Worse Is Better, for Better or for Worse
 
Collections for States
Collections for StatesCollections for States
Collections for States
 
Substitutability
SubstitutabilitySubstitutability
Substitutability
 
Framing the Problem
Framing the ProblemFraming the Problem
Framing the Problem
 
Driven to Tests
Driven to TestsDriven to Tests
Driven to Tests
 
Immutability FTW!
Immutability FTW!Immutability FTW!
Immutability FTW!
 
The Error of Our Ways
The Error of Our WaysThe Error of Our Ways
The Error of Our Ways
 
Worse Is Better, for Better or for Worse
Worse Is Better, for Better or for WorseWorse Is Better, for Better or for Worse
Worse Is Better, for Better or for Worse
 

Similar to Introducing the FLUID Principles

When Tdd Goes Awry (IAD 2013)
When Tdd Goes Awry (IAD 2013)When Tdd Goes Awry (IAD 2013)
When Tdd Goes Awry (IAD 2013)
Uberto Barbini
 
[E-Dev-Day-US-2015][8/9] he EFL API in Review (Tom Hacohen)
[E-Dev-Day-US-2015][8/9] he EFL API in Review (Tom Hacohen)[E-Dev-Day-US-2015][8/9] he EFL API in Review (Tom Hacohen)
[E-Dev-Day-US-2015][8/9] he EFL API in Review (Tom Hacohen)
EnlightenmentProject
 
인간의 경험 공유를 위한 태스크 및 컨텍스트 추출 및 표현
인간의 경험 공유를 위한 태스크 및 컨텍스트 추출 및 표현인간의 경험 공유를 위한 태스크 및 컨텍스트 추출 및 표현
인간의 경험 공유를 위한 태스크 및 컨텍스트 추출 및 표현
Haklae Kim
 
Rachel Davies Agile Mashups
Rachel Davies Agile MashupsRachel Davies Agile Mashups
Rachel Davies Agile Mashups
deimos
 
KevlinHenney_PuttingThereIntoArchitecture
KevlinHenney_PuttingThereIntoArchitectureKevlinHenney_PuttingThereIntoArchitecture
KevlinHenney_PuttingThereIntoArchitecture
Kostas Mavridis
 

Similar to Introducing the FLUID Principles (20)

NDC 2011 - The FLUID Principles
NDC 2011 - The FLUID PrinciplesNDC 2011 - The FLUID Principles
NDC 2011 - The FLUID Principles
 
Welcome to the Flink Community!
Welcome to the Flink Community!Welcome to the Flink Community!
Welcome to the Flink Community!
 
When Tdd Goes Awry (IAD 2013)
When Tdd Goes Awry (IAD 2013)When Tdd Goes Awry (IAD 2013)
When Tdd Goes Awry (IAD 2013)
 
Automated tests - facts and myths
Automated tests - facts and mythsAutomated tests - facts and myths
Automated tests - facts and myths
 
EVO Energy Consulting Brand Development
EVO Energy Consulting Brand DevelopmentEVO Energy Consulting Brand Development
EVO Energy Consulting Brand Development
 
EESTEC Android Workshops - 101 Java, OOP and Introduction to Android
EESTEC Android Workshops - 101 Java, OOP and Introduction to AndroidEESTEC Android Workshops - 101 Java, OOP and Introduction to Android
EESTEC Android Workshops - 101 Java, OOP and Introduction to Android
 
Eo fosdem 15
Eo fosdem 15Eo fosdem 15
Eo fosdem 15
 
Questioning the status quo
Questioning the status quoQuestioning the status quo
Questioning the status quo
 
[E-Dev-Day-US-2015][8/9] he EFL API in Review (Tom Hacohen)
[E-Dev-Day-US-2015][8/9] he EFL API in Review (Tom Hacohen)[E-Dev-Day-US-2015][8/9] he EFL API in Review (Tom Hacohen)
[E-Dev-Day-US-2015][8/9] he EFL API in Review (Tom Hacohen)
 
Faster! Faster! Accelerate your business with blazing prototypes
Faster! Faster! Accelerate your business with blazing prototypesFaster! Faster! Accelerate your business with blazing prototypes
Faster! Faster! Accelerate your business with blazing prototypes
 
Learning to Sample
Learning to SampleLearning to Sample
Learning to Sample
 
인간의 경험 공유를 위한 태스크 및 컨텍스트 추출 및 표현
인간의 경험 공유를 위한 태스크 및 컨텍스트 추출 및 표현인간의 경험 공유를 위한 태스크 및 컨텍스트 추출 및 표현
인간의 경험 공유를 위한 태스크 및 컨텍스트 추출 및 표현
 
Cutting Through the Hype - What Artificial Intelligence Looks Like in Real Wo...
Cutting Through the Hype - What Artificial Intelligence Looks Like in Real Wo...Cutting Through the Hype - What Artificial Intelligence Looks Like in Real Wo...
Cutting Through the Hype - What Artificial Intelligence Looks Like in Real Wo...
 
Rachel Davies Agile Mashups
Rachel Davies Agile MashupsRachel Davies Agile Mashups
Rachel Davies Agile Mashups
 
SRE for Everyone: Making Tomorrow Better Than Today
SRE for Everyone: Making Tomorrow Better Than Today SRE for Everyone: Making Tomorrow Better Than Today
SRE for Everyone: Making Tomorrow Better Than Today
 
PhpUnit Best Practices
PhpUnit Best PracticesPhpUnit Best Practices
PhpUnit Best Practices
 
KevlinHenney_PuttingThereIntoArchitecture
KevlinHenney_PuttingThereIntoArchitectureKevlinHenney_PuttingThereIntoArchitecture
KevlinHenney_PuttingThereIntoArchitecture
 
Artificial Intelligence: Cutting Through the Hype
Artificial Intelligence: Cutting Through the HypeArtificial Intelligence: Cutting Through the Hype
Artificial Intelligence: Cutting Through the Hype
 
Javascript: The Important Bits
Javascript: The Important BitsJavascript: The Important Bits
Javascript: The Important Bits
 
B D D Intro
B D D  IntroB D D  Intro
B D D Intro
 

More from Kevlin Henney

More from Kevlin Henney (20)

Program with GUTs
Program with GUTsProgram with GUTs
Program with GUTs
 
The Case for Technical Excellence
The Case for Technical ExcellenceThe Case for Technical Excellence
The Case for Technical Excellence
 
Empirical Development
Empirical DevelopmentEmpirical Development
Empirical Development
 
Lambda? You Keep Using that Letter
Lambda? You Keep Using that LetterLambda? You Keep Using that Letter
Lambda? You Keep Using that Letter
 
Lambda? You Keep Using that Letter
Lambda? You Keep Using that LetterLambda? You Keep Using that Letter
Lambda? You Keep Using that Letter
 
Solid Deconstruction
Solid DeconstructionSolid Deconstruction
Solid Deconstruction
 
Get Kata
Get KataGet Kata
Get Kata
 
Procedural Programming: It’s Back? It Never Went Away
Procedural Programming: It’s Back? It Never Went AwayProcedural Programming: It’s Back? It Never Went Away
Procedural Programming: It’s Back? It Never Went Away
 
Structure and Interpretation of Test Cases
Structure and Interpretation of Test CasesStructure and Interpretation of Test Cases
Structure and Interpretation of Test Cases
 
Agility ≠ Speed
Agility ≠ SpeedAgility ≠ Speed
Agility ≠ Speed
 
Refactoring to Immutability
Refactoring to ImmutabilityRefactoring to Immutability
Refactoring to Immutability
 
Old Is the New New
Old Is the New NewOld Is the New New
Old Is the New New
 
Turning Development Outside-In
Turning Development Outside-InTurning Development Outside-In
Turning Development Outside-In
 
Giving Code a Good Name
Giving Code a Good NameGiving Code a Good Name
Giving Code a Good Name
 
Clean Coders Hate What Happens To Your Code When You Use These Enterprise Pro...
Clean Coders Hate What Happens To Your Code When You Use These Enterprise Pro...Clean Coders Hate What Happens To Your Code When You Use These Enterprise Pro...
Clean Coders Hate What Happens To Your Code When You Use These Enterprise Pro...
 
Thinking Outside the Synchronisation Quadrant
Thinking Outside the Synchronisation QuadrantThinking Outside the Synchronisation Quadrant
Thinking Outside the Synchronisation Quadrant
 
Code as Risk
Code as RiskCode as Risk
Code as Risk
 
Software Is Details
Software Is DetailsSoftware Is Details
Software Is Details
 
Game of Sprints
Game of SprintsGame of Sprints
Game of Sprints
 
Good Code
Good CodeGood Code
Good Code
 

Recently uploaded

introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
VishalKumarJha10
 

Recently uploaded (20)

A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
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
 
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-...
 
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand
 
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdfintroduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
introduction-to-automotive Andoid os-csimmonds-ndctechtown-2021.pdf
 
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
 
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
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
Define the academic and professional writing..pdf
Define the academic and professional writing..pdfDefine the academic and professional writing..pdf
Define the academic and professional writing..pdf
 
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfPayment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
 
LEVEL 5 - SESSION 1 2023 (1).pptx - PDF 123456
LEVEL 5   - SESSION 1 2023 (1).pptx - PDF 123456LEVEL 5   - SESSION 1 2023 (1).pptx - PDF 123456
LEVEL 5 - SESSION 1 2023 (1).pptx - PDF 123456
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
BUS PASS MANGEMENT SYSTEM USING PHP.pptx
BUS PASS MANGEMENT SYSTEM USING PHP.pptxBUS PASS MANGEMENT SYSTEM USING PHP.pptx
BUS PASS MANGEMENT SYSTEM USING PHP.pptx
 
Pharm-D Biostatistics and Research methodology
Pharm-D Biostatistics and Research methodologyPharm-D Biostatistics and Research methodology
Pharm-D Biostatistics and Research methodology
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
Chinsurah Escorts ☎️8617697112 Starting From 5K to 15K High Profile Escorts ...
Chinsurah Escorts ☎️8617697112  Starting From 5K to 15K High Profile Escorts ...Chinsurah Escorts ☎️8617697112  Starting From 5K to 15K High Profile Escorts ...
Chinsurah Escorts ☎️8617697112 Starting From 5K to 15K High Profile Escorts ...
 
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 🔝✔️✔️
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
 

Introducing the FLUID Principles

  • 2.
  • 5. S O L ingle Responsibility Principle pen / Closed Principle iskov’s Substitution Principle nterface Segregation Principle ependency Inversion Principle I D
  • 6. Bob might not be your uncle By A. NORÅS & K. HENNEY Ut enim ad minim veniam, quis nostrud exerc. Irure dolor in reprehend incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse molestaie cillum. Tia non ob ea soluad incommod quae egen ium improb fugiend. Officia deserunt mollit anim id est laborum Et harumd dereud. Neque pecun modut neque Consectetuer arcu ipsum ornare pellentesque vehicula, in vehicula diam, ornare magna erat felis wisi a risus. Justo fermentum id. Malesuada eleifend, tortor molestie, a fusce a vel et. Mauris at suspendisse, neque aliquam faucibus adipiscing, vivamus in. Wisi mattis leo suscipit nec amet, nisl fermentum tempor ac a, augue in eleifend in venenatis, cras sit id in vestibulum felis. Molestie ornare amet vel id fusce, rem volutpat platea. Magnis vel, lacinia nisl, vel nostra nunc eleifend arcu leo, in dignissim lorem vivamus laoreet. Donec arcu risus diam amet sit. Congue tortor cursus risus vestibulum commodo nisl, luctus augue amet quis aenean odio etiammaecenas sit, donec velit iusto, morbi felis elit et nibh. Vestibulum volutpat dui lacus consectetuer ut, mauris at etiam suspendisse, eu wisi rhoncus eget nibh velit, eget posuere sem in a sit. Sociosqu netus semper aenean suspendisse dictum, arcu enim conubia leo nulla ac nibh, purus hendrerit ut mattis nec maecenas, quo ac, vivamus praesent metus eget viverra ante. Natoque placerat sed sit hendrerit, dapibus eleifend velit molestiae leo a, ut lorem sit et lacus aliquam. Sodales nulla erat et luctus faucibus aperiam sapien. Leo inceptos augue nec pulvinar rutrum aliquam mauris, wisi hasellus fames ac, commodo eligendi dictumst, dapibus morbi auctor. Ut enim ad minim veniam, quis nostrud exerc. Irure dolor in reprehend incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse molestaie cillum. Tia non ob ea soluad incommod quae egen ium improb fugiend. Officia deserunt mollit anim id est laborum Et harumd dereud. Etiam sit amet est The Software Dev Times “ALL THE NEWS THAT’S FIT TO DEPLOY” LATE EDITION VOL XI...NO 12,345 OSLO, WEDNESDAY, JUNE 8, 2011 FREE AS IN BEER SHOCK-SOLID! MYSTERIOUS SOFTWARE CRAFTSMAN COINED THE SOLID ACRONYM! NO COMMENT. The software craftsman claimed to have discovered that a set of principles could be abbreviated “SOLID”, declined to comment on the matter.
  • 8. prin·ci·ple /ˈprinsəpəl/ Noun 1. a fundamental truth or proposition that serves as the foundation for a system of belief or behaviour or for a chain of reasoning. 2. morally correct behaviour and attitudes. 3. a general scientific theorem or law that has n u m e r o u s s p e c i a l applications across a wide field. 4. a natural law forming t h e b a s i s f o r t h e construction or working of a machine. para·skevi·de·katri·a·ph o·bia /ˈpærəskevidekaˈtriəˈfōbēə/Adjective, Noun 1. fear of Friday the 13th. Etymology: e word was devised by Dr. Donald Dossey who told his patients that "when you learn to pronounce it, you're cured.
  • 9.
  • 11. F L U I D What are the Guidelines?
  • 15. public class HeatingSystem { public void turnOn() ... public void turnOff() ... ... } public class Timer { public Timer(TimeOfDay toExpire, Runnable toDo) ... public void run() ... public void cancel() ... ... } Java
  • 16. public class TurnOn implements Runnable { private HeatingSystem toTurnOn; public TurnOn(HeatingSystem toRun) { toTurnOn = toRun; } public void run() { toTurnOn.turnOn(); } } public class TurnOff implements Runnable { private HeatingSystem toTurnOff; public TurnOff(HeatingSystem toRun) { toTurnOff = toRun; } public void run() { toTurnOff.turnOff(); } } Java
  • 17. Timer turningOn = new Timer(timeOn, new TurnOn(heatingSystem)); Timer turningOff = new Timer(timeOff, new TurnOff(heatingSystem)); Java
  • 18. Timer turningOn = new Timer( timeToTurnOn, new Runnable() { public void run() { heatingSystem.turnOn(); } }); Timer turningOff = new Timer( timeToTurnOff, new Runnable() { public void run() { heatingSystem.turnOff(); } }); Java
  • 19. void turnOn(void * toTurnOn) { static_cast<HeatingSystem *>(toTurnOn)->turnOn(); } void turnOff(void * toTurnOff) { static_cast<HeatingSystem *>(toTurnOff)->turnOff(); } C++
  • 20. Timer turningOn(timeOn, &heatingSystem, turnOn); Timer turningOff(timeOff, &heatingSystem, turnOff); C++
  • 21. class Timer { Timer(TimeOfDay toExpire, function<void()> toDo); void run(); void cancel(); ... }; C++
  • 23. public class Timer { public Timer( TimeOfDay toExpire, Action toDo) ... public void Run() ... public void Cancel() ... ... } C#
  • 24. Timer turningOn = new Timer( timeOn, () => heatingSystem.TurnOn() ); Timer turningOff = new Timer( timeOff, () => heatingSystem.TurnOff() ); C#
  • 25. Timer turningOn = new Timer( timeOn, heatingSystem.TurnOn ); Timer turningOff = new Timer( timeOff, heatingSystem.TurnOff ); C#
  • 26.
  • 29. Loose
  • 30. OOP to me means only messaging, local retention and protection and hiding of state-process, and extreme late-binding of all things. It can be done in Smalltalk and in LISP. There are possibly other systems in which this is possible, but I'm not aware of them. “ •Allan Kay
  • 31. #include <windows.h> #include <stdio.h> typedef int (__cdecl *MYPROC)(LPWSTR); VOID main(VOID) { HINSTANCE hinstLib; MYPROC ProcAdd; BOOL fFreeResult, fRunTimeLinkSuccess = FALSE; hinstLib = LoadLibrary(TEXT("echo.dll")); if (hinstLib != NULL) { ProcAdd = (MYPROC) GetProcAddress(hinstLib, "echo"); if (NULL != ProcAdd) { fRunTimeLinkSuccess = TRUE; (ProcAdd) (L"Hello my world!n"); } fFreeResult = FreeLibrary(hinstLib); } if (!fRunTimeLinkSuccess) printf("Hello everybody's world!n"); } C
  • 32. class HeatingSystem { def turnOn() { ... } def turnOff() { ... } } def heater = new HeatingSystem() def timer = new Timer() def action = "turnOn" timer.runAfter(1000) { heater."$action"() } Groovy
  • 33. class DiyStore { private $_bucket; public function getPaintBucket() { if ($this->_bucket === null) { $this->_bucket = $this->fillPaintBucket(); } return $this->_bucket; } private function fillPaintBucket() { // ... } } PHP
  • 39. function GetNextFriday13th($from) { [DateTime[]] $friday13ths = &{ foreach($i in 1..500) { $from = $from.AddDays(1) $from } } | ?{ $_.DayOfWeek -eq [DayOfWeek]::Friday -and $_.Day -eq 13 } return $friday13ths[0] } PowerShell
  • 40. [DateTime[][]] $inputsWithExpectations = ("2011-01-01", "2011-05-13"), ("2011-05-13", "2012-01-13"), ("2007-04-01", "2007-04-13"), ("2007-04-12", "2007-04-13"), ("2007-04-13", "2007-07-13"), ("2012-01-01", "2012-01-13"), ("2012-01-13", "2012-04-13"), ("2012-04-13", "2012-07-13"), ("2001-07-13", "2002-09-13") PowerShell
  • 41. $inputsWithExpectations | ?{ [String] $actual = GetNextFriday13th($_[0]) [String] $expected = $_[1] $actual -ne $expected } PowerShell
  • 45. (define (eval exp env) (cond ((self-evaluating? exp) exp) ((variable? exp) (lookup-variable-value exp env)) ((quoted? exp) (text-of-quotation exp)) ((assignment? exp) (eval-assignment exp env)) ((definition? exp) (eval-definition exp env)) ((if? exp) (eval-if exp env)) ((lambda? exp)) (make-procedure (lambda-parameters exp) (lambda-body exp) env)) ((begin? exp) (eval-sequence (begin-actions exp) env)) ((cond? exp) (eval (cond->if exp) env)) ((application? exp) (apply (eval (operator exp) env) (list-of-values (operands exp) env))) (else (error "Unknown expression type -EVAL" exp)))) Scheme
  • 46. function Shoebox() { var things = ["Nike 42", "Adidas 41", "Adidas 43", "Paul Smith 41"]; def(this, "find", function(brand) { var result = []; for (var i=0; i<things.length; i++) { if (things[i].indexOf(brand) !== -1) result.push(things[i]); } return result; }); def(this, "find", function(brand,size) { var result = []; for (var i=0; i<things.length; i++) { if (things[i].indexOf(brand) !== -1 || parseInt(things[i].match(/d+/),10) === size) result.push(things[i]); } return result; }); } function def(obj, name, fn) { var implFn = obj[name]; obj[name]=function() { if (fn.length === arguments.length) return fn.apply(this,arguments); else if (typeof implFn === "function") return implFn.apply(this,arguments); }; }; JavaScript
  • 47. Public Class Book <Key> _ Public Property ISBN() As String ' ... End Property <StringLength(256)> _ Public Property Title() As String ' ... End Property Public Property AuthorSSN() As String ' ... End Property <RelatedTo(RelatedProperty := Books, Key := AuthorSSN, RelatedKey := SSN)> _ Public Property Author() As Person ' ... End Property End Class Visual Basic
  • 51.
  • 52. Asking a question s h o u l d n o t c h a n g e t h e answer. “ •Betrand Meyer , and nor should asking it twice! Retweeted by @kevlinhenney
  • 55.
  • 56.
  • 57. e venerable master Qc Na was walking with his student, Anton. Hoping to prompt the master into a discussion, Anton said "Master, I have heard that objects are a very good thing — is this true?" Qc Na looked pityingly at his student and replied, "Foolish pupil — objects are merely a poor man's closures." Chastised, Anton took his leave from his master and returned to his cell, intent on studying closures. He carefully read the entire "Lambda: e Ultimate..." series of papers and its cousins, and implemented a small Scheme interpreter with a closure-based object system. He learned much, and looked forward to informing his master of his progress. On his next walk with Qc Na, Anton attempted to impress his master by saying "Master, I have diligently studied the matter, and now understand that objects are truly a poor man's closures." Qc Na responded by hitting Anton with his stick, saying "When will you learn? Closures are a poor man's object." At that moment, Anton became enlightened. http://people.csail.mit.edu/gregs/ll1-discuss-archive-html/msg03277.html