Presented at NDC 2011 in Oslo (8th June 2011) with Anders Norås
When it comes to object–oriented software, the SOLID principles have become almost synonymous with good design practice. While every letter stands for a principle, some developers obsess over them as if there were no more to good code than these five principles. Since the introduction of SOLID many alternatives to traditional object–oriented programming have risen in popularity, suggesting that other design principles may have a role to play. In this talk Kevlin Henney and Anders Norås introduce their FLUID principles for software design.
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.
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
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
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
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