Encapsulation. Imperative programming abstraction via subprograms Modular programming data abstraction. TTY Ohjelmistotekniikka

Samankaltaiset tiedostot
812336A C++ -kielen perusteet,

C++11 seminaari, kevät Johannes Koskinen

7.4 Variability management

Capacity Utilization

RINNAKKAINEN OHJELMOINTI A,

SIMULINK S-funktiot. SIMULINK S-funktiot

Ohjelmointikielet ja -paradigmat 5op. Markus Norrena

On instrument costs in decentralized macroeconomic decision making (Helsingin Kauppakorkeakoulun julkaisuja ; D-31)

1. SIT. The handler and dog stop with the dog sitting at heel. When the dog is sitting, the handler cues the dog to heel forward.

anna minun kertoa let me tell you

1.3Lohkorakenne muodostetaan käyttämällä a) puolipistettä b) aaltosulkeita c) BEGIN ja END lausekkeita d) sisennystä

1.3 Lohkorakenne muodostetaan käyttämällä a) puolipistettä b) aaltosulkeita c) BEGIN ja END lausekkeita d) sisennystä

Alternative DEA Models

KONEISTUSKOKOONPANON TEKEMINEN NX10-YMPÄRISTÖSSÄ

FinFamily Installation and importing data ( ) FinFamily Asennus / Installation

FinFamily PostgreSQL installation ( ) FinFamily PostgreSQL

Results on the new polydrug use questions in the Finnish TDI data

Ohjelmointikielet ja -paradigmat 5op. Markus Norrena

On instrument costs in decentralized macroeconomic decision making (Helsingin Kauppakorkeakoulun julkaisuja ; D-31)

Network to Get Work. Tehtäviä opiskelijoille Assignments for students.

On instrument costs in decentralized macroeconomic decision making (Helsingin Kauppakorkeakoulun julkaisuja ; D-31)

The CCR Model and Production Correspondence

Tietorakenteet ja algoritmit

16. Allocation Models

Gap-filling methods for CH 4 data

Choose Finland-Helsinki Valitse Finland-Helsinki

make and make and make ThinkMath 2017

Uusi Ajatus Löytyy Luonnosta 4 (käsikirja) (Finnish Edition)

LANSEERAUS LÄHESTYY AIKATAULU OMINAISUUDET. Sähköinen jäsenkortti. Yksinkertainen tapa lähettää viestejä jäsenille

Salasanan vaihto uuteen / How to change password

Efficiency change over time

Information on preparing Presentation

Ohjelmointikielet ja -paradigmat 5op. Markus Norrena

Use of spatial data in the new production environment and in a data warehouse

BLOCKCHAINS AND ODR: SMART CONTRACTS AS AN ALTERNATIVE TO ENFORCEMENT

Bounds on non-surjective cellular automata

EUROOPAN PARLAMENTTI

National Building Code of Finland, Part D1, Building Water Supply and Sewerage Systems, Regulations and guidelines 2007

ECVETin soveltuvuus suomalaisiin tutkinnon perusteisiin. Case:Yrittäjyyskurssi matkailualan opiskelijoille englantilaisen opettajan toteuttamana

TIE Ohjelmistojen suunnittelu

LYTH-CONS CONSISTENCY TRANSMITTER

TM ETRS-TM35FIN-ETRS89 WTG

Other approaches to restrict multipliers

FIS IMATRAN KYLPYLÄHIIHDOT Team captains meeting

Vastuuvelan markkina-arvon määrittämisestä *

Metal 3D. manufacturing. Kimmo K. Mäkelä Post doctoral researcher

7. Product-line architectures

Curriculum. Gym card

MEETING PEOPLE COMMUNICATIVE QUESTIONS

Data Quality Master Data Management

ASUNTOSUUNNITTELU TÄNÄÄN

Käyttöliittymät II. Käyttöliittymät I Kertaus peruskurssilta. Keskeisin kälikurssilla opittu asia?

XNA grafiikka laajennus opas. Paavo Räisänen. Tämän oppaan lähdekoodit ovat ladattavissa näiden sivujen Ladattavat osiossa.

Returns to Scale II. S ysteemianalyysin. Laboratorio. Esitelmä 8 Timo Salminen. Teknillinen korkeakoulu

OP1. PreDP StudyPlan

Pino S on abstrakti tietotyyppi, jolla on ainakin perusmetodit:

Rotarypiiri 1420 Piiriapurahoista myönnettävät stipendit

Rekisteröiminen - FAQ

Tyyppiluokat II konstruktoriluokat, funktionaaliset riippuvuudet. TIES341 Funktio-ohjelmointi 2 Kevät 2006

Security server v6 installation requirements

Characterization of clay using x-ray and neutron scattering at the University of Helsinki and ILL

T Ohjelmistotekniikan seminaari

Counting quantities 1-3

TM ETRS-TM35FIN-ETRS89 WTG

Metsälamminkankaan tuulivoimapuiston osayleiskaava

,0 Yes ,0 120, ,8

Security server v6 installation requirements

The Viking Battle - Part Version: Finnish

Office 2013 ja SQL Server 2012 SP1 uudet BI toiminnallisuudet Marko Somppi/Invenco Oy

Biojätteen keruu QuattroSelect - monilokerojärjestelmällä Tiila Korhonen SUEZ

BDD (behavior-driven development) suunnittelumenetelmän käyttö open source projektissa, case: SpecFlow/.NET.

Infrastruktuurin asemoituminen kansalliseen ja kansainväliseen kenttään Outi Ala-Honkola Tiedeasiantuntija

Windows Phone. Module Descriptions. Opiframe Oy puh Espoo

T Olio-ohjelmointi Osa 5: Periytyminen ja polymorfismi Jukka Jauhiainen OAMK Tekniikan yksikkö 2010

( ( OX2 Perkkiö. Rakennuskanta. Varjostus. 9 x N131 x HH145

Java UI-komponentit (JTable) Juha Järvensivu 2007

Poraustyökierrot ja piirteiden tunnistus

Tynnyrivaara, OX2 Tuulivoimahanke. ( Layout 9 x N131 x HH145. Rakennukset Asuinrakennus Lomarakennus 9 x N131 x HH145 Varjostus 1 h/a 8 h/a 20 h/a

HOITAJAN ROOLI TEKNOLOGIAVÄLITTEISESSÄ POTILASOHJAUKSESSA VÄITÖSKIRJATUTKIJA JENNI HUHTASALO

Tutkimusdata ja julkaiseminen Suomen Akatemian ja EU:n H2020 projekteissa

Uusia kokeellisia töitä opiskelijoiden tutkimustaitojen kehittämiseen

WindPRO version joulu 2012 Printed/Page :42 / 1. SHADOW - Main Result

Oma sininen meresi (Finnish Edition)

TM ETRS-TM35FIN-ETRS89 WTG

Supplies

Competitiveness with user and customer experience

Laskennallisesti Älykkäät Järjestelmät. Sumean kmeans ja kmeans algoritmien vertailu

Microsoft Lync 2010 Attendee

Capacity utilization

C470E9AC686C

Väylämoduuli - DALI Master Wago

Information on Finnish Language Courses Spring Semester 2018 Päivi Paukku & Jenni Laine Centre for Language and Communication Studies

( ,5 1 1,5 2 km

TM ETRS-TM35FIN-ETRS89 WTG

TM ETRS-TM35FIN-ETRS89 WTG

AYYE 9/ HOUSING POLICY

TM ETRS-TM35FIN-ETRS89 WTG

WindPRO version joulu 2012 Printed/Page :47 / 1. SHADOW - Main Result

P e d a c o d e ohjelmointikoulutus verkossa

Collaborative & Co-Creative Design in the Semogen -projects

Transkriptio:

Encapsulation Imperative programming abstraction via subprograms Modular programming data abstraction Encapsulation grouping of subprograms and the data they manipulate Information hiding abstract data types type definition is hidden from the user variables of the type can be declared variables of the type can be used via the operations defined for the type Mechanisms modules, packages, classes nested subprograms, file system 1

lasses Put together those object that have the same behavior Support abstract data types better than modules modules can be used by importing them classes are in variable declarations like types lass hierarchy (inheritance) behavior of the superclass instances is copied to be part of the behavior the subclass instances multiple inheritance vs. single inheritance Meta class a class described as a class 2

Design issues for object-oriented languages Exclusivity of objects consistency vs. inefficiency Are subclasses subtypes? consistency between subclasses and superclasses Implementation and interface inheritance dependency vs. inefficiency Single and multiple inheritance Dynamic/static binding, dynamic/static typing Allocation and deallocation of objects Vector v = new Vector ( ); v.addelement ( new Integer ( 10 ) ); ++: Java: int second ( ) { int temp = top ( ); pop ( ); int temp_result = top ( ); push ( temp ); return temp_result; } 3

Object creation Stack memory allocation for objects: size must be known during compilation Inheritance: objects that look like base class objects can really be of derived class! So size depends on situation In many languages memory for objects is always allocated from the heap Same goes for member objects in a class ++ allows stack allocation & embedded member objects, this causes problems (slicing) and restricts use of inheritance 4

Operation binding Dynamic binding = run time binding enables polymorphism that is typical for object orientation implemented via virtual operations Virtual operation operation to be called is selected on the basis of the object s current class Polymorphism in object-oriented languages superclass instance can be replaced with a subclass instance in general a named object can be replaced with another named object genericity, templates (parametric polymorphism) overloading (ad hoc polymorphism) 5

Static and dynamic binding in programming languages Dynamic binding for all operations Smalltalk, Modula-3 Dynamic binding as default Java, added with final definition Eiffel, added with frozen definition Static binding as default ++, added with virtual definition Simula, added with virtual definition Ada95, class wide types used as formal parameters Operations cannot be overridden in subclasses 6

Implementation of object orientation Features in memory class resembles a record (especially in ++) IR (class instance record) information static structure about an object each feature can be found by evaluating the offset of the feature subclass adds its own features after the IR of the superclass Dynamically bound operations references to these operations can be found from IR list of operations that can be bound dynamically virtual method table (VMT, vtable) information about a class 7

Implementation of object orientation Dynamically bound operations in dynamically typed object-oriented languages Each class has a method parser function Method parser receives method name and parameters and decides what code to call If parser finds no suitable method, it gives a run-time error If subclass parser finds no suitable method, it calls base class parser(s) before giving an error Slower than static methods, but more flexible In some languages programmer may write custom method parsers for a class 8

Implementing a class and dynamically bound operations class Foo { int x; double y; char z; public: virtual void k (... ); virtual int l (... ); virtual void m (... ); virtual double n (... );... } f; IR of f x y z VMT of Foo k l m n code of m:n 9

Implementing single inheritance class Bar: public Foo { int w; public: void m (... ); // override virtual double s (... ); virtual char *t (... );... } b; IR of b x y z w VMT of Bar k l m code of Bar::m n code of Foo::n s code of Bar::s t 10

hoices for multiple inheritance Non-repeated multiple inheritance inherited superclasses are separate in the class hierarchy Repeated multiple inheritance replicated multiple inheritance shared multiple inheritance diamond inheritance B A B A B D D A D 11

Implementation issues for multiple inheritance Name conflict inherited classes have features of the same name how to refer to the features of all the superclasses ++: operator :: Eiffel: renaming Shared inheritance (diamond inheritance) by which way does D inherit features of A any feature inherited from A can be redefined in B or B A D 12

B Non-repeated multiple inheritance D D view, B view view IR of D obj. B D (only) VMT of D (D/B part) B operations D (only) operations VMT of D ( part) operations 13

Replicated multiple inheritance D view, B view, B::A view view, ::A view IR of D obj. B::A B (only) ::A (only) D (only) VMT of D (D/B part) B::A operations B (only) operations D (only) operations VMT of D ( part) ::A operations (only) operations A B D A *a; B *b; D *d;... a = d;... b = d; a = b; A v OK. /. 14

Shared multiple inheritance A D view, B view IR of D obj. VMT of D (D/B part) B operations B D B (only) D operations view VMT of D ( part) (only) operations A view D (only) VMT of D (A part) A operations A 15