Programmation Object & Genie Logiciel

Licence Mention Informatique – L2/S4 – 2012 Programmation Object & Genie Logiciel Burkhart Wolff Département Informatique But du cours  Introduc...
1 downloads 0 Views 549KB Size
Licence Mention Informatique – L2/S4 – 2012

Programmation Object & Genie Logiciel

Burkhart Wolff Département Informatique

But du cours 

Introduction à la programmation avancé en Java (programming „in the small“, concepts du language et techniques de base pour construire des programmes 50000 loc)



Introduction au Genie Logiciel (programming „in the large“, concepts des processus de développement, de la spécification et d'analyse, techniques de base pour construire des programmes 50 M loc)

2012

B. Wolff, L2-PO&GL, Introduction

2

Mise en œuvre associée 

9 cours,



10 TD,



5 TP,



Contrôle des connaissances 



(vendredi )

1 partiel + 1 examen final

Page WEB avec tous les slides, exercises, liens bibliographiques, infos ... http://www.lri.fr/~wolff/ teach-material/2010-11/L2-POnGL/

2012

B. Wolff, L2-PO&GL, Introduction

3

Mise en œuvre associée 

C1 - 28.1, 11:15 - 13:00, [???]: Compléments de Programmation Java



C2 - 4.2, 11:15 - 13:00, [???]: Compléments sur héritage et redéfinition: covariance/contravariance, redéfinition vs surcharge, héritage vs composition etc.



C3 - 11.2, 11:15 - 13:00, [???]: Déclaration et gestion des exceptions



C4 - 18.2, 11:15 - 13:00, [???]: Polymorphisme en Java



C5 - 4.3, 11:15 - 13:00, [???]: Introduction aux "Patrons de conception" (en TD principalement via des exemples stéréotypes) Introduction Genie Logiciel Cycle de vie du logiciel et documents associés



C6 - 11.3, 11:15 - 13:00, [???]: Introduction à UML



C8 - 25.3, 11:15 - 13:00, [???]: UML: diagramme de cas d'utilisation, diagrammes de classes, notions d'invariants.



C8 - 1.4, 11:15 - 13:00, [???]: Diagrammes de séquence en analyse. Notion de scenario.



C9 - 8.4., 11:15 - 13:00, [???]: Introduction aux machines à états.



Partiel: 18.3.2011 (á confirmer) Examen: 27.5.2011 (á confirmer)

2012

B. Wolff, L2-PO&GL, Introduction

4

Overview



What is Object-Orientation ?



A Gentle Review of Java (Concepts and Syntax)  Types  Control-structures  Methods  Classes  Programs



Compléments (1)  Inheritance and Casting

2012

B. Wolff, L2-PO&GL, Introduction

5

Overview



What is Object-Orientation ?



A Gentle Review of Java (Concepts and Syntax)  Types  Control-structures  Methods  Classes  Programs



Compléments (1)  Inheritance and Casting

2012

B. Wolff, L2-PO&GL, Introduction

6

What is OO? OO ... 







... is „a particular, data-oriented view“ for modeling (see UML) and programming [instead of imperative programming, that tries to put instructions into the center of universe, or functional programming, that is centered around the idea of „functions are first class citizens“.] ... is trying to map „objects of the real world“ to data entities (=objects) of a system ... puts emphasis on data-encapsulation and interfaces turning components of a program or a model exchangeable ... lets objects have  an identity  attributes (fields)  a dynamic and (in modern languages) a static type.

2012

B. Wolff, L2-PO&GL, Introduction

7

What is OO? Objects ... 



... are a piece of encapsulated memory. They have in general a mutable state ... have  an identity  attributes (fields) which can be identities (references) of other objects (creating „object graphs“),  a dynamic and (in modern languages) a static type, (or in other words: actual type vs. apparent type)  and viewed in context of a module: a class,  which can be organized into families via sub-typing and inheritance. Objects can be implemented in any (nearly) any language !!!

2012

B. Wolff, L2-PO&GL, Introduction

8

A Hierarchy od Variants

Not a perfect example ....

Circle Rayon: float : Point  bool area:  float rotate(…)

Figures Origin: Point : Point  bool area:  float move_at(…) rotate(…) Rectangle largeur, longueur: float : Point  bool area:  float rotate(…)

Point x, y: float shift(dx, dy: float)

Triangle Side: float A1, A2: radian :  bool Aire:  float rotate(…)

Square … 2012

B. Wolff, L2-PO&GL, Introduction

9

History of OOP 

OO became popular since the early 80ies, but there is a long story of predecessors [Simula 1967]



they are not a panacea (Conception ? Test ? Correctness?)



not a concensus on all features ?   

    

2012

typed (Ada95, C++, Eiffel, Java, C#) or not typed (Smalltalk) ? simple inheritance (Ada95, Java, C#) or multiple inh. (C++) ? static (C++, C# by default) or dynamic binding (Java) of methods? Or both (C++, C#, Ada95) ? Classes: static (C++, Ada) ou dynamic (Java, C#) ? « 100% object»(Eiffel, C#) or “object oriented”(Java,C++,Ada,C#) Interfaces or abstract classes ? Packages ? Generics or not (Java ? C++ ? C# ? F# ? Scala ?)

B. Wolff, L2-PO&GL, Introduction

10

Links ... Procedural Langages

Hybrid Langages LISP (60)

Algol (60) Simula (67) Pascal (74) Ada(83)

Scheme (~70)

Smalltalk (74/80/85)

C (~70) C++ (~80)

CLOS (81)

objC (~85)

Eiffel (85) Ada(95)

Functional Langages

Self (90)

Java(~95)

C# (~98) F# (2002)

Scala (2001) 2012

ML (~80), SML, CAML (~90) HASKELL,…

B. Wolff, L2-PO&GL, Introduction

Not considered: Parallelism Scripting Languages Logical prog. PROLOG … 11

Overview



What is Object-Orientation ?



A Gentle Review of Java (Concepts and Syntax)  Types  Control-structures  Methods  Classes  Programs



Compléments (1)  Inheritance and Casting

2012

B. Wolff, L2-PO&GL, Introduction

12

Review: Types (1) 

Java is a (statically) typed language. So it has: 

Types for Built-in Operations



Class-Types (i.e. Types resulting from a Class declaration

2012

B. Wolff, L2-PO&GL, Introduction

13

Review: Types (2) Base Types

Name

Constants

Common Operators

booleans integers

boolean true false && (and) || (or) ! (not) int 132 -67 3e8 - (unary,bin.) + * / % (modulo) - - ++ > >= < >= < >= < >= < >= < >= < >= <