LOG6306 : Études empiriques sur les patrons logiciels

Yann-Gaël Guéhéneuc

Recurring Course – Well-known Computer Scientists

Département de génie informatique et de génie logiciel École Polytechnique de Montréal © Guéhéneuc, 2012 Why Is It Important? (1/2)

 Those who cannot remember the past are condemned to repeat it. – By George Santayana – Life of Reason, Reason in Common Sense, Scribner's, 1905, page 284

2/52 Why Is It Important? (2/2)

 Pythagoras theorem  Euclid’s theorem  Intercept theorem or Thales’ theorem  …

 You know the Nobel Prizes… … do you know the Turing Awards?

3/52 Some Known Computer Scientists

 Frances E. Allen  Grady Booch  Frederick Brooks  Ole -Johan Dahl et Kristen Nygaard  Erich Gamma  Grace Murray Hopper  Manny Lehman  Barbara Liskov  John McCarthy  Dave Parnas  Edward Yourdon 4/52 Frances E. Allen

 Frances E. Allen Frances E. Allen – Born on the 4th of August, 1932 *1932 – Pioneer of optimising compilation, code optimisation, and parallelisation

AWC Augusta Ada Lovelace Award en 2002 ACM Turing Award en 2006

– Cf. http://en.wikipedia.org/wiki/Frances_E._Allen 5/52 Frances E. Allen

 Before 1966 – Since the 1930s • Programmable computers – Since the 1950s • First compilers by Grace Murray Hopper • Programming languages – FORTRAN: first complete compiler – COBOL: first programming language compiled for different computer architectures (UNIVAC II et RCA 501)

6/52 Frances E. Allen

 Before 1966 – In 1955 • Context-free grammar invented by Noam Chomsky – In 1966 • LR Parsing invented by Donald Knuth

7/52 Frances E. Allen

 In 1966 – Program Optimization • Use of graphs to describe programs and to allow their optimisations  In 1970 – Control Flow Analysis et A Basis for Program Optimization • Intervals for control-flow analyses  In 1974 – Interprocedural data flow analysis • Interprocedural analyses of whole programs 8/52 Grady Booch

 Grady Booch Grady Booch – Born 27 February 1955 *1955 – Father of the UML with Jacobson et Rumbaugh

Stevens Award in 2003

– Cf. http://en.wikipedia.org/wiki/Grady_Booch

9/52 Grady Booch

 UML – Context

10/52 Grady Booch

– Three Amigos and their methods • Grady Booch, – Booch Method (design) • Ivar Jacobson – Object Oriented Engineering, OOSE (use cases) • James Rumbaugh – Object Modeling Technique, OMT (analysis) • Rational Software Corporation

– UML

11/52 Frederick Brooks

 Frederick Brooks Frederick Brooks – Born 19 April 1931 *1931 – Father of Brooks’ Law

– IEEE J. von Neumann Medal in 1993 – ACM Turing Award in 1999

– Cf. http://en.wikipedia.org/wiki/Fred_Brooks

12/52 Frederick Brooks

 Principle of Brooks’ Law – Context • 1956–1964 – Manager of the IBM OS/360 development project – Delays in the delivery – Book • The Mythical Man-Month: Essays on – Principle • Adding manpower to a late software project makes it later 13/52 Frederick Brooks

– Rationale • It takes some time for the people added to a project to become productive. Brooks calls this the "ramp up" time. New workers must first become educated about the work that has preceded them; also integrate with a team composed of multiple engineers who must educate the new worker in their area of expertise in the code base, day by day • Communication overheads increase as the number of people increases. The number of different communication channels increases along with the square of the number of people 14/52 Frederick Brooks

– Comments, solutions • Brooks' Law applies to projects that are already late • The quantity, quality and role of the people added to the project also must be taken into consideration • Good management and development practices also help to minimize the impact of Brooks' Law • Rather than depending on heroes to carry the day with extraordinary efforts, Wiegers argues that a team of ordinarily-skilled individuals can repeatedly deliver timely results in the right work environment

15/52 Frederick Brooks

– Critics “How to quadruple your productivity with an army of student interns”

• Tolerate a little crowding • Locate next to a deep pool of hackers • Know who the best people are and only hire them • Pay well • Divide tasks to be as loosely-coupled as possible • Design your intern projects in advance

16/52 Dahl–Nygaard

 Ole-Johan Dahl

Ole-Johan Dahl – Born 12 October 1931, †29 June 2002 *1931 †2002 – Co-inventor of the object-oriented paradigm

– ACM Turing Award in 2001 – IEEE J. von Neumann in 2002

– Cf. http://www.olejohandahl.info/ – Cf. http://en.wikipedia.org/wiki/Ole-Johan_Dahl 17/52 Dahl–Nygaard

 Kristen Nygaard

Kristen Nygaard – Born 27 August 1926, †10 August 2002 *1926 †2002 – Co-inventor of the object-oriented paradigm

– ACM Turing Award in 2001 – IEEE J. von Neumann in 2002

– Cf. http://www.ifi.uio.no/in_memoriam_kristen/ – Cf. http://en.wikipedia.org/wiki/Kristen_Nygaard 18/52 Dahl–Nygaard

 Object-oriented paradigm – Context • 1961 – Algol imperative programming

– Classes, objects, encapsulation, inheritance, polymorphism • Simula I • Simula 67

19/52 Dahl–Nygaard

 Object-oriented programming – Smalltalk • Xerox Parc, 1970–1983 – GUI – Icons – WYSIWYG – Mouse (cf. Stanford Research Institute)

• Dynamic typing • Reflection

• Garbage collection 20/52 Dahl–Nygaard

 Object-oriented programming – C++ • AT&T Bell Labs • Bjarne Stroustrup • 1980

• Static typing • Multiple inheritance

• Cf. http://www.approximity.com/ruby/ Comparison_rb_st_m_java.html 21/52 Dahl–Nygaard

 Object-oriented programming – Oberon • ETH Zurich • Niklaus Wirth • 1986

• Static typing • Garbage collection • Array bounds checking

22/52 Erich Gamma

 Erich Gamma Erich Gamma *1961 – Born 1961 – Father of the patterns

Dahl-Nygaard Prizes in 2006

– Cf. http://en.wikipedia.org/wiki/Erich_Gamma – Cf. http://c2.com/cgi/wiki?ErichGamma

23/52 Erich Gamma

 Software design patterns – Context • 1977 et 1979 – Christopher Alexander – A Pattern Language: Towns, Buildings, Construction and the idea of generative patterns – The Timeless Way of Building and the idea of perfection in architecture • 1990 – Object-oriented programs are becoming mainstream

24/52 Erich Gamma

 A Pattern Language: Towns, Buildings, Construction – 253 patterns – Generative grammar – « At the core... is the idea that people should design for themselves their own houses, streets and communities. This idea... comes simply from the observation that most of the wonderful places of the world were not made by architects but by the people »  Design Patterns: Elements of Reusable Object- Oriented Software – 23 patterns – Not a language? – « Dynamic, highly parameterized software is harder to understand and build than more static software » 25/52 Erich Gamma

 Design Patterns: Elements of Reusable Object-Oriented Software – Dahl-Nygaard Prizes à • Ralph Johnson • Richard Helm • Erich Gamma • † John Vlissides

26/52 Grace Murray Hopper

 Grace Murray Hopper (rear admiral) *1906 †1992 – Born the 9th of December, 1906, died the 1st of January, 1992 – Mother of the first compiler, of the term “debugging”, of COBOL and of standards

Defense Distinguished Service Medal in the USA in 1986

– Cf. http://en.wikipedia.org/wiki/Grace_Hopper 27/52 Grace Murray Hopper

 1944 – WWII is almost over – Computers showed their usefulness • Dehomag D11 (Germany/USA, 1930s): handling of identify cards • Zuse Z3 (Germany, 1941): flutter (dynamic aeroelasticity of wings) • Colossus Mark 1 (Grande Bretagne, 1943): decoding of messages • Harvard Mark I (USA, 1944): production of calculus tables for the Navy 28/52 Grace Murray Hopper

 Principle of the first computers – Electromechanical or electromagnetic relays – Two active relays make a third relay active • Relays “3” et “6” make relay “9” active for a sum

1947

29/52 Grace Murray Hopper

 1950 – Computers become programmable with higher- level languages than microcode or assembly • UNIVAC I: census • A-0 (Arithmetic Language version 0) • Loader or linker more than a compiler  1954 – B-0 (Business Language version 0) also known as FLOW-MATIC

30/52 Grace Murray Hopper

 1959 – Conference CODASYL (Conference on Data Systems Languages) – COBOL as successor of FLOW-MATIC – Close to English

 1970s – Advocated standards tests for programming languages, FORTRAN in particular 31/52 Manny Lehman

 Meir M. « Manny » Lehman

Manny Lehman – Died 29 December 2010 *1925 †2010 – Father of the laws of software evolution

Stevens Award in 2003

– Cf. http://www.doc.ic.ac.uk/news/archive/story/ manny-lehman – Cf. http://www.ieeeghn.org/wiki/index.php/Oral- History:Meir_Lehman 32/52 Manny Lehman

 Laws of software evolution – Context • 1974 – IBM OS/360 et OS/370 • Types of programs – S: can be formally specified – P: follow an iterative development process – E: are embedded in our environment

33/52 Manny Lehman

– Eight laws 1. Continuing change : E-type systems must be continually adapted or they become progressively less satisfactory 2. Increasing complexity : As an E-type system evolves its complexity increases unless work is done to maintain or reduce it 3. Self regulation : E-type system evolution process is self regulating with distribution of product and process measures close to normal 4. Conservation of organisational stability : The average effective global activity rate in an evolving E-type system is invariant over product lifetime

34/52 Manny Lehman

– Eight laws 5. Conservation of familiarity : As an E-type system evolves all associated with it must maintain mastery of its content and behaviour to achieve satisfactory evolution. The average incremental growth remains invariant as the system evolves 6. Continuing growth : The functional content of E-type systems must be continually increased to maintain user satisfaction over their lifetime 7. Declining quality : The quality of E-type systems will appear to be declining unless they are rigorously maintained and adapted to operational environment changes 8. Feedback system: E-type evolution processes constitute multi-level, multi-loop, multi-agent feedback systems and must be treated as such to achieve significant improvement over 35/52 any reasonable base Barbara Liskov

 Barbara Liskov

Barbara Liskov – Born 7 November 1939 *1939 – Mother of the Liskov’s substitution principle

– IEEE J. von Neumann Medal in 2004 – ACM Turing Award in 2008

– Cf. http://en.wikipedia.org/wiki/ Liskov_substitution_principle 36/52 Barbara Liskov

 Liskov’s substitution principle – Context • 1987 – Object -oriented programming is increasingly popular

– Principle • Let q(x) be a property provable about objects x of type T. Then q(y) should be true for objects y of type S where S is a subtype of T

37/52 Barbara Liskov

– Principle • Behavioural sub-typing is different and stronger than the concept of sub-typing in type theory • In type theory – Contravariance of parameters: a parameter of type T can accept object of type S, where S is a sub-type of T – Covariance of return type: the return type can be “enlarged” from T to S • In addition – Pre-conditions cannot be stronger in a sub-type – Post-conditions cannot be weaker in a sub-type – The sub-type S must preserve the invariants of type T 38/52 Barbara Liskov

– Implementation in Java • Java < 1.5 – Redefinition /* Mother class */ public T foo(String a, String b) {...} /* Daughter class */ public T foo(String a, String b) {...} – Overriding /* Mother class */ public T foo(String a, String b) {...} /* Daughter class */ public T foo(String a, Integer c) {...} • Java > 1.5 – Redefinition /* Mother class */ public T foo(String a, String b) {...} /* Daughter class */ public S foo(String a, String b) {...}

39/52 John McCarthy

 John McCarthy

– Born the 4th of September, 1927 John McCarthy *1927 †2011 – Died on the 24 October, 2011 – Father of artificial intelligence, LISP, contributor to time - sharing computing, inventor of « SaaS »

ACM Turing Award in 1971 National Medal of Science in the USA in 1991

– Cf. http://en.wikipedia.org/wiki/John_McCarthy_(computer_scientist)

40/52 John McCarthy

 Artificial intelligence, 1956 – Champion of logic programming – Collaboration with Marvin Minsky

 Inventor of LISP, 1960 – Recursive Functions of Symbolic Expressions and Their Computation by Machine, Part I, 1960 – Lambda calculus – Garbage collection 41/52 John McCarthy

 Time-sharing systems DEC PDP-1, c. 1960 – Multiprogramming and multitasking – Most important change of paradigm in in 1970 • Sharing of resources to avoid “waiting computation time (cycles)” – SaaS • Software as a Service • Architecture/engineering based on services

42/52 Dave Parnas

 Dave Parnas

Dave Parnas – Born 10 February 1941 *1941 – Father of the criteria to divide a program into modules in a modular design

IEEE Computer Society 60th Anniversary Award in 2007

– Cf. http://en.wikipedia.org/wiki/David_Parnas 43/52 Dave Parnas

 Modular design – Context • 1972 – Procedural and object programming languages – Flow – Decomposition of programs in modules, classes…

44/52 Dave Parnas

– Criteria • “[I]t is almost always incorrect to begin the decomposition of a system into modules on the basis of a flowchart. We propose instead that one begins with a list of difficult design decisions or design decisions which are likely to change. Each module is then designed to hide such a decision from the others ”

• Information hiding = Encapsulation

45/52 Dave Parnas

– Rewriting of the criteria in terms of • Cohesion • Coupling

• Concepts « invented » by in 1968 and published in 1972 in W. Stevens, G. Myers, L. Constantine, "Structured Design", IBM Systems Journal, 13 (2), 115-139, 1974.

• A module must have a strong cohesion and be weakly coupled to other modules 46/52 Edward Yourdon

 Edward Yourdon Edward Yourdon – Born 30 April 1944 *1944 – “Inventor” of seven types of cohesion

– Cf. http://en.wikipedia.org/wiki/Edward_Yourdon

47/52 Edward Yourdon

 Modular design – Context • 1972 – Procedural and object programming languages – Flow diagrams – Decomposition of programs in modules, classes… • 1987 – Object-oriented programming is increasingly popular

48/52 Edward Yourdon

– Cohesion criteria 1. Accidental : the weakest cohesion in which their is no links between methods or their link is based on a useless criteria – Utility classes 2. Logic : when methods are linked logically by one or more common criteria – All classes pertaining to I/O, to user interactions... 3. Temporal : when methods must be called within a common time-frame – A method and the method called in on of its catch statement, and so on 49/52 Edward Yourdon

– Cohesion criteria 4. Procedural : when methods must be called in a specific order – One method that check user rights and one method that opens a file subsequently 5. Communicational : when methods process the dame set of data – All classes pertaining to dates...

50/52 Edward Yourdon

– Cohesion criteria 6. Sequential : when methods that process the same set of data must be called in a specific order – A parser: inputs to one class are the outputs of another 7. Functional : highest level of cohesion, when a class or module is dedicated to a unique task – Classes that contribute in implementing some requirements

51/52 To Be Continued

 ACM A. M. Turing Award – Cf. http://awards.acm.org/homepage.cfm? awd=140  AITO Dahl -Nygaard Prize – http://www.aito.org/Dahl-Nygaard/  IEEE J. von Neumann Medal – Cf. http://www.ieee.org/about/awards/bios/ vonneumann_recipients.html

52/52