Inheritance mapping from UML to C#.

Slides:



Advertisements
Podobne prezentacje
The Thousand Islands Pan kiedyś stanął na brzegu
Advertisements

WYKORZYSTANIE B-LEARNING’U W NAUCZANIU JĘZYKA SPECJALISTYCZNEGO (ANGIELSKI W TURYSTYCE) Joanna Jercha - Malinowska.
Projekt Do kariery na skrzydłach – studiuj Aviation Management Projekt współfinansowany ze ś rodków Europejskiego Funduszu Społecznego. Biuro projektu:
Centrum Kształcenia Ustawicznego w Sosnowcu ul. Kisielewskiego 4b tel/fax (032) , Centrum Kształcenia Ustawicznego w Sosnowcu.
Logiki (nie)klasyczne
Mapowanie dziedziczenia z UML do Java
-Witam nazywam się Weronika Zgorzelska oraz Oliwia Kołakowska. -Witam serdecznie 1.Od kiedy pan gra w FC Barcelonie… -W FC Barcelonie gram od 13 roku.
Zestawienie wyników badań Researches summary. 1. Czy Twoi rodzice uprawiają jakieś sporty lub w inny aktywny sposób spędzają wolny czas poświęcając im.
Damian Ciunowicz i Krystian Baranowski – kl. I „TL’’
Słowa wyrażające czynności/action or doing words
Music: Nightengale Serenade
One tale one game one dance one recipe
North Ireland. ● Kliknij, aby edytować format tekstu konspektu – Drugi poziom konspektu ● Trzeci poziom konspektu – Czwarty poziom konspektu ● Piąty poziom.
Katarzyna Zielińska Kinga Bujak Kl. IV TI. Nazywam się Katarzyna a to jest moja koleżanka Kinga. Uczęszczamy razem do Zespołu Szkół Elektoniczno-Telekomunikacyjnych.
How to make an application on Step by Step Instructions
SHOPPING- ROBIENIE ZAKUPÓW.
Wydział Elektroniki Kierunek: AiR Zaawansowane metody programowania Wykład 5.
 Primary School no 17  John Paul II, Chorzow, Poland  Made by Monika Winkler`s Project Group.
Rights of the child. Kliknij, aby edytować format tekstu konspektu Drugi poziom konspektu  Trzeci poziom konspektu Czwarty poziom konspektu  Piąty poziom.
The most interesting places in Poland
Wstęp do Fizyki Środowiska - Podstawy mechaniki płynów Problems 1 Lecture 1 1)In a vertical capillary filled with water air bubbles are rising Sketch the.
CROSSWORD: SLANG. Konkurs polega na rozwiązaniu krzyżówki. CROSSWORD: SLANG Wypełnione karty odpowiedzi prosimy składać w bibliotece CJK, lub przesyłać.
… there was someone in the past who said: „To earn million you need billion”. In my opinion, it’s true.
A, an, the, - .
Les meilleures photos de L'année 2005 D'après NBC A life for two, full of tenderness, obtains happiness as they get closer to heaven. Życie we dwoje,
Did you know?. 1 in 8 people living in Britain live in London, 12 million people live in London - this is a major European city London is the world largest.
Is waste harmful to nature and economic? What is waste? Waste means all objects and soild substance and also useless liquid substances which are not.
You are about to see a few sentences in Polish. Try to translate them into English, but keep in mind they are: The First Conditonal The Second Conditional.
Kompetentny ekonomista i logistyk- sukces na rynku edukacyjno – zawodowym! Człowiek – najlepsza inwestycja! Projekt współfinansowany ze środków Unii Europejskiej.
Adaptive, Component Based System Architecture for Monitoring Data Storing Distributed Systems Research Group Department of Computer Science AGH-UST Cracow,
Przetłumacz podane w nawiasach fragmenty zdań na j. angielski.
ESTONIA´S DOINGS SEPT.-NOV What has been done so far...
Wyższa Szkoła Pedagogiczna im. Janusza Korczaka w Warszawie Internet security risk management Prof. Artis Teilans, Aleksandrs Larionovs.
FORESTS IN POLAND. THE AREA OF FORESTS IN POLAND Forests in Poland grow on 9 million hectares, which cover more than 28% of the country. The majority.
Marcin Gliński Instytut Języków Romańskich i Translatoryki UŚ Regionalny Ośrodek Doskonalenia Nauczycieli WOM w Katowicach NOCNE POWTÓRKI MATURALNE 2016.
2. SCHOOL School subjects, school activities. Types of schools – vocabulary rodzaje szkół - słownictwo kindergartenprimary school lower secondary school.
Ona nazywa się… This project has been funded with support from the European Commission. This document reflects the views only of the authors, and the.
C PRZEWODNIK PO NAJCIEKAWSZYCH MIEJSCACH WROCŁAWIA - GUIDE TO THE MOST INTERESTING PLACES OF WROCLAW Cześć jestem Krzysztof. Dziś będę pokazywał Ci Najciekawsze.
Co Pan robi? Kim Pani jest? This project has been funded with support from the European Commission. This document reflects the views only of the authors,
PI Synergia początkowej nauki języka obcego z edukacją wczesnoszkolną i technologiami informacyjno-komunikacyjnymi. Projekt współfinansowany przez Europejski.
Important holidays and festivals in Poland. The first of January New Year’s Day New Year’s Day the day of Mary the Holy Mother of God – for Catholics.
Dzień dobry! Cześć! This project has been funded with support from the European Commission. This document reflects the views only of the authors, and.
Www,mojesilnedrzewo.pl. W dniach 15 marca – 30 kwietnia 2010.r.wytwórnia wody mineralnej Żywiec Zdrój SA wspólnie z Fundacją Nasza Ziemia i Regionalną.
There are lots of places in Poznan where young people can spend time actively. They are mainly pitches, courts and swimming pools but also bicycle paths.
Opracowanie: Katarzyna Gagan, Anna Krawczuk
„Forests in Poland and Europe. Characteristics and management.”
Music: Nightengale Serenade
Music: Nightengale Serenade
Forest fire protection
Fire protection in Poland and Europe
Przetestuj Usability Mateusz Kaczmarek
SafeSurfing Moduł 1 Jak bezpiecznie korzystać z internetu i jak chronić swoje dane osobowe?
Tworzenie zdań i zastosowanie
Hydrolysis & buffers.
A prototype of distributed modelling environment
English Language Teaching Methodology for Non-Native English Language Teachers in Secondary School/Adults Education Rafał Rosiński Malta,
Running Dictation Activity to Engage Students in Reading, Writing, Listening, and Speaking.
EMPOWEREMENT IN ICT SKILLS. I CREATED MY WEBSITE TO USE IT FOR TEACHING.
Lesson 11 – Problem Solving & Applications of Functions
AOP – Aspect Oriented Programming
Internationalisation at the University of Warsaw
Programming with Live Distributed Objects
Mariusz Dybał - Portfel akcyjny PTEbnmbnmbn mbn,bm,b
Polish L3 Learning Pack Saying your name
zl
1) What is Linux 2) Founder and mascot of linux 3) Why Torvalds created linux ? 4) System advantages and disadvantages 5) Linux distributions 6) Basic.
Beata Charkiewicz. Table of Contents  Introduction To Android  History Of Android  What is OHA?  Devices with android  Android Features  Android.
Cover page Change background image by right-clicking → Edit background Picture fill → From file First move the gradient mask by activating it (clicking.
SatMapping Your map from space Cover page
Zapis prezentacji:

Inheritance mapping from UML to C#

MAS 2004 Wojciech Gorzkowski & Michał Juchnowicz Plan of a presentation Introduction Disjoint inheritance Overlapping inhritance Complete inheritance Incomplete inheritance Multi-inheritance Multi-aspect inheritance Dynamic inheritance Tasks 2019-02-16 MAS 2004 Wojciech Gorzkowski & Michał Juchnowicz

MAS 2004 Wojciech Gorzkowski & Michał Juchnowicz Introduction Generalization – specialization a relationship that connects so called superclass with another classes that are called subclasses. Person Osoba specjalizacja generalizacja Employee Pracownik Assistant Tutor Reader Professor Asystent Adiunkt Docent Profesor 2019-02-16 MAS 2004 Wojciech Gorzkowski & Michał Juchnowicz

MAS 2004 Wojciech Gorzkowski & Michał Juchnowicz Introduction Superclass is more general than its subclasses. Sometimes it is said, that superclass is a generalization of a subclass and subclass is a specialization of a superclass. Inheritance Its mechanism is strictly related to the specialization – generalization relationship. Thanks to inheritance class invariants are imported from the superclass to the subclasses. It means that subclass has all properties its superclass; moreover subclass can have (and usually has) also additional properties. Invariants’ inheritance is transitive 2019-02-16 MAS 2004 Wojciech Gorzkowski & Michał Juchnowicz

MAS 2004 Wojciech Gorzkowski & Michał Juchnowicz Introduction Generalization hierarchy cannot contain a loop. It can be a grid – then it models repeating inheritance (in further part of the presentation) Person K1 K2 Student Employee K3 Student_assistant Grid Loop 2019-02-16 MAS 2004 Wojciech Gorzkowski & Michał Juchnowicz

MAS 2004 Wojciech Gorzkowski & Michał Juchnowicz Introduction The most common mistake is that we make a class hierarchy only based on similarity of the attributes. When we make a class hierarchy we have to take into account that classes in the hierarchy have to have similar semantics. They also have to have such a property: subclass object is a special case of a superclass object (e.g. Employee is a special case of a Person object.) 2019-02-16 MAS 2004 Wojciech Gorzkowski & Michał Juchnowicz

MAS 2004 Wojciech Gorzkowski & Michał Juchnowicz Disjoint inheritance No common point Default way of implementing For instance: Human Female Male 2019-02-16 MAS 2004 Wojciech Gorzkowski & Michał Juchnowicz

Overlapping inheritance Common points Implementing couses change in diagram For instance: Building Garage House {overlapping} 2019-02-16 MAS 2004 Wojciech Gorzkowski & Michał Juchnowicz

Overlapping inheritance did with additional class class Building { } class House: Building class Garage: Building class HouseWithGarage: Building Building Garage House House with garage 2019-02-16 MAS 2004 Wojciech Gorzkowski & Michał Juchnowicz

Overlapping inheritance did with composition class Building { House house; Garage garage; } class House class Garage Building Garage House 0..1 2019-02-16 MAS 2004 Wojciech Gorzkowski & Michał Juchnowicz

MAS 2004 Wojciech Gorzkowski & Michał Juchnowicz Complete inheritance In UML diagram, complete is a default value, so it doesn’t have to be written. It means that all the subclasses were defined (all the subclasses were drawn at the diagram). For instance: Person {abstract} {complete} Student Employee 2019-02-16 MAS 2004 Wojciech Gorzkowski & Michał Juchnowicz

MAS 2004 Wojciech Gorzkowski & Michał Juchnowicz using System; using System.Threading; namespace CompleteInheritance { class CompleteInheritance static void Main(string[] args) Student kowalski = new Student("Jan", "Kowalski", "Wrocław", "617"); Employee nowak = new Employee("Jan","Nowak","Warszawa",1000); kowalski.getInfo(); Console.WriteLine("-----------------------------------"); nowak.getInfo(); } abstract class Person protected string name; protected string surname; protected string city; public Person(string name, string surname, string city) this.name = name; this.surname = surname; this.city = city; public abstract void getInfo(); 2019-02-16 MAS 2004 Wojciech Gorzkowski & Michał Juchnowicz

MAS 2004 Wojciech Gorzkowski & Michał Juchnowicz class Student : Person { string group; public Student(string name, string surname, string city, string group) : base(name, surname, city) this.group = group; } public override void getInfo() Console.WriteLine("I'm a student and that's my personall datas:\n" + "Name: " + this.name + "\n" + "Surname: " + this.surname + "\n" + "City: " + this.city + "\n" + "Group: " + this.group + "\n" ); Thread.Sleep(5000); class Employee : Person int salary; public Employee(string name, string surname, string city, int salary) this.salary = salary; Console.WriteLine("I'm an amployee and that's my personall datas:\n" + "Salary: " + this.salary.ToString() + "\n" 2019-02-16 MAS 2004 Wojciech Gorzkowski & Michał Juchnowicz

Incomplete inheritance In UML diagram, incomplete is not a default value, so it has to be written. It means that not all the subclasses were defined. The superclass here can’t be an abstract class. It is a default inheritance inter alia in C# programming language. For instance: Dog {incomplete} Alsatian Bulldog 2019-02-16 MAS 2004 Wojciech Gorzkowski & Michał Juchnowicz

MAS 2004 Wojciech Gorzkowski & Michał Juchnowicz using System; using System.Threading; namespace IncompleteInheritance { class IncompleteInheritance static void Main(string[] args) Student kowalski = new Student("Jan", "Kowalski", "Wrocław", "617"); Employee nowak = new Employee("Jan","Nowak","Warszawa",1000); kowalski.getInfo(); Console.WriteLine("-----------------------------------"); nowak.getInfo(); } class Person protected string name; protected string surname; protected string city; public Person(string name, string surname, string city) this.name = name; this.surname = surname; this.city = city; 2019-02-16 MAS 2004 Wojciech Gorzkowski & Michał Juchnowicz

MAS 2004 Wojciech Gorzkowski & Michał Juchnowicz class Student : Person { string group; public Student(string name, string surname, string city, string group) : base(name, surname, city) this.group = group; } public void getInfo() Console.WriteLine("I'm a student and that's my personall datas:\n" + "Name: " + this.name + "\n" + "Surname: " + this.surname + "\n" + "City: " + this.city + "\n" + "Group: " + this.group + "\n" ); Thread.Sleep(5000); class Employee : Person int salary; public Employee(string name, string surname, string city, int salary) this.salary = salary; Console.WriteLine("I'm an amployee and that's my personall datas:\n" + "Salary: " + this.salary.ToString() + "\n" 2019-02-16 MAS 2004 Wojciech Gorzkowski & Michał Juchnowicz

Complete and incomplete inheritance Complete and incomplete inheritances are used mainly in conceptual modelling. They don’t have any reference (odniesienia) in implementation. 2019-02-16 MAS 2004 Wojciech Gorzkowski & Michał Juchnowicz

MAS 2004 Wojciech Gorzkowski & Michał Juchnowicz Multi-inheritance Inheritance from many classes at the same time C# doesn’t support multi-inheritance of classes For instance: Camera Video play() zoom() Picture flash() Photo camera Photo/Video camera Video camera 2019-02-16 MAS 2004 Wojciech Gorzkowski & Michał Juchnowicz

Multi-inheritance did with additional subclass class Camera{} interface IPicture { void flash(); void zoom(); } interface IVideo void play(); class VideoCamera: Camera, IVideo public void play(){} public void zoom(){} class PhotoVideoCamera: Camera, IPicture, IVideo public void flash(){} Camera Video play() zoom() Picture flash() Photo camera Photo/Video camera Video camera 2019-02-16 MAS 2004 Wojciech Gorzkowski & Michał Juchnowicz

Multi-aspect inheritance Multi-aspect inheritance – inheritance in which there are more than 1 aspect of inheritance. In this case the aspect of inheritance cannot be ommited on the UML diagram. For instance: Vehicle drive terrain Wind vehicle Engine vehicle Terrestrial vehicle Water vehicle 2019-02-16 MAS 2004 Wojciech Gorzkowski & Michał Juchnowicz

Multi-aspect inheritance did with composition Vehicle Drived vehicle Terrain Vehicle drive terrain Wind vehicle Engine vehicle Terrestrial vehicle Water vehicle 2019-02-16 MAS 2004 Wojciech Gorzkowski & Michał Juchnowicz

MAS 2004 Wojciech Gorzkowski & Michał Juchnowicz using System; namespace MultiAspectInheritance { class MultiAspectInheritance static void Main(string[] args) } class Vehicle DrivedVehicle drivedVehicle; TerrainVehicle terrainVehicle; abstract class DrivedVehicle abstract class TerrainVehicle class WindVehicle : DrivedVehicle class EngineVehicle : DrivedVehicle class TerrestrialVehicle : TerrainVehicle class WaterVehicle : TerrainVehicle 2019-02-16 MAS 2004 Wojciech Gorzkowski & Michał Juchnowicz

Multi-aspect inheritance did with inheritance and composition Vehicle Drived vehicle Terrain Vehicle drive terrain Wind vehicle Engine vehicle Terrestrial vehicle Water vehicle 2019-02-16 MAS 2004 Wojciech Gorzkowski & Michał Juchnowicz

MAS 2004 Wojciech Gorzkowski & Michał Juchnowicz using System; namespace MultiAspectInheritance { class MultiAspectInheritance static void Main(string[] args) } class Vehicle TerrainVehicle terrainVehicle; abstract class DrivedVehicle : Vehicle abstract class TerrainVehicle class WindVehicle : DrivedVehicle class EngineVehicle : DrivedVehicle class TerrestrialVehicle : TerrainVehicle class WaterVehicle : TerrainVehicle 2019-02-16 MAS 2004 Wojciech Gorzkowski & Michał Juchnowicz

Multi-aspect inheritance did with encapsulated specification Vehicle drive Wind vehicle Engine vehicle terrain terrain Terrestrial and wind vehicle Water and wind vehicle Terrestrial and engine vehicle Water and engine vehicle 2019-02-16 MAS 2004 Wojciech Gorzkowski & Michał Juchnowicz

MAS 2004 Wojciech Gorzkowski & Michał Juchnowicz using System; namespace MultiAspectInheritance { class MultiAspectInheritance static void Main(string[] args) } abstract class Vehicle abstract class WindVehicle : Vehicle abstract class EngineVehicle : Vehicle class TerrestrialAndWindVehicle : Vehicle class WaterAndWindVehicle : Vehicle class TerrestrialAndEngineVehicle : Vehicle class WaterAndEngineVehicle : Vehicle 2019-02-16 MAS 2004 Wojciech Gorzkowski & Michał Juchnowicz

MAS 2004 Wojciech Gorzkowski & Michał Juchnowicz Dynamic inheritance Object changes its state dynamically Substance Ice Steam Liquid <<dynamic>> 2019-02-16 MAS 2004 Wojciech Gorzkowski & Michał Juchnowicz

MAS 2004 Wojciech Gorzkowski & Michał Juchnowicz Dynamic inheritance interface ISubstance { void changeState(); } class Liquid: ISubstance public Liquid(){} public void changeState() Console.WriteLine(„Liquid -> Ice"); class Ice: ISubstance public Ice(){} Console.WriteLine(„Ice -> Liquid"); Ice ice = new Ice(); Liquid liquid = new Liquid(); ISubstance h2o = ice; h2o.changeState(); Output: Liquid -> Ice h2o = liquid; h2o.changeState(); Output: Ice -> Liquid 2019-02-16 MAS 2004 Wojciech Gorzkowski & Michał Juchnowicz

MAS 2004 Wojciech Gorzkowski & Michał Juchnowicz Tasks 1 A company „Krzak” selling computers needs a system that will store information about computers and palmtops. The „Krzak” sells coputers such as notebooks and desktop computers as well as such types of palmtops: with colour and monochromatic display. 2019-02-16 MAS 2004 Wojciech Gorzkowski & Michał Juchnowicz

MAS 2004 Wojciech Gorzkowski & Michał Juchnowicz Task 2 A company „Krzak” selling computers needs a system that will store information about computers. The „Krzak” sells computers such as notebooks, desktop computers etc. 2019-02-16 MAS 2004 Wojciech Gorzkowski & Michał Juchnowicz

MAS 2004 Wojciech Gorzkowski & Michał Juchnowicz Task 3 Car dealer „Krzak” selling cars wants to store information about available cars. The cars are divided with respect to engine (petrol, diesel) as well as equipment (air condition, audio system) 2019-02-16 MAS 2004 Wojciech Gorzkowski & Michał Juchnowicz

MAS 2004 Wojciech Gorzkowski & Michał Juchnowicz Task 4 Company „Posprzątamy” needs a system that will store information about cleaners and owners of company. Remember that owner cannot work as a cleaner. 2019-02-16 MAS 2004 Wojciech Gorzkowski & Michał Juchnowicz

MAS 2004 Wojciech Gorzkowski & Michał Juchnowicz Task 5 Computer company selling network devices needs a system that will store information about routers, modems and network cards. Company sells also routers with bult-in modems. 2019-02-16 MAS 2004 Wojciech Gorzkowski & Michał Juchnowicz

MAS 2004 Wojciech Gorzkowski & Michał Juchnowicz Task 6 Real estate agency „Dom” needs a system that will store information about houses they have in offer. House can be empty, rented, sold or in renovation. 2019-02-16 MAS 2004 Wojciech Gorzkowski & Michał Juchnowicz