”Life is too short for imperative programming”
description
Transcript of ”Life is too short for imperative programming”
![Page 1: ”Life is too short for imperative programming”](https://reader035.fdocuments.in/reader035/viewer/2022062520/5681592d550346895dc65873/html5/thumbnails/1.jpg)
![Page 2: ”Life is too short for imperative programming”](https://reader035.fdocuments.in/reader035/viewer/2022062520/5681592d550346895dc65873/html5/thumbnails/2.jpg)
”Life is too short for imperative programming”
John Hughes
![Page 3: ”Life is too short for imperative programming”](https://reader035.fdocuments.in/reader035/viewer/2022062520/5681592d550346895dc65873/html5/thumbnails/3.jpg)
Sorting in Haskell
sort [] = []sort (x:xs) = sort [y | y <- xs, y<x] ++ [x] ++ sort [y | y <- xs, y>=x]
![Page 4: ”Life is too short for imperative programming”](https://reader035.fdocuments.in/reader035/viewer/2022062520/5681592d550346895dc65873/html5/thumbnails/4.jpg)
Sorting in Pascal
![Page 5: ”Life is too short for imperative programming”](https://reader035.fdocuments.in/reader035/viewer/2022062520/5681592d550346895dc65873/html5/thumbnails/5.jpg)
Sorting in Pascal, page 2
![Page 6: ”Life is too short for imperative programming”](https://reader035.fdocuments.in/reader035/viewer/2022062520/5681592d550346895dc65873/html5/thumbnails/6.jpg)
Sorting in Pascal, page 3
![Page 7: ”Life is too short for imperative programming”](https://reader035.fdocuments.in/reader035/viewer/2022062520/5681592d550346895dc65873/html5/thumbnails/7.jpg)
Sorting in Javaprivate void quicksort(int low, int high) {
int i = low, j = high;int pivot = numbers[low + (high-low)/2];while (i <= j) {
while (numbers[i] < pivot) {i++;
}while (numbers[j] > pivot) {
j--;}if (i <= j) {
exchange(i, j);i++;j--;
}}
![Page 8: ”Life is too short for imperative programming”](https://reader035.fdocuments.in/reader035/viewer/2022062520/5681592d550346895dc65873/html5/thumbnails/8.jpg)
Sorting in Java, page 2
if (low < j)quicksort(low, j);
if (i < high)quicksort(i, high);
}
private void exchange(int i, int j) {
int temp = numbers[i];numbers[i] = numbers[j];numbers[j] = temp;
}
![Page 9: ”Life is too short for imperative programming”](https://reader035.fdocuments.in/reader035/viewer/2022062520/5681592d550346895dc65873/html5/thumbnails/9.jpg)
Software Crisis, 1968—today
• Software project outcomes
Cancelled
>2x costoverrun
Success
![Page 10: ”Life is too short for imperative programming”](https://reader035.fdocuments.in/reader035/viewer/2022062520/5681592d550346895dc65873/html5/thumbnails/10.jpg)
In Large Companies
Success Failure Implemented feature Not implemented
![Page 11: ”Life is too short for imperative programming”](https://reader035.fdocuments.in/reader035/viewer/2022062520/5681592d550346895dc65873/html5/thumbnails/11.jpg)
The Von Neumann Bottleneck
![Page 12: ”Life is too short for imperative programming”](https://reader035.fdocuments.in/reader035/viewer/2022062520/5681592d550346895dc65873/html5/thumbnails/12.jpg)
![Page 13: ”Life is too short for imperative programming”](https://reader035.fdocuments.in/reader035/viewer/2022062520/5681592d550346895dc65873/html5/thumbnails/13.jpg)
Technology adoption life cycle
![Page 14: ”Life is too short for imperative programming”](https://reader035.fdocuments.in/reader035/viewer/2022062520/5681592d550346895dc65873/html5/thumbnails/14.jpg)
Technology adoption life cycle
![Page 15: ”Life is too short for imperative programming”](https://reader035.fdocuments.in/reader035/viewer/2022062520/5681592d550346895dc65873/html5/thumbnails/15.jpg)
Technology adoption life cycle
![Page 16: ”Life is too short for imperative programming”](https://reader035.fdocuments.in/reader035/viewer/2022062520/5681592d550346895dc65873/html5/thumbnails/16.jpg)
The Erlang Story
• 1986—Erlang emerges at Ericsson– Functional language– Extra support for concurrency & fault
tolerance
• Early 1990s—small products• 1996
– Open Telecoms Platform (higher-order functions for robust telecom systems)
– AXD 301 project starts
![Page 17: ”Life is too short for imperative programming”](https://reader035.fdocuments.in/reader035/viewer/2022062520/5681592d550346895dc65873/html5/thumbnails/17.jpg)
The AXD 301
• ATM switch (telephone backbone)
• Born out of a failed project!
• 1,5 MLOC Erlang• Seven nines reliability• 4-10x better
productivity, quality
![Page 18: ”Life is too short for imperative programming”](https://reader035.fdocuments.in/reader035/viewer/2022062520/5681592d550346895dc65873/html5/thumbnails/18.jpg)
Erlang Story II
• 1998—Erlang banned for new projects
• 1998—Open source Erlang
• 1998—Bluetail– Jane Walerud VD– Mail robustifier, Web prioritizer
![Page 19: ”Life is too short for imperative programming”](https://reader035.fdocuments.in/reader035/viewer/2022062520/5681592d550346895dc65873/html5/thumbnails/19.jpg)
SSL Accelerator
• Alteon WebSystems' SSL Accelerator offers phenomenal performance, management and scalability.– Network Computing
![Page 20: ”Life is too short for imperative programming”](https://reader035.fdocuments.in/reader035/viewer/2022062520/5681592d550346895dc65873/html5/thumbnails/20.jpg)
Kreditor
Kreditor
Order 100:-
Order details
97:-
invoice
100:-
Fem år har gått och vi har vuxit till ett ambitiöst och kreativt gäng på
350 stycken. Vi har blivit utsedda till Årets företag -07 (skryt), ökat omsättningen med 13 570 %
och lyckats bli marknadsledande i Norden (fakta).
![Page 21: ”Life is too short for imperative programming”](https://reader035.fdocuments.in/reader035/viewer/2022062520/5681592d550346895dc65873/html5/thumbnails/21.jpg)
• Founded May 2006
• Selling… QuickCheck!– Key feature: simplifies failing tests– Extensions for testing stateful systems
![Page 22: ”Life is too short for imperative programming”](https://reader035.fdocuments.in/reader035/viewer/2022062520/5681592d550346895dc65873/html5/thumbnails/22.jpg)
Media Proxy
• Multimedia IP-telephony (IMS)
• Connects calls across a firewall
• Test adding and removing callers from a call
AddAdd AddAdd SubSub AddAdd Sub Sub AddAdd SubSub
Call Full
![Page 23: ”Life is too short for imperative programming”](https://reader035.fdocuments.in/reader035/viewer/2022062520/5681592d550346895dc65873/html5/thumbnails/23.jpg)
OK
3G Radio Base Station
Setup
Setup
OK
Reject
![Page 24: ”Life is too short for imperative programming”](https://reader035.fdocuments.in/reader035/viewer/2022062520/5681592d550346895dc65873/html5/thumbnails/24.jpg)
Database bug
premature eof
OpenOpen OpenOpenCloseClose
InsertInsert
InsertInsert
Lookup
Lookup
FindFind
"We know there is a lurking bug somewhere in the code. We have got 'bad object' and 'premature eof' every other month the last year. We have not been able to track the bug down since the file is repaired automatically next time it is opened.“Tobbe Törnqvist, Klarna, 2007
![Page 25: ”Life is too short for imperative programming”](https://reader035.fdocuments.in/reader035/viewer/2022062520/5681592d550346895dc65873/html5/thumbnails/25.jpg)
Most Influential ICFP Paper Award
![Page 26: ”Life is too short for imperative programming”](https://reader035.fdocuments.in/reader035/viewer/2022062520/5681592d550346895dc65873/html5/thumbnails/26.jpg)
Erlang in Ericsson
• 1998—BANNED!
• 2007—Recommended for ”complex state machines with high performance requirements”
• 2010—recruiting Erlang programmers in Göteborg
![Page 27: ”Life is too short for imperative programming”](https://reader035.fdocuments.in/reader035/viewer/2022062520/5681592d550346895dc65873/html5/thumbnails/27.jpg)
• Derivatives trading in New York
10 Microsoft shares
Option to buy ●for $100 anytime
In 2007
Option to sell ●for $10 in Nov 2006
![Page 28: ”Life is too short for imperative programming”](https://reader035.fdocuments.in/reader035/viewer/2022062520/5681592d550346895dc65873/html5/thumbnails/28.jpg)
Financial Contracts in Haskell
anytime :: Contract -> Contract-- Acquire the underlying contract at-- any time before it expires (but-- you must acquire it)
The option to acquire 10 Microsoft shares, for $100, anytime between t1 and t2 years from now
golden_handcuff = anytime shares
shares = zero `or` (scaleK -100 (one Dollar) `and` scaleK 10 (one MSShare))
anytime: Choose when
MS shares are a
“currency”
or: Choose whether
![Page 29: ”Life is too short for imperative programming”](https://reader035.fdocuments.in/reader035/viewer/2022062520/5681592d550346895dc65873/html5/thumbnails/29.jpg)
New Approach
C++ plugins
Haskell contract models
![Page 30: ”Life is too short for imperative programming”](https://reader035.fdocuments.in/reader035/viewer/2022062520/5681592d550346895dc65873/html5/thumbnails/30.jpg)
• ”Functional programming on Wall Street”– Proprietary trading– >100 people– Offices in New York, London, Tokyo– OCaml primary development language
![Page 31: ”Life is too short for imperative programming”](https://reader035.fdocuments.in/reader035/viewer/2022062520/5681592d550346895dc65873/html5/thumbnails/31.jpg)
![Page 32: ”Life is too short for imperative programming”](https://reader035.fdocuments.in/reader035/viewer/2022062520/5681592d550346895dc65873/html5/thumbnails/32.jpg)
Where are we?
![Page 33: ”Life is too short for imperative programming”](https://reader035.fdocuments.in/reader035/viewer/2022062520/5681592d550346895dc65873/html5/thumbnails/33.jpg)
TIOBE Programming Language Index
PositionOct 2010
PositionOct 2009
Programming Language
RatingsOct 2010
Delta Oct 2009
1 1 Java 18.166% -0.48%
2 2 C 17.177% +0.33%
… … … … …
Category Ratings Oct 2010 Delta Oct 2009
Object-Oriented Languages
55.9% +2.5%
Procedural Languages
38.9% -3.4%
Functional Languages
3.5% +0.6%
Logical Languages 1.6% +0.2%
![Page 34: ”Life is too short for imperative programming”](https://reader035.fdocuments.in/reader035/viewer/2022062520/5681592d550346895dc65873/html5/thumbnails/34.jpg)
The Multicore Opportunity
4 cores 64 cores
![Page 35: ”Life is too short for imperative programming”](https://reader035.fdocuments.in/reader035/viewer/2022062520/5681592d550346895dc65873/html5/thumbnails/35.jpg)
• Stable compiler and selected high quality libraries
• Installers for multiple platforms
• For serious developers
• 200,000 downloads in 4 months for Windows alone!
![Page 36: ”Life is too short for imperative programming”](https://reader035.fdocuments.in/reader035/viewer/2022062520/5681592d550346895dc65873/html5/thumbnails/36.jpg)
![Page 37: ”Life is too short for imperative programming”](https://reader035.fdocuments.in/reader035/viewer/2022062520/5681592d550346895dc65873/html5/thumbnails/37.jpg)
![Page 38: ”Life is too short for imperative programming”](https://reader035.fdocuments.in/reader035/viewer/2022062520/5681592d550346895dc65873/html5/thumbnails/38.jpg)
![Page 39: ”Life is too short for imperative programming”](https://reader035.fdocuments.in/reader035/viewer/2022062520/5681592d550346895dc65873/html5/thumbnails/39.jpg)
![Page 40: ”Life is too short for imperative programming”](https://reader035.fdocuments.in/reader035/viewer/2022062520/5681592d550346895dc65873/html5/thumbnails/40.jpg)
![Page 41: ”Life is too short for imperative programming”](https://reader035.fdocuments.in/reader035/viewer/2022062520/5681592d550346895dc65873/html5/thumbnails/41.jpg)
![Page 42: ”Life is too short for imperative programming”](https://reader035.fdocuments.in/reader035/viewer/2022062520/5681592d550346895dc65873/html5/thumbnails/42.jpg)
![Page 43: ”Life is too short for imperative programming”](https://reader035.fdocuments.in/reader035/viewer/2022062520/5681592d550346895dc65873/html5/thumbnails/43.jpg)
När all världens programmerare börjar få grepp om objektorientering är det dags för nästa paradigmskifte. Med Microsoft som härförare vinner funktionella språk mark. Programmerare får räkna med att lära om.
![Page 44: ”Life is too short for imperative programming”](https://reader035.fdocuments.in/reader035/viewer/2022062520/5681592d550346895dc65873/html5/thumbnails/44.jpg)
First Intel dual core released
![Page 45: ”Life is too short for imperative programming”](https://reader035.fdocuments.in/reader035/viewer/2022062520/5681592d550346895dc65873/html5/thumbnails/45.jpg)
• 60 people in 2010
• x2 every year!
• Customers– Telecom– Internet services– Financial services– Automotive– …
![Page 46: ”Life is too short for imperative programming”](https://reader035.fdocuments.in/reader035/viewer/2022062520/5681592d550346895dc65873/html5/thumbnails/46.jpg)
![Page 47: ”Life is too short for imperative programming”](https://reader035.fdocuments.in/reader035/viewer/2022062520/5681592d550346895dc65873/html5/thumbnails/47.jpg)
![Page 48: ”Life is too short for imperative programming”](https://reader035.fdocuments.in/reader035/viewer/2022062520/5681592d550346895dc65873/html5/thumbnails/48.jpg)
Functional Programming on the Java Virtual Machine
![Page 49: ”Life is too short for imperative programming”](https://reader035.fdocuments.in/reader035/viewer/2022062520/5681592d550346895dc65873/html5/thumbnails/49.jpg)
![Page 50: ”Life is too short for imperative programming”](https://reader035.fdocuments.in/reader035/viewer/2022062520/5681592d550346895dc65873/html5/thumbnails/50.jpg)
![Page 51: ”Life is too short for imperative programming”](https://reader035.fdocuments.in/reader035/viewer/2022062520/5681592d550346895dc65873/html5/thumbnails/51.jpg)
Java and Object Orientation” one of the leading IT industry events in Europe … attracts more than 1,300 participants.”
![Page 52: ”Life is too short for imperative programming”](https://reader035.fdocuments.in/reader035/viewer/2022062520/5681592d550346895dc65873/html5/thumbnails/52.jpg)