Avoiding to Reinvent the flat tire

Post on 24-May-2015

552 views 1 download

Tags:

description

How knowing our past will help us to avoid "reinventing the flat tire"

Transcript of Avoiding to Reinvent the flat tire

agile software development & services

Avoiding to re-invent the flat tire

Hernán WilkinsonTwitter: @HernanWilkinson

www.10pines.com

Alan Kay“Our profession is like a pop culture”

…“We don’t know our history”

The world “we live” in … ?

The world “we live” in … ?

The world “we live” in … ?

The world “we live” in … ?

Bret Victor - Thinking the unthinkable

How do we think about computing?How do we think about its tools?

Computing

Alan Turing Alonzo Church

Computing

Machine vs. Algebra

Programming Languages

Algol-60, C, C++, Java, C#...

Lisp, Smalltalk, Scheme, Self, Ruby, Clojure…

Lisp

Data = Code Lambda Functions Jit GC (Reference Counting) Meta-Circularity!!

Year?

VideoSketchpad

Sketchpad

Ivan SutherlandVisual ProgrammingConstrains Oriented

Year?

Simula 67

Software as a Model! Organization of Knowledge History tip:

Goto Considered Harmfull – 68 Structured Programming – 71

(using Simula 67 as prog. lang.!!)

VideoMother all Demos

The mother of all demos

Douglas EngelbartHuman Augmentation MouseDirect Manipulation

Year?

Smalltalk

Xerox Parc - LRGAlan KayDan IngallsAdele Goldberg

Smalltalk

Lisp

Simula 67

Flex Machine

DynaBook

Augment ChildrenComprehention

Smalltalk(72,74,76,78,80)

GUI - IDE

Object OrientedVM

http://www.youtube.com/watch?v=AuXCc7WSczM

Alan Kay"The best way to predict the future is to invent it" "I invented the term Object-Oriented and I can

tell you I did not have C++ in mind.“"Java and C++ make you think that the new

ideas are like the old ones. Java is the most distressing thing to hit computing since MS-DOS.“

http://video.google.com/videoplay?docid=-2950949730059754521

Smalltalk

VideoSmalltalk Examples

VideoSteve Jobs - Parc

Scheme

Closure

Lambda: The Ultimate …(http://library.readscheme.org/page1.html)

Year?

Self

David Ungar – Generation GC, PIC, etc.Randall Smith

What do they all have in common?

RevolutionaryComputer as a tool to augment human

understandingDirect manipulation/Imm. FeedbackSimplicityConsistencyConcretenees

Let’s see some stuff that is not common YET, even thought it

is old…

Current Problems – Example 1

We don’t see code as objects

List<Customer> selectedCustomers = new ArrayList<Customer> ();

for (Customer customer: customers)

if (customer.nameStarsWith(“H”))

selectedCustomers.add (customer);

return selectedCustomers;

Looking for customers starting with H

List<Customer> selectedCustomers = new ArrayList<Customer> ();

for (Customer customer: customers)

if (customer.nameStarsWith(“H”))

selectedCustomers.add (customer);

return selectedCustomers;

List<Account> selectedAccounts = new ArrayList<Account> ();

for (Account account: accounts)

if (account.isOverdraw())

selectedAccounts.add(account);

return selectedAccount;

Looking for overdraw accounts

List<Customer> selectedCustomers = new ArrayList<Customer> ();

for (Customer customer: customers)

if (customer.nameStarsWith(“H”))

selectedCustomers.add (customer);

return selectedCustomers;

List<Account> selectedAccounts = new ArrayList<Account> ();

for (Account account: accounts)

if (account.isOverdraw())

selectedAccounts.add(account);

return selectedAccount;

WHAT’S THE PROBLEM!!??

List<Customer> selectedCustomers = new ArrayList<Customer> (…);

for (Customer customer: customers)

if (customer.nameStarsWith(“H”))

selectedCustomers.add (customer);

return selectedCustomers;

List<Account> selectedAccounts = new ArrayList<Account> ();

for (Account account: accounts)

if (account.isOverdraw())

selectedAccounts.add(account);

return selectedAccount;

We have repeated code!

How to remove “repeated code”

Copy the repeated code to “some place” (method, class, etc)

Parameterize what changes NAME IT!!

Copy repeated codeList<Customer> selectedCustomers = new ArrayList<Customer> ();

for (Customer customer: customers)

if (customer.nameStarsWith(“H”))

selectedCustomers.add(customer);

return selectedCustomers;

List<Account> selectedAccounts = new ArrayList<Account> ();

for (Account account: accounts)

if (account.isOverdraw())

selectedAccounts.add(account);

return selectedAccount;

class Collection<T> {

public Collection<T> <<NAME>> {

List<T> selected = new ArrayList<T> ();

for (T anObject: this)

if ( )

selected.add (anObject);

return selected: }

Parameterize what changes

List<Customer> selectedCustomers = new ArrayList<Customer> ();

for (Customer customer: customers)

if (customer.nameStarsWith(“H”))

selectedCustomers.add (customer);

return selectedCustomers;

List<Account> selectedAccounts = new ArrayList<Account> ();

for (Account account: accounts)

if (account.isOverdraw())

selectedAccounts.add(account);

return selectedAccount;

How do we do it?

We need an abstraction to represent code!(remember, code is not text!)

closure…

Parameterize…

class Collection<T> {public Collection<T> <<NAME>> (Closure aClosure) {

List<T> selected = new ArrayList<T> ();

for (T anObject: this)

if (aClosure.value(anObject) )

selected.add (anObject);

return selected:}

List<Customer> selectedCustomers = new ArrayList<Customer> ();

for (Customer customer: customers)

if (customer.nameStarsWith(“H”))

selectedCustomers.add(customer);

return selectedCustomers;

List<Account> selectedAccounts = new ArrayList<Account> ();

for (Account account: accounts)

if (account.isOverdraw())

selectedAccounts.add(account);

return selectedAccount;

NAME IT!

class Collection<T> {public Collection<T> select (Closure aClosure) {

List<T> selected = new ArrayList<T> ();

for (T anObject: this)

if (aClosure.value(anObject) )

selected.add (anObject);

return selected:}

The most difficult part because it means that we understood the repeated code

meaning

List<Customer> selectedCustomers = new ArrayList<Customer> ();

for (Customer customer: customers)

if (customer.nameStarsWith(“H”))

selectedCustomers.add(customer);

return selectedCustomers;

List<Account> selectedAccounts = new ArrayList<Account> ();

for (Account account: accounts)

if (account.isOverdraw())

selectedAccounts.add(account);

return selectedAccount;

List<Customer> selectedCustomers = new ArrayList<Customer> ();

for (Customer customer: customers)

if (customer.nameStarsWith(“H”))

selectedCustomers.add (customer);

return selectedCustomers;

List<Account> selectedAccounts = new ArrayList<Account> ();

for (Account account: accounts)

if (account.isOverdraw())

selectedAccounts.add(account);

return selectedAccount;

cutomers.select( customer => customer.nameStartsWith(“H”) )

accounts.select( account => account.isOverdraw() )

Meta-Conclusion

Object = ¿Data + Code?

Meta-Conclusion

Object = ¿Data + Code?

If you think so, you don´t understand OO yet

Mete-Conclusion

Data is an Object

Code is an Object

An Object is a “superior” concept that unifies data and code

Hamming / Closure

If there are certain objects that can not be created in some languages …

… and given the solutions provided by some programming languages…

The statement: “There are design solutions that are unthinkable in some

programming languages”

¿Does it surprise you?

Current Problems – Example 2

Programs don’t change while running

Current Problems – Example 3

We still think that code is text

Current Problems – Example 4

We don’t use objects all the way downWe still using text as main communication

media

So… Why is it not common???

The right question is:So… Why is it not common

YET???

Conclusion

If you don’t want to re-invent the wheel…

If you don’t want to use a flat tire…

We have to learn our historyWe have to be open to challenge the

status quoDo not accept new things as better

things just because they are newDo not be an uncritical consumer!

Must Read

The early History of Smalltalk Lambda the Ultimate …Structure and Interpreteation of Computer

ProgramsSmalltalk 80 Lisp 1.5 user manualSelf papersACM Preccedings on HOLP…

Must Watch

Alan Kay on:Computer Revolution has not happened yetNormal Considered HarmfullThe Dynabook: Past, Present and Future… and more!

Structure and Interpreteation of Computer Programs

Bret Victor videosSelf movie

Must Learn

Lisp/Scheme (Dr.Racket/Clojure) not cdr, car, etc. but apply/eval

SmalltalkSelf

Questions?

agile software development & services

Muchas gracias!

info@10pines.comwww.10Pines.com

twitter: @10Pines

Argentina

Tel.: +54 (11) 6091-3125Alem 693, 5BBuenos Aires