This document discusses the history of computing and programming languages. It notes that many revolutionary ideas from the past are not yet common, such as treating code as objects and dynamic programs that can change as they run. The document advocates learning from the past by reading seminal works and learning languages like Lisp, Smalltalk, and Self to challenge current assumptions. Understanding our history can help us avoid reinventing solutions and using better approaches.
23. 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
30. What do they all have in common?
Revolutionary
Computer as a tool to augment human
understanding
Direct manipulation/Imm. Feedback
Simplicity
Consistency
Concretenees
31. Let’s see some stuff that is not
common YET, even thought it
is old…
33. 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
34. 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
35. 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!!??
36. 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!
37. How to remove “repeated code”
Copy the repeated code to “some
place” (method, class, etc)
Parameterize what changes
NAME IT!!
38. Copy repeated code
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;
class Collection<T> {
public Collection<T> <<NAME>> {
List<T> selected = new ArrayList<T> ();
for (T anObject: this)
if ( )
selected.add (anObject);
return selected: }
39. 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?
40. We need an abstraction to represent
code!
(remember, code is not text!)
closure…
41. 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;
42. 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;
43. 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() )
46. Mete-Conclusion
Data is an Object
Code is an Object
An Object is a “superior”
concept that unifies data and
code
47. 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?
54. We have to learn our history
We have to be open to challenge the
status quo
Do not accept new things as better
things just because they are new
Do not be an uncritical consumer!
55. Must Read
The early History of Smalltalk
Lambda the Ultimate …
Structure and Interpreteation of Computer
Programs
Smalltalk 80
Lisp 1.5 user manual
Self papers
ACM Preccedings on HOLP
…
56. Must Watch
Alan Kay on:
Computer Revolution has not happened yet
Normal Considered Harmfull
The Dynabook: Past, Present and Future
… and more!
Structure and Interpreteation of
Computer Programs
Bret Victor videos
Self movie