Návrhové vzory. Poznámky k prednáškam z predmetu Objektovo-orientované programovanie. Valentino Vranić.
|
|
- Gervase Stafford
- 5 years ago
- Views:
Transcription
1 Návrhové vzory Poznámky k prednáškam z predmetu Objektovo-orientované programovanie Valentino Vranić vranic@stuba.sk Ústav informatiky a softvérového inžinierstva Fakulta informatiky a informačných technológií Slovenská technická univerzita v Bratislave 29. február 2016
2 OBSAH i Obsah 1 Pojem návrhového vzoru 1 2 Visitor 1 3 Observer 5 4 Strategy 7 5 Composite 8
3 1 POJEM NÁVRHOVÉHO VZORU 1 1 Pojem návrhového vzoru Vysvetlenie pojmu návrhového vzoru v kontexte hry o obroch a rytieroch rozvíjanej na prednáškách Meč je nástroj oberania obra o energiu v rukách rytiera Jeho účinnosť závisí od jeho druhu, ale aj od druhu rytiera, ktorý ním narába Ako toto zabezpečiť? Na jednej strane bolo potrebné umožniť pridávanie nových druhov meču Na druhej strane bolo nežiaduce preto vždy upravovať triedy reperezentujúcich rytierov Toto sú protichodné sily Opakovane sa vyskytujú v kontexte zabezpčenia rozšíriteľnosti triedy o nové operácie Ich rozriešenie predstavuje vzor (pattern) Presnejšie: návrhový vzor (design pattern) vzor na úrovni návrhu (design), t.j. použiteľný v programovacich jazykoch určitého typu Vzor: kontext problém riešenie Each pattern is a three-part rule, which expresses a relation between a certain context, a problem, and a solution. As an element in the world, each pattern is a relationship between a certain context, a certain system of forces which occurs repeatedly in that context, and a certain spatial configuration which allows these forces to resolve themselves. As an element of language, a pattern is an instruction, which shows how this spatial configuration can be used, over and over again, to resolve the given system of forces, wherever the context makes it relevant. Each pattern is a three-part rule, which expresses a relation between a certain context, a certain system of forces which occurs repeatedly in that context, and a certain software configuration which allows these forces to resolve themselves. Christopher Alexander, The Timless Way of Building 2 Visitor Visitor: pridávanie operácií k objektom určitých tried bez toho, aby ich bolo potrebné meniť Návrhový vzor Visitor umožňuje pridávanie operácií k objektom určitých tried bez toho, aby ich bolo potrebné meniť Spoločné operácie pre typy, ktoré nie sú vo vzťahu dedenia Vhodný, ak tieto operácie nesúvisia priamo s triedami, nad ktorými operujú Zabraňuje sa tak znečisteniu kódu Operácie, ktoré súvisia navzájom, budú v jednej triede Vhodný pri potrebe častého pridávania operácií
4 2 VISITOR 2 Štruktúra vzoru Visitor Podľa Poznámka k štruktúre vzorov Len jeden pohľad na vzor Ide skôr o príklad štruktúry ako o absolútne platnú štruktúru 1 Podobne je to s implementáciou Visitor a double dispatch Polymorfizmus prekonávaním metód: dynamické viazanie + dedenie Viacnásobný polymorfizmus; multimetódy v jazyku CLOS Vzor Visitor využíva idióm double dispatch pri operácii accept() Najprv sa dynamicky rozhodne o metóde accept() na základe skutočného typu elementu (Element) Následne sa v metóde accept() dynamicky rozhodne o metóde visit() na základe skutočného typu návštevníka (Visitor) Príklad použitia vzoru Visitor Pripomeňme si príklad z prednášky o mechanizmoch OOP, ktorý bol použitý na predvedenie idiómu double dispatch v Jave je Visitor realizovaný práve pomocou tohto idiómu Predstavme si, že pracujeme s položkami, ktoré treba zobrazovať na rôznych zariadeniach Jestvujú rôzne typy položiek pre nás slová a zoznamy Položky sa zobrazujú na rôznych typoch zobrazovacích zariadení pre nás to budú horizontálny zobrazovač a vertikálny zobrazovač, ale treba počítať s tým, že pribudnú ďalšie 1
5 2 VISITOR 3 Môžu pribudnúť aj ďalšie typy položiek, ale to je menej pravdepodobné a nie je stredobodom nášho záujmu Položky public interface DItem { // rozhranie Element void display(ddevice d); // prijatie návštevníka public class WordItem implements DItem { String word; public WordItem(String s) { word = s; public void display(ddevice d) { d.write(this); public class ListItem implements DItem { List<String> list; public ListItem(List<String> l) { list = l; public void display(ddevice d) { d.write(this); Zariadenia public interface DDevice { // rozhranie Visitor void write(worditem item); void write(listitem item); public class HorDevice implements DDevice { public void write(worditem item) { // navštívenie WordItem for(int i = 0; i < item.word.length(); i++) System.out.print(item.word.charAt(i)); public void write(listitem item) { // navštívenie ListItem for(int i = 0; i < item.list.size(); i++) { System.out.print(item.list.get(i)); System.out.print(, ); public class VerDevice implements DDevice { public void write(worditem item) { // navštívenie WordItem for(int i = 0; i < item.word.length(); i++) System.out.println(item.word.charAt(i)); public void write(listitem item) { // navštívenie ListItem for(int i = 0; i < item.list.size(); i++) { System.out.print(item.list.get(i)); System.out.println(, );
6 2 VISITOR 4 Použitie public class M { public static void main(string[] args) { List<String> list = new ArrayList<>(); list.add( a ); list.add( b ); list.add( c ); DItem[] item = {new WordItem( visit ), new ListItem(list); DDevice[] device = {new HorDevice(), new VerDevice(); Výstup visit v i s i t a, b, c, a, b, c, for (DItem it : item) for (DDevice dev : device) { it.display(dev); System.out.println( ); Visitor a double dispatch Polymorfizmus prekonávaním metód: dynamické viazanie + dedenie Viacnásobný polymorfizmus; multimetódy v jazyku CLOS Vzor Visitor využíva idióm double dispatch pri operácii accept() Najprv sa dynamicky rozhodne o metóde display() na základe skutočného typu položky Následne sa v metóde display() dynamicky rozhodne o metóde write() na základe skutočného typu zariadenia Metóda accept() a double dispatch Výber metódy závisí od typu dvoch príjemcov DItem[] item; // Element DDevice[] device; // Visitor... it.display(dev); // element.accept(visitor) Metóda accept() public void accept(visitor v) { v.visit(this);
7 3 OBSERVER 5 3 Observer Observer: pozorovacie objekty majú byť upovedomené o zmene stavu pozorovaného objektu, a má ich byť možné pridávať bez potreby upravovať pozorovaný objekt Návrhový vzor Observer definuje závislosť stavu viacerých objektov od ďalšieho objektu Potrebné je zabezpečiť, aby tieto pozorovacie objekty boli upovedomené o zmene stavu pozorovaného objektu a aby ich bolo možné pridávať bez potreby upravovať pozorovaný objekt Vhodný, ak treba oddeliť dva vzájomne závislé aspekty Vhodný, ak zmena v jednom objekte vyžaduje zmeny v iných objektoch, ktorých počet a presný typ nie je známy Štruktúra vzoru Observer Príklad použitia vzoru Observer Teplotné senzory Rôzne spôsoby zobrazenia teploty: digitálny, analógový, rozsahový... Senzor a zobrazenie public interface TempDisplay { // rozhranie Observer void refresh(); // aktualizácia pozorovateľa public interface TempSensor { // rozhranie Element void adddisplay(tempdisplay d); // pripoj pozorovateľa void removedisplay(tempdisplay d); // odpoj pozorovateľa void notifydisplays(); // pošli notifikáciu pozorovateľovi double readtemp(); public void measuretemp(); Senzor teploty ľudského tela public class HumanTempSensor implements TempSensor { private List<TempDisplay> displays = new ArrayList<>(); private double temp;
8 3 OBSERVER 6 public double refreshrate; public double readtemp() { return temp; public void measuretemp() { //... zistí teplotu z fyzickej jednotky notifydisplays(); // a pošle notifikáciu displejom public void settempdebug(double t) { temp = t; public void adddisplay(tempdisplay d) { displays.add(d); public void removedisplay(tempdisplay d) { /... / public void notifydisplays() { for (TempDisplay dis : displays) { dis.refresh(); Digitálne zobrazenie public class DigitalTemp implements TempDisplay { private HumanTempSensor sensor; private float temp; public DigitalTemp(HumanTempSensor s) { sensor = s; public void refresh() { temp = (float)sensor.readtemp(); public void display() { // len dve desatinné miesta System.out.println(Math.round(temp 100.0) / 100.0); public void measuretemp() { sensor.measuretemp(); Rozsahové zobrazenie // vymenovaný typ časť 10.7 v OJA public enum TempRange { LOW, NORMAL, HIGH public class RelTemp implements TempDisplay { private HumanTempSensor sensor; TempRange range; double high = 37.0; double low = 35.0; public RelTemp(HumanTempSensor s) { sensor = s; Rozsahové zobrazenie (2) public void refresh() { double temp = sensor.readtemp(); if (temp <= low) range = TempRange.LOW; else if (temp >= high)
9 4 STRATEGY 7 range = TempRange.HIGH; else range = TempRange.NORMAL; Rozsahové zobrazenie (3) public void display() { switch (range) { case LOW: System.out.println( LOW ); break; case HIGH: System.out.println( HIGH ); break; default: System.out.println( NORMAL ); public void measuretemp() { sensor.measuretemp(); // class RelTemp Použitie public class M { public static void main(string[] args) { HumanTempSensor s = new HumanTempSensor(); DigitalTemp d1 = new DigitalTemp(s); s.adddisplay(d1); RelTemp d2 = new RelTemp(s); s.adddisplay(d2); s.settempdebug( ); s.notifydisplays(); d1.display(); // d2.display(); // HIGH Observer v Java API Java API obsahuje predprípravu na použitie vzoru Observer 2 Trieda Observable jej rozšírením vytvárate vlastné pozorované objekty Rozhranie Observer pozorovatelia ho musia implementovať 4 Strategy Strategy (Policy): jestvujú (a môžu pribúdať) rôzne stratégie riešenia daného problému, a kontext ich uplatnenia má na to byť pripravený V danom kontexte potrebujeme rôzne stratégie riešenia toho istého problému napr. rôzne algoritmy 2 Viac informácií o použití na
10 5 COMPOSITE 8 Riešením je vzor Strategy (známy aj ako Policy): Strategy definuje rozhranie spoločné pre všetky stratégie riešenia ConcreteStrategy predstavuje konkrétnu stratégiu riešenia (je ich viac) Context upravuje svoje správanie podľa poskytnutej konkrétnej stratégie Strategy príklad public class Sifrovac { private Sifra sifra; public Sifrovac(Sifra sifra) { this.sifra = sifra; public void sifrujtext(string text) { for(int i = 0; i < text.length(); i++) text.charat(i) = sifra.sifruj(text.charat(i)); public interface Sifra { char sifruj(char c); public class SifraA implements Sifra { public char sifruj(char c) {... public class SifraB implements Sifra { public char sifruj(char c) {... 5 Composite Composite: prvky môžu byť kompozitné a atomické, a prístup k ním má byť jednotný Návrhový vzor Composite umožňuje tvorbu stromových hierarchií časť celok spôsobom transparentným pre klienta Vhodný, ak treba umožniť jednotný prístup k atomickým a kompozitným prvkom
11 5 COMPOSITE 9 Štruktúra vzoru Composite Client «interface» Component operation() * Leaf +operation() Composite +operation() +add(component : Component) +remove(component : Component) +getchild(i : Integer) Composite príklad Modelujeme virtuálne mesto Mesto sa skladá z častí Časti sa skladajú z ďalších častí a jednotlivých budov O každej časti a budove evidujeme nejaké informácie, a tie sa majú dať vypísať súhrnne pre celé mesto public interface Cast { void info(); public class CastMesta implements Cast { List<Cast> casti; public void pridajcast(cast cast) {... public void odstrancast(cast cast) {... public void odstrancast(int i) {... public void info() {... \\ vypis informacií o časti mesta \\ výpis informácií o všetkých častiach a budovách tejto časti mesta for (Cast e : casti) e.info(); public class Budova implements Cast {... \\ atributy s informaciami o budove public void info() {... \\ výpis informacií o budove... \\ použitie: mesto vytvoríme ako akúkoľvek inú časť Cast mesto = new Cast();
12 5 COMPOSITE 10 \\ vytvoríme a do mesta pridáme jeho časti a budovy Cast c = new CastMesta(); c.pridajcast(new Budova());... mesto.pridajcast(c);... \\ výpis všetkých informácií o meste je jednoduchý mesto.info(); Sumarizácia Vzory vo vývoji softvéru Návrhové vzory špeciálne GoF návrhové vzory Vzor Visitor a vzory, z ktorých pozostáva vzor MVC: Observer, Strategy a Composite Each pattern describes a problem which occurs over and over again in our environment, and then describes the core of the solution to that problem, in such a way that you can use this solution a million times over, without ever doing it the same way twice Christopher Alexander 3 3 E. Gamma et al. Design Patterns: Elements of Reusable Object-Oriented Design. Addison Wesley, 1995.
VYLEPŠOVANIE KONCEPTU TRIEDY
VYLEPŠOVANIE KONCEPTU TRIEDY Typy tried class - definuje premenné a metódy (funkcie). Ak nie je špecifikovaná inak, viditeľnosť členov je private. struct - definuje premenné a metódy (funkcie). Ak nie
More informationTvorba informačných systémov. 4. prednáška: Návrh IS
Tvorba informačných systémov 4. prednáška: Návrh IS Návrh informačného systému: témy Ciele návrhu ERD DFD Princípy OOP Objektová normalizácia SDD Architektonické pohľady UML diagramy Architektonické štýly
More informationDatabázové systémy. SQL Window functions
Databázové systémy SQL Window functions Scores Tabuľka s bodmi pre jednotlivých študentov id, name, score Chceme ku každému doplniť rozdiel voči priemeru 2 Demo data SELECT * FROM scores ORDER BY score
More informationDatabázy (1) Prednáška 11. Alexander Šimko
Databázy (1) Prednáška 11 Alexander Šimko simko@fmph.uniba.sk Contents I Aktualizovanie štruktúry databázy Section 1 Aktualizovanie štruktúry databázy Aktualizácia štruktúry databázy Štruktúra databázy
More informationAplikačný dizajn manuál
Aplikačný dizajn manuál Úvod Aplikačný dizajn manuál je súbor pravidiel vizuálnej komunikácie. Dodržiavaním jednotných štandardov, aplikácií loga, písma a farieb pri prezentácii sa vytvára jednotný dizajn,
More informationModelovanie štruktúry
Modelovanie štruktúry Poznámky k prednáškam z predmetu Modelovanie softvéru Valentino Vranić http://fiit.sk/~vranic/, vranic@stuba.sk Ústav informatiky, informačných systémov a softvérového inžinierstva
More informationSpájanie tabuliek. Jaroslav Porubän, Miroslav Biňas, Milan Nosáľ (c)
Spájanie tabuliek Jaroslav Porubän, Miroslav Biňas, Milan Nosáľ (c) 2011-2016 Úvod pri normalizácii rozdeľujeme databázu na viacero tabuliek prepojených cudzími kľúčmi SQL umožňuje tabuľky opäť spojiť
More informationObsah. SOA REST REST princípy REST výhody prest. Otázky
REST Peter Rybár Obsah SOA REST REST princípy REST výhody prest Otázky SOA implementácie WEB (1990) CORBA (1991) XML-RPC (1998) WS-* (1998) SOAP RPC/literal SOAP Document/literal (2001) REST (2000) SOA
More informationAnycast. Ľubor Jurena CEO Michal Kolárik System Administrator
Anycast Ľubor Jurena CEO jurena@skhosting.eu Michal Kolárik System Administrator kolarik@skhosting.eu O nás Registrátor Webhosting Serverové riešenia Správa infraštruktúry Všetko sa dá :-) Index Čo je
More informationpackage balik; public class TopLevel1 {... }
Seminář Java Speciální třídy, výčtový typ Radek Kočí Fakulta informačních technologií VUT Březen 2010 Radek Kočí Seminář Java Speciální třídy, výčtový typ 1/ 20 Téma přednášky Vnořené třídy Anonymní třídy
More information1 Komplexný príklad využitia OOP
1 Komplexný príklad využitia OOP Najčastejším využitím webových aplikácií je komunikácia s databázovým systémom. Komplexný príklad je preto orientovaný práve do tejto oblasti. Od verzie PHP 5 je jeho domovskou
More informationCopyright 2016 by Martin Krug. All rights reserved.
MS Managed Service Copyright 2016 by Martin Krug. All rights reserved. Reproduction, or translation of materials without the author's written permission is prohibited. No content may be reproduced without
More informationSpôsoby zistenia ID KEP
Spôsoby zistenia ID KEP ID KEP (kvalifikovaný elektronický podpis) je možné zistiť pomocou napr. ovládacieho panela, prostredíctvom prehliadača Internet Expolrer, Google Chrome alebo Mozilla Firefox. Popstup
More informationPrednáška 4: Modelovanie štruktúry v UML
Prednáška 4: Modelovanie štruktúry v UML Metódy a prostriedky špecifikácie 2013/14 Valentino Vranić Ústav informatiky a softvérového inžinierstva Fakulta informatiky a informačných technológií Slovenská
More informationPatterns. Erich Gamma Richard Helm Ralph Johnson John Vlissides
Patterns Patterns Pattern-based engineering: in the field of (building) architecting and other disciplines from 1960 s Some software engineers also started to use the concepts Become widely known in SE
More informationInformatika 2. Generiká
Informatika 2 Generiká Pojmy zavedené v 10. prednáške (1) štandardný vstup a výstup textové súbory binárne súbory objektové prúdy Informatika 2 1 Pojmy zavedené v 10. prednáške (2) objektové prúdy nečitateľné
More informationRýchlosť Mbit/s (download/upload) 15 Mbit / 1 Mbit. 50 Mbit / 8 Mbit. 80 Mbit / 10 Mbit. 10 Mbit / 1 Mbit. 12 Mbit / 2 Mbit.
Fiber 5 Mbit ** 5 Mbit / Mbit 5,90 Fiber 50 Mbit * 50 Mbit / 8 Mbit 9,90 Fiber 80 Mbit * 80 Mbit / Mbit 5,90 Mini Mbit* Mbit / Mbit 9,90 Klasik 2 Mbit* 2 Mbit / 2 Mbit Standard 8 Mbit* 8 Mbit / 3Mbit Expert
More informationRecipient Configuration. Štefan Pataky MCP, MCTS, MCITP
Recipient Configuration Štefan Pataky MCP, MCTS, MCITP Agenda Mailbox Mail Contact Distribution Groups Disconnected Mailbox Mailbox (vytvorenie nového účtu) Exchange Management Console New User Exchange
More informationDesign Patterns. Definition of a Design Pattern
Design Patterns Barbara Russo Definition of a Design Pattern A Pattern describes a problem which occurs over and over again in our environment, and then describes the core of the solution to that problem,
More informationPROGRAMMING FUNDAMENTALS
PROGRAMMING FUNDAMENTALS Q1. Name any two Object Oriented Programming languages? Q2. Why is java called a platform independent language? Q3. Elaborate the java Compilation process. Q4. Why do we write
More informationDICOM Štandard pre vytváranie, ukladanie, tlač a prenos obrazových informácií v zdravotníctve
DICOM Štandard pre vytváranie, ukladanie, tlač a prenos obrazových informácií v zdravotníctve (Angl. DICOM - Digital Imaging and Communications in Medicine) Štandard DICOM je informačný technologický štandard,
More informationMicrosoft Azure platforma pre Cloud Computing. Juraj Šitina, Microsoft Slovakia
Microsoft Azure platforma pre Cloud Computing Juraj Šitina, Microsoft Slovakia m Agenda Cloud Computing Pohľad Microsoftu Predstavujeme platformu Microsoft Azure Benefity Cloud Computingu Microsoft je
More informationTestovanie bieleho šumu
Beáta Stehlíková FMFI UK Bratislava Opakovanie z prednášky Vygenerujeme dáta Vygenerujeme dáta: N
More informationC212 Early Evaluation Exam Mon Feb Name: Please provide brief (common sense) justifications with your answers below.
C212 Early Evaluation Exam Mon Feb 10 2014 Name: Please provide brief (common sense) justifications with your answers below. 1. What is the type (and value) of this expression: 5 * (7 + 4 / 2) 2. What
More informationVzory, rámce a webové aplikácie
Vzory, rámce a webové aplikácie Jakub Šimko jakub.simko@stuba.sk Návrhové vzory (načo slúžia?) 1. Dobré zvyky v programovaní 2. Riešia často sa opakujúce problémy praxou overeným spôsobom 3. Pomôžu nám
More informationNIKY a NIKY S. JEDNOFÁZOVÉ UPS od 600 do 3000 VA SVETOVÝ ŠPECIALISTA PRE ELEKTRICKÉ INŠTALÁCIE A DIGITÁLNE SYSTÉMY BUDOV
NIKY a NIKY S JEDNOFÁZOVÉ UPS od 600 do 3000 VA SVETOVÝ ŠPECIALISTA PRE ELEKTRICKÉ ŠTALÁCIE A DIGITÁLNE SYSTÉMY BUDOV Ideálna ochrana pre malé kancelárie a domáce kancelárske aplikácie. Tento rad ponúka
More informationJednoradové ložiská s kosouhlým stykom - katalóg Single-Row Angular Contact Ball Bearings - Catalogue
Jednoradové ložiská s kosouhlým stykom - katalóg Single-Row Angular Contact Ball Bearings - Catalogue PREDSLOV INTRODUCTORY REMARKS História výroby valivých ložísk AKE siaha až do Rakúsko Uhorskej monarchie.
More informationVYSOKÉ UČENÍ TECHNICKÉ V BRNĚ
VYSOKÉ UČENÍ TECHNICKÉ V BRNĚ BRNO UNIVERSITY OF TECHNOLOGY FAKULTA ELEKTROTECHNIKY A KOMUNIKAČNÍCH TECHNOLOGIÍ FACULTY OF ELECTRICAL ENGINEERING AND COMMUNICATION ÚSTAV TELEKOMUNIKACÍ DEPARTMENT OF TELECOMMUNICATIONS
More informationOutline. Parts 1 to 3 introduce and sketch out the ideas of OOP. Part 5 deals with these ideas in closer detail.
OOP in Java 1 Outline 1. Getting started, primitive data types and control structures 2. Classes and objects 3. Extending classes 4. Using some standard packages 5. OOP revisited Parts 1 to 3 introduce
More informationUniversity of Palestine. Mid Exam Total Grade: 100
First Question No. of Branches (5) A) Choose the correct answer: 1. If we type: system.out.println( a ); in the main() method, what will be the result? int a=12; //in the global space... void f() { int
More informationOchrana koncových staníc pomocou Cisco Security Agent 6.0. Ľubomír Varga.
Ochrana koncových staníc pomocou Cisco Security Agent 6.0 Ľubomír Varga lubomir.varga@lynx.sk Agenda CSA 6.0 refresh Vybrané vlastnosti CSA 6.0 Application Trust levels Notify User Rule Actions User Justifications
More informationStructures. Dr. Donald Davendra Ph.D. (Department of Computing Science, Structures FEI VSB-TU Ostrava)
Structures Dr. Donald Davendra Ph.D. Department of Computing Science, FEI VSB-TU Ostrava 1/18 Derived and Structured Data Types basic data type - part of the standard language, preprocessor - without parameters,
More informationINDEX. A SIMPLE JAVA PROGRAM Class Declaration The Main Line. The Line Contains Three Keywords The Output Line
A SIMPLE JAVA PROGRAM Class Declaration The Main Line INDEX The Line Contains Three Keywords The Output Line COMMENTS Single Line Comment Multiline Comment Documentation Comment TYPE CASTING Implicit Type
More informationThe Basic Parts of Java
Data Types Primitive Composite The Basic Parts of Java array (will also be covered in the lecture on Collections) Lexical Rules Expressions and operators Methods Parameter list Argument parsing An example
More informationCS506 Web Design & Development Final Term Solved MCQs with Reference
with Reference I am student in MCS (Virtual University of Pakistan). All the MCQs are solved by me. I followed the Moaaz pattern in Writing and Layout this document. Because many students are familiar
More informationkucharka exportu pro 9FFFIMU
požiadavky na export kodek : Xvid 1.2.1 stable (MPEG-4 ASP) // výnimočne MPEG-2 bitrate : max. 10 Mbps pixely : štvorcové (Square pixels) rozlíšenie : 1920x1080, 768x432 pre 16:9 // výnimočne 1440x1080,
More informationJava Loop Control. Programming languages provide various control structures that allow for more complicated execution paths.
Loop Control There may be a situation when you need to execute a block of code several number of times. In general, statements are executed sequentially: The first statement in a function is executed first,
More informationTecniche di Progettazione: Design Patterns
Tecniche di Progettazione: Design Patterns GoF: Visitor 1 Polymorphism reminded: overriding and dynamic binding 2 Polymorphism reminded: overloading and static dispatch 3 Polymorphism reminded: overloading
More informationAn Introduction to Patterns
An Introduction to Patterns Robert B. France Colorado State University Robert B. France 1 What is a Pattern? - 1 Work on software development patterns stemmed from work on patterns from building architecture
More informationMERANIE SOFTVÉRU. Jakub Šimko MSI
Slovenská Technická Univerzita v Bratislave Fakulta Informatiky a Informačných Technológií Jakub Šimko jsimko@fiit.stuba.sk MERANIE SOFTVÉRU 9.10.2012 MSI Meranie a metriky Kto by mal dávať pozor? Predsa
More informationGIS Ostrava 2008 Ostrava Marián Adamják , Banská Bystrica, Slovensko
AKTUALIZÁCIA ÚDAJOV VEKTOROVÝCH MODELOV VYSOKÉHO ROZLIŠENIA Marián Adamják 1 1 Topografický ústav, Ružová 8, 974 01, Banská Bystrica, Slovensko madamjak@topu.army.sk Abstrakt. Geoinformatika a priestorové
More informationJazyk SQL. Jaroslav Porubän, Miroslav Biňas, Milan Nosáľ (c)
Jazyk SQL Jaroslav Porubän, Miroslav Biňas, Milan Nosáľ (c) 2011-2016 Jazyk SQL - Structured Query Language SQL je počítačový jazyk určený na komunikáciu s relačným SRBD neprocedurálny (deklaratívny) jazyk
More informationIntroduction to the Java Basics: Control Flow Statements
Lesson 3: Introduction to the Java Basics: Control Flow Statements Repetition Structures THEORY Variable Assignment You can only assign a value to a variable that is consistent with the variable s declared
More informationMesačná kontrolná správa
Mesačná kontrolná správa Štrukturálna štúdia dec.16 nov.16 okt.16 sep.16 aug.16 júl.16 jún.16 máj.16 apr.16 mar.16 feb.16 jan.16 Internetová populácia SR 12+ 3 728 988 3 718 495 3 718 802 3 711 581 3 700
More informationAP CS Unit 7: Interfaces Exercises Assume all code compiles unless otherwise suggested.
AP CS Unit 7: Interfaces Exercises Assume all code compiles unless otherwise suggested. 1. The Nose class... b) will not compile because the m1 method parameter should be named n, not x. 2. The Ears class...
More informationLL LED svietidlá na osvetlenie športovísk. MMXIII-X LEADER LIGHT s.r.o. Všetky práva vyhradené. Uvedené dáta podliehajú zmenám.
LL LED svietidlá na osvetlenie športovísk MMXIII-X LEADER LIGHT s.r.o. Všetky práva vyhradené. Uvedené dáta podliehajú zmenám. LL SPORT LL SPORT je sofistikované vysoko výkonné LED svietidlo špeciálne
More informationProduced by. Design Patterns. MSc in Communications Software. Eamonn de Leastar
Design Patterns MSc in Communications Software Produced by Eamonn de Leastar (edeleastar@wit.ie) Department of Computing, Maths & Physics Waterford Institute of Technology http://www.wit.ie http://elearning.wit.ie
More informationAP CS Unit 7: Interfaces Exercises 1. Select the TRUE statement(s).
AP CS Unit 7: Interfaces Exercises 1. Select the TRUE statement(s). a) This code will not compile because a method cannot specify an interface as a parameter. public class Testing { public static void
More informationMesačná kontrolná správa
Mesačná kontrolná správa Štrukturálna štúdia mar.18 feb.18 jan.18 dec.17 nov.17 okt.17 sep.17 aug.17 júl.17 jún.17 máj.17 apr.17 mar.17 Internetová populácia SR 12+ 3 904 509 3 802 048 3 870 654 3 830
More informationJava Tutorial. Saarland University. Ashkan Taslimi. Tutorial 3 September 6, 2011
Java Tutorial Ashkan Taslimi Saarland University Tutorial 3 September 6, 2011 1 Outline Tutorial 2 Review Access Level Modifiers Methods Selection Statements 2 Review Programming Style and Documentation
More informationTextový formát na zasielanie údajov podľa 27 ods. 2 písm. f) zákona
Popis textového formátu a xsd schémy na zasielanie údajov podľa 27 ods. 2 písm. f) zákona (formu na zaslanie údajov si zvolí odosielateľ údajov) Textový formát na zasielanie údajov podľa 27 ods. 2 písm.
More information(A) 99 (B) 100 (C) 101 (D) 100 initial integers plus any additional integers required during program execution
Ch 5 Arrays Multiple Choice 01. An array is a (A) (B) (C) (D) data structure with one, or more, elements of the same type. data structure with LIFO access. data structure, which allows transfer between
More informationCMPS 12A - Winter 2002 Final Exam A March 16, Name: ID:
CMPS 12A - Winter 2002 Final Exam A March 16, 2002 Name: ID: This is a closed note, closed book exam. Any place where you are asked to write code, you must declare all variables that you use. However,
More informationLecture 14. 'for' loops and Arrays
Lecture 14 'for' loops and Arrays For Loops for (initiating statement; conditional statement; next statement) // usually incremental body statement(s); The for statement provides a compact way to iterate
More informationTP-LINK 150Mbps Wireless AP/Client Router Model TL-WR743ND Rýchly inštalačný sprievodca
TP-LINK 150Mbps Wireless AP/Client Router Model TL-WR743ND Rýchly inštalačný sprievodca Obsah balenia TL-WR743ND Rýchly inštalačný sprievodca PoE injektor Napájací adaptér CD Ethernet kábel Systémové požiadavky
More informationCPSC 310 Software Engineering. Lecture 11. Design Patterns
CPSC 310 Software Engineering Lecture 11 Design Patterns Learning Goals Understand what are design patterns, their benefits and their drawbacks For at least the following design patterns: Singleton, Observer,
More information1.00 Introduction to Computers and Engineering Problem Solving. Quiz 1 March 7, 2003
1.00 Introduction to Computers and Engineering Problem Solving Quiz 1 March 7, 2003 Name: Email Address: TA: Section: You have 90 minutes to complete this exam. For coding questions, you do not need to
More informationAutomatizované testování webových aplikací. Gabriel Ečegi
Automatizované testování webových aplikací Gabriel Ečegi Bakalářská práce 2017 ABSTRAKT Témou tejto bakalárskej práce je popis moderného prístupu k testovaniu webových aplikácií. V teoretickej časti
More informationIntroduction to Design Patterns
Dr. Michael Eichberg Software Engineering Department of Computer Science Technische Universität Darmstadt Software Engineering Introduction to Design Patterns (Design) Patterns A pattern describes... Patterns
More informationTransactions of the VŠB Technical University of Ostrava, Mechanical Series No. 2, 2009, vol. LV, article No Marek BABIUCH *, Martin HNIK **
Transactions of the VŠB Technical University of Ostrava, Mechanical Series No. 2, 2009, vol. LV, article No. 1680 Marek BABIUCH *, Martin HNIK ** USING TECHNOLOGY OF.NET WEB SERVICES IN THE AREA OF AUTOMATION
More informationCrash course on design patterns
Crash course on design patterns Yann-Gaël Guéhéneuc guehene@emn.fr From Olivier Motelet s course (2001/10/17) École des Mines de Nantes, France Object Technology International, Inc., Canada Design patterns
More informationCSC7203 : Advanced Object Oriented Development. J Paul Gibson, D311. Design Patterns
CSC7203 : Advanced Object Oriented Development J Paul Gibson, D311 paul.gibson@telecom-sudparis.eu http://www-public.tem-tsp.eu/~gibson/teaching/csc7203/ Design Patterns /~gibson/teaching/csc7203/csc7203-advancedoo-l2.pdf
More informationIntroduction to Design Patterns
Dr. Michael Eichberg Software Technology Group Department of Computer Science Technische Universität Darmstadt Introduction to Software Engineering Introduction to Design Patterns Patterns 2 PATTERNS A
More informationGetting started with Java
Getting started with Java by Vlad Costel Ungureanu for Learn Stuff Programming Languages A programming language is a formal constructed language designed to communicate instructions to a machine, particularly
More informationMcGill University School of Computer Science COMP-202A Introduction to Computing 1
McGill University School of Computer Science COMP-202A Introduction to Computing 1 Midterm Exam Thursday, October 26, 2006, 18:00-20:00 (6:00 8:00 PM) Instructors: Mathieu Petitpas, Shah Asaduzzaman, Sherif
More informationMetody. public final class Ucet {... } public final void print() {... } tato metoda nemůže být překryta (overloaded) v
Seminář Java Speciální třídy, výčtový typ Radek Kočí Fakulta informačních technologií VUT Únor 2008 Radek Kočí Seminář Java Speciální třídy, výčtový typ 1/ 25 Téma přednášky Abstraktní třídy Vnořené třídy
More informationLecture 13: Design Patterns
1 Lecture 13: Design Patterns Kenneth M. Anderson Object-Oriented Analysis and Design CSCI 6448 - Spring Semester, 2005 2 Pattern Resources Pattern Languages of Programming Technical conference on Patterns
More informationCrestron Mercury. Univerzálny Videokonferenčný a Kolaboračný systém
Crestron Mercury Univerzálny Videokonferenčný a Kolaboračný systém Tradičná malá zasadacia miestnosť CRESTRON Mercury Videokonferenčná miestnosť Možnosť rezervácie miestnosti: Prostredníctvom MS Outlook
More informationUniversity of Cape Town ~ Department of Computer Science. Computer Science 1015F ~ 2007
Name: Please fill in your Student Number and Name. Student Number : Student Number: University of Cape Town ~ Department of Computer Science Computer Science 1015F ~ 2007 Final Examination Question Max
More informationRegistrácia účtu Hik-Connect
Registrácia účtu Hik-Connect Tento návod popisuje postup registrácie účtu služby Hik-Connect prostredníctvom mobilnej aplikácie a webového rozhrania na stránke www.hik-connect.comg contents in this document
More informationPattern Resources. Lecture 25: Design Patterns. What are Patterns? Design Patterns. Pattern Languages of Programming. The Portland Pattern Repository
Pattern Resources Lecture 25: Design Patterns Kenneth M. Anderson Object-Oriented Analysis and Design CSCI 6448 - Spring Semester, 2003 Pattern Languages of Programming Technical conference on Patterns
More informationAP CS Unit 7: Interfaces. Programs
AP CS Unit 7: Interfaces. Programs You cannot use the less than () operators with objects; it won t compile because it doesn t always make sense to say that one object is less than
More informationCSE 201 JAVA PROGRAMMING I. Copyright 2016 by Smart Coding School
CSE 201 JAVA PROGRAMMING I Primitive Data Type Primitive Data Type 8-bit signed Two s complement Integer -128 ~ 127 Primitive Data Type 16-bit signed Two s complement Integer -32768 ~ 32767 Primitive Data
More informationVýučbové nástroje pre relačné a objektové databázy
Slovenská technická univerzita v Bratislave FAKULTA INFORMATIKY A INFORMAČNÝCH TECHNOLÓGIÍ Študijný program: Informatika Gabriel Tekeľ Výučbové nástroje pre relačné a objektové databázy Bakalársky projekt
More information(A) 99 ** (B) 100 (C) 101 (D) 100 initial integers plus any additional integers required during program execution
Ch 5 Arrays Multiple Choice Test 01. An array is a ** (A) data structure with one, or more, elements of the same type. (B) data structure with LIFO access. (C) data structure, which allows transfer between
More informationBIT Java Programming. Sem 1 Session 2011/12. Chapter 2 JAVA. basic
BIT 3383 Java Programming Sem 1 Session 2011/12 Chapter 2 JAVA basic Objective: After this lesson, you should be able to: declare, initialize and use variables according to Java programming language guidelines
More informationCOMP 250: Java Programming I. Carlos G. Oliver, Jérôme Waldispühl January 17-18, 2018 Slides adapted from M. Blanchette
COMP 250: Java Programming I Carlos G. Oliver, Jérôme Waldispühl January 17-18, 2018 Slides adapted from M. Blanchette Variables and types [Downey Ch 2] Variable: temporary storage location in memory.
More informationRefaktorovanie jazyka JavaScript a DHTML
Univerzita Komenského Fakulta Matematiky, Fyziky a Informatiky Ústav Informatiky Marián Marcinčák Refaktorovanie jazyka JavaScript a DHTML Diplomová práca Školiteľ : RNDr. Marián Vittek, PhD. Bratislava
More informationSequence structure. The computer executes java statements one after the other in the order in which they are written. Total = total +grade;
Control Statements Control Statements All programs could be written in terms of only one of three control structures: Sequence Structure Selection Structure Repetition Structure Sequence structure The
More informationCS 170 Exam 2. Version: A Fall Name (as in OPUS) (print): Instructions:
CS 170 Exam 2 Version: A Fall 2015 Name (as in OPUS) (print): Section: Seat Assignment: Instructions: Keep your eyes on your own paper and do your best to prevent anyone else from seeing your work. Do
More informationFaculty of Science COMP-202A - Introduction to Computing I (Fall 2008) Midterm Examination
First Name: Last Name: McGill ID: Section: Faculty of Science COMP-202A - Introduction to Computing I (Fall 2008) Midterm Examination Tuesday, November 4, 2008 Examiners: Mathieu Petitpas [Section 1] 18:30
More informationCoordinates ordering in parallel coordinates views
Univerzita Komenského v Bratislave Fakulta matematiky, fyziky a informatiky Coordinates ordering in parallel coordinates views Bratislava, 2011 Lukáš Chripko Univerzita Komenského v Bratislave Fakulta
More informationCS5000: Foundations of Programming. Mingon Kang, PhD Computer Science, Kennesaw State University
CS5000: Foundations of Programming Mingon Kang, PhD Computer Science, Kennesaw State University Overview of Source Code Components Comments Library declaration Classes Functions Variables Comments Can
More informationConstraint satisfaction problems (problémy s obmedzujúcimi podmienkami)
I2AI: Lecture 04 Constraint satisfaction problems (problémy s obmedzujúcimi podmienkami) Lubica Benuskova Reading: AIMA 3 rd ed. chap. 6 ending with 6.3.2 1 Constraint satisfaction problems (CSP) We w
More informationCOMP200 GENERICS. OOP using Java, from slides by Shayan Javed
1 1 COMP200 GENERICS OOP using Java, from slides by Shayan Javed 2 ArrayList and Java Generics 3 Collection A container object that groups multiple objects 4 Collection A container object that groups multiple
More informationVYSOKÉ UČENÍ TECHNICKÉ V BRNĚ
VYSOKÉ UČENÍ TECHNICKÉ V BRNĚ BRNO UNIVERSITY OF TECHNOLOGY FAKULTA INFORMAČNÍCH TECHNOLOGIÍ ÚSTAV POČÍTAČOVÉ GRAFIKY A MULITMÉDIÍ FACULTY OF INFORMATION TECHNOLOGY DEPARTMENT OF COMPUTER GRAPHICS AND
More informationEntity Framework: Úvod
Entity Framework: Úvod Martin Macák Fakulta informatiky, Masarykova univerzita, Brno 29. 9. 2016 Osnova prednášky 1. Základy Entity Frameworku 2. Návrh databázy (detailnejšie Code First prístup) 3. Migrácie
More informationVisitor Pattern CS356 Object-Oriented Design and Programming November 5, 2014 Yu Sun, Ph.D.
Visitor Pattern CS356 Object-Oriented Design and Programming http://cs356.yusun.io November 5, 2014 Yu Sun, Ph.D. http://yusun.io yusun@csupomona.edu Visitor Intent Represent an operation on elements of
More informationINFO Object-Oriented Programming
INFO0062 - Object-Oriented Programming Exercise session #1 - Basic Java programs Jean-François Grailet University of Liège Faculty of Applied Sciences Academic Year 2017-2018 Creating a simple Java program
More information3. Java - Language Constructs I
Educational Objectives 3. Java - Language Constructs I Names and Identifiers, Variables, Assignments, Constants, Datatypes, Operations, Evaluation of Expressions, Type Conversions You know the basic blocks
More informationIntroduction to Programming (Java) 4/12
Introduction to Programming (Java) 4/12 Michal Krátký Department of Computer Science Technical University of Ostrava Introduction to Programming (Java) 2008/2009 c 2006 2008 Michal Krátký Introduction
More informationUniversity of Cape Town ~ Department of Computer Science Computer Science 1015F ~ Test 2. Question Max Mark Internal External
Name: Please fill in your Student Number and Name. Student Number : Student Number: University of Cape Town ~ Department of Computer Science Computer Science 1015F ~ 2009 Test 2 Question Max Mark Internal
More informationLecture 14 CSE11 Fall 2013 For loops, Do While, Break, Continue
Lecture 14 CSE11 Fall 2013 For loops, Do While, Break, Continue General Loops in Java Look at other loop constructions Very common while loop: do a loop a fixed number of times (MAX in the example) int
More informationIntroduction and History
Pieter van den Hombergh Fontys Hogeschool voor Techniek en Logistiek September 15, 2016 Content /FHTenL September 15, 2016 2/28 The idea is quite old, although rather young in SE. Keep up a roof. /FHTenL
More informationSoftware Engineering - I An Introduction to Software Construction Techniques for Industrial Strength Software
Software Engineering - I An Introduction to Software Construction Techniques for Industrial Strength Software Chapter 9 Introduction to Design Patterns Copy Rights Virtual University of Pakistan 1 Design
More informationLecture Set 4: More About Methods and More About Operators
Lecture Set 4: More About Methods and More About Operators Methods Definitions Invocations More arithmetic operators Operator Side effects Operator Precedence Short-circuiting main method public static
More informationCSC 1214: Object-Oriented Programming
CSC 1214: Object-Oriented Programming J. Kizito Makerere University e-mail: jkizito@cis.mak.ac.ug www: http://serval.ug/~jona materials: http://serval.ug/~jona/materials/csc1214 e-learning environment:
More informationFollowing is the general form of a typical decision making structure found in most of the programming languages:
Decision Making Decision making structures have one or more conditions to be evaluated or tested by the program, along with a statement or statements that are to be executed if the condition is determined
More informationCS1083 Week 2: Arrays, ArrayList
CS1083 Week 2: Arrays, ArrayList mostly review David Bremner 2018-01-08 Arrays (1D) Declaring and using 2D Arrays 2D Array Example ArrayList and Generics Multiple references to an array d o u b l e prices
More informationFoundations of Software Engineering Design Patterns -- Introduction
Foundations of Software Engineering Design Patterns -- Introduction Fall 2016 Department of Computer Science Ben-Gurion university Based on slides of: Nurit Gal-oz, Department of Computer Science Ben-Gurion
More information