Fachgebiet Softwaretechnik, Heinz Nixdorf Institut, Universität Paderborn. 3. Code Generation
|
|
- Clemence Collins
- 6 years ago
- Views:
Transcription
1 3.
2 Motivation So far: Techniques for the design phase But: Implementation needed Implementation is Time consuming Error prone Necessary for each target language if done by hand Programmers make errors nondeterministicly analysis coarse design detailed design use cases test cases test cases implementation test cases modul test integration test [Broehl1993] system test acceptance test 2
3 Motivation Thus: Automatically generated code Reduced implementation effort Fewer implementation errors Errors are made deterministically and can thus be corrected systematically V-Model becomes Y-Model 3
4 V-Model vs. Y-Model V-Model Manual implementation Takes longer Phase Y-Model Use Time for implementation tends to 0 Phase analysis coarse design detailed design use cases test cases test cases implementation test cases modul test integration test acceptance test system test time analysis coarse design detailed design use cases test cases test cases code generation integration test acceptance test system test time 4
5 Motivation More advantages: (mainly) working on design level (with models) Reduced complexity Models can be verified (see chapter 5) Improved maintainability and readability of generated code Reason: sometimes code has to be reviewed or adapted manually Integration with frameworks, platforms, etc. Manual code optimization (e.g. for efficiency) No differences in code style Code can be generated for multiple target languages Important for embedded systems 5
6 General Procedure 6
7 Overview 1. for structural elements 1. Classes 2. Inheritance 3. Associations 2. for behavioral elements 1. Activity Diagrams 2. Story Diagrams 3. State Machines 7
8 1.1 Classes, Attributes and Methods Design Level Class Diagram Code Level Class Diagram Generated Source Code class Shuttle { Shuttle + speed: float + name: String + calculatedistance(loc: Location) : float Standard constructors and access methods are omitted at design level Public attributes are replaced by private fields and public access methods (information hiding principle) attribute types should be primitive (int, float, ) or immutable (String, Date, ) otherwise use an association Shuttle - speed: float - name: String + getspeed() : float + setspeed(speed: float) : void + getname() : String + setname(name: String) : void + calculatedistance(loc: Location) : float public Shuttle() { private float speed; public float getspeed() { return this.speed; public void setspeed(float speed) { this.speed = speed; private String name; public String getname() { return this.name; public void setname(string name) { this.name = name; public float calculatedistance(location loc) { 8
9 1.2 Inheritance and Templates Inheritance (in Java) Vehicle Single Inheritance only Multiple Interfaces Use composition instead of multiple inheritance Mechatronic System «interface» Autonomous Shuttle «interface» Selfoptimizing Templates / Generics Use type parameters Set + contains(element: T) : boolean + add(element: T) : void + remove(element: T) : void Code generation T class Shuttle extends MechatronicSystem implements Autonomous, Selfoptimizing{ private ShuttleDrive drive; public Shuttle(){ super(); drive = new ShuttleDrive(); Vehicle ShuttleDrive 1 drive Mechatronic System «interface» Autonomous Shuttle class Set<T> { public boolean contains(t element){ public void add(t element){ public void remove(t element){ «interface» Selfoptimizing 9
10 1.3 Bidirectional Associations Remember 2 nd lecture Registrar registrar 0..1 shuttles * Shuttle public class Registrar { private HashSet shuttles; public boolean addtoshuttles(shuttle value) { value.setregistrar(this); public boolean removefromshuttles(shuttle value) { boolean changed = false; if ((this.shuttles!= null) && (value!= null)) { changed = this.shuttles.remove (value); if (changed) { value.setregistrar (null); return changed; Consistency has to be ensured public class Shuttle { private Registrar registrar; public boolean setregistrar(registrar value) { boolean changed = false; if (this.registrar!= value) { if (this.registrar!= null) { Registrar oldvalue = this.registrar; this.registrar = null; oldvalue.removefromshuttles(this); this.registrar = value; if (value!= null) { value.addtoshuttles(this); changed = true; return changed; 10
11 1.3 Composition and Aggregation 1 ShuttleFrame class Shuttle { Shuttle Composition (black diamond) Existence dependency ( consists of ) Create parts in constructor Delete parts when whole is deleted Private set-, add-, and remove-methods (or none) Aggregation (white diamond) Close relationship Not necessarily reflected in code (only a comment at design level) * Wheel public Shuttle() { setframe(new Frame()); addtowheels(new Wheel()); addtowheels(new Wheel()); public Frame getframe() { private void setframe(frame frame) { public void addtowheels(wheel w) { public void removefromwheels(wheel w) { public removeyou() { frame.removeyou(); setframe(null); for(wheel w : wheels) { removefromwheels(w); 11
12 1.3 Ordered and qualified Associations Ordered Association Shuttle Implemented as list Alternative: {sorted, implemented as tree set Qualified Association Shuttle Destination Implemented as hash map id : int {ordered * 0..1 Component class Shuttle { private LinkedList destinations = new LinkedList(); public Destination getfirstfromdestinations() { public void addtodestinations(int position, Destination dest) { class Shuttle { private HashMap components = new HashMap(); public Component getfromcomponents(int id) { public void addtocomponents(int id, Component comp) { 12
13 2.1 Activity Diagrams Activity Diagram specifies single method (Well-formed) Control flow maps to (Java) control structures Actions / guards translate directly to code (makes diagrams language dependent) Shuttle::goto(destination : Track) Track currenttrack = this.gettrack(); [currenttrack == destination] [else] currenttrack = currenttrack.getneighbortowards(destination); this.settrack(currenttrack); class Shuttle { public void goto(track destination) { Track currenttrack = this.gettrack(); while(!currenttrack == destination){ currenttrack = currenttrack. getneighbortowards(destination); this.settrack(currenttrack); 13
14 2.1 Well-formed control flow Most well-formed activity diagrams can be generated by the following graph grammar Maps directly to Java control structures Start Graph a1 a2 Sequence ::= a1 a3 a2 Inserts an activity between two others a1 a2 Branch ::= a1 a2 Adds another transition between two activities See: A. Zündorf, Rigorous Object Oriented Software Development, Habilitation Thesis, 2001 a1 Loop ::= a1 Adds a self-transition to an activity In more detail: T. Klein, Rekonstruktion von UML-Aktivitäts- und Kollaborationsdiagrammen aus Java-Quelltexten, Diploma Thesis,
15 2.1 Non-well-formed control flow If control flow cannot be mapped to nested control structures Reduce to well-formed control flow or Number activities and simulate with while and switch constructs [cond1] [cond2] a1 a2 a3 a4 Class1::m1() [else] [else] class Class1 { public void m1 () { step = 1; while (step!= 5) { switch (step) { case 1: a1; step = 2; break; case 2: a2; step = 3; break; case 3: a3; if (cond1) step = 4; else step = 1; break; case 4: a4; if (cond2) step = 5; else step = 2; break; 15
16 2.2 Story Diagrams Story Diagram in Fujaba4Eclipse 16
17 2.2 Code translation strategy for story diagrams 1. Declare local variables 2. Identify participants 1. via to-one links (using get-methods or special collection accesses) 2. via to-many links (using nested while(!found) loops) 3. check constraints 3. Execute object modifications 1. Deletions 2. Creations 3. Attribute assignments 4. Translate collaboration statements according to sequence numbers See: A. Zündorf, Graph Pattern Matching in PROGRES, Springer, 1996 T. Fischer, J. Niere, L. Torunski, A.Zündorf, Story Diagrams: A new Graph Rewrite Language based on the Unified Modeling Language, Springer,
18 2.2 Generated Java code for story diagrams public class Shuttle { JavaSDM.ensure( ) throws a JavaSDM- Exception if the given expression is not true public void goto(track destination) { boolean fujaba Success = false; Track currenttrack = null; try { fujaba Success = false; // check object destination is really bound JavaSDM.ensure(destination!= null); // bind currenttrack: Track currenttrack = this.gettarget(); JavaSDM.ensure(currentTrack!= null); // check isomorphic binding JavaSDM.ensure(!(destination.equals(currentTrack))); // delete link this.settarget(null); // create link this.settarget(destination); fujaba Success = true ; catch(javasdmexception fujaba InternalException) { fujaba Success = false ; 18
19 Activity Diagrams vs. State Machines Activity Diagrams No concurrency (except for local concurrency) Concrete behavior expressed by story patterns or program code Sequential control flow (usually for a single method) State Machines React to events from other processes/threads Hierarchical Memory: history states Control flow usually for whole classes/components 19
20 2.3 State Machines Example: Shuttle behavior specified by a state machine Waiting assign(source, target) Active reactivate Halted emergencystop H* GoToSource destinationreached Fetch fetched GoToTarget destinationreached Deliver delivered assign(source, target) How could the corresponding (generated) code look like? 20
21 Strategy 1: Switch-Statements Halted Waiting reactivate emergencystop Implement one method for each event Redundant state checks in each method Code duplication maintenance problems assign(source, target) H* Active GoToSource Fetch GoToTarget Deliver destinationreached fetched destinationreached delivered assign(source, target) class Shuttle { public void assign (Track source, Track target) { switch(currentstate) { case WAITING: setsource(source); settarget(target); currentstate = GOTOSOURCE; gototrack(source); break; case GOTOSOURCE: setsource(source); settarget(target); currentstate = GOTOSOURCE; gototrack(source); break; case FETCH: setsource(source); settarget(target); currentstate = GOTOSOURCE; gototrack(source); break; case HALTED: /* ignore call */ break; 21
22 Strategy 2: State Design Pattern Shuttle + assign(track source, Track target) : Void + emergencystop() : Void + reactivate() : Void + setsource(track source) : Void + settarget(track target) : Void + gototrack(track track) : Void shuttle 0..1 shuttle 0..1 currentstate 1 historyofactive 1 ShuttleState + assign(track source, Track target) : Void + emergencystop() : Void + reactivate() : Void Waiting Active Halted Halted Waiting reactivate emergencystop assign(source, target) H* Active GoToSource Fetch GoToTarget Deliver destinationreached fetched destinationreached delivered + assign(track source, Track target) : Void assign(source, target) GoToSource + destinationreached() + assign(track source, Track target) : Void + emergencystop() : Void Fetch + fetched() + reactivate() One class for each state Events represented by methods Each class implements only methods for events it reacts to Nested states realized through inheritance Cmp. [Gamma et al.: Design Patterns, 1995] 22
23 Strategy 2: State Design Pattern Modeling behavior with story diagrams Shuttle class delegates the event handling to the current state Shuttle + assign(track source, Track target) : Void + emergencystop() : Void + reactivate() : Void + setsource(track source) : Void + settarget(track target) : Void + gototrack(track track) : Void shuttle 0..1 shuttle 0..1 currentstate 1 historyofactive 1 ShuttleState + assign(track source, Track target) : Void + emergencystop() : Void + reactivate() : Void Shuttle::assign (source : Track, target : Track) this currentstate 1 : assign(source, target) state : ShuttleState Waiting + assign(track source, Track target) : Void GoToSource + destinationreached() Active + assign(track source, Track target) : Void + emergencystop() : Void Fetch + fetched() Halted + reactivate() 23
24 Strategy 2: State Design Pattern Modeling behavior with story diagrams (continued) Abstract ShuttleState class contains an empty assign method (default implementation) The concrete state classes implement the state changes, e.g. Waiting class switches to state GoToSource Corresponding actions for the state are modelled by method calls, e.g. gototrack Waiting::assign (source : Track, target : Track) 1 : gototrack(source) ShuttleState::assign (source : Track, target : Track) <<create>> source source s : Shuttle <<create>> target currentstate <<create>> target currentstate <<delete>> this : GoToSource 24
25 Strategy 2: State Design Pattern Summary Object-oriented replacement of switch statements Class structure reflects the state machine s structure + Maintainability increased (compared to switch statements) + Elegant handling of nested states - Many quite small classes (one for each state) - State machine adaption requires re-implementation of state classes 25
26 Strategy 3: State Table Idea Shuttle Originally: use a table with all possible transitions for the current state Separate the state machine execution from a state machine s behavior Use a framework implementation to load arbitrary state machine models and execute them ReactiveSystem + initstatemachine : Void + run() : Void + handleevent() : Void + invoke(method m, Object[] args) : Object currentstate 1 State - name : String - entryaction : Method - exitaction : Method + gettransition(event : Event) : Transition + enter(event : Event) : Void + leave(event : Event) : Void e : Event target source transitions - name : String - action : Method - event : Event Transition + fire(event : Event) : Void receiver queue 1 {ordered n substates n initial 1 parent Event - name : String - args : Object[] ComplexState 26
27 Strategy 3: State Table Approach Shuttle Use a state machine meta-model implementation Create a (partial) state machine model (object structure at runtime) with all transitions for the current state execute a state machine using a generic event handling algorithm based on the state machine model ReactiveSystem + initstatemachine : Void + run() : Void + handleevent() : Void + invoke(method m, Object[] args) : Object currentstate 1 State - name : String - entryaction : Method - exitaction : Method + gettransition(event : Event) : Transition + enter(event : Event) : Void + leave(event : Event) : Void e : Event target source transitions - name : String - action : Method - event : Event Transition + fire(event : Event) : Void receiver queue 1 {ordered n substates n initial 1 parent Event - name : String - args : Object[] ComplexState 27
28 Strategy 3: State Table - Example initial master : ComplexState substates substates waiting : State substates t2 : Transition event = reactivate transitions [ reactive ] halted : State currentstate s : Shuttle transitions[ assign ] target target t1 : Transition event = assign target substates active : ComplexState initial substates gotosource : State transitions [ assign ] t4 : Transition event = assign target transitions[ emergencystop ] transitions[ emergencystop ] Concrete state machine 1:1 represented by object structure (based on meta model from previous slide) t3 : Transition event = emergencystop Halted Waiting reactivate emergencystop assign(source, target) H* Active GoToSource Fetch GoToTarget Deliver destinationreached fetched destinationreached delivered assign(source, target) 28
29 Strategy 3: State Table (Simplified) algorithm for event handling class ReactiveSystem { public void handleevent() { Event e = getfirstfromeventqueue(); if(e!= null) { State currentstate = getcurrentstate(); Transition transition = currentstate. gettransition(e); State nextstate = transition.gettarget(); currentstate.leave(e); transition.fire(e); nextstate.enter(e); Generic implementation: no specific state classes Allows flexible adaption at runtime Lower performance than state pattern implementation transitions[ assign ] waiting : State t1 : Transition event = assign initial substates target substates master : ComplexState substates active : ComplexState initial gotosource : State Halted substates target Waiting reactivate emergencystop t2 : Transition event = reactivate transitions [ assign ] t4 : Transition event = assign target transitions[ emergencystop ] assign(source, target) H* substates transitions[ emergencystop ] transitions [ reactive ] Active GoToSource Fetch GoToTarget Deliver halted : State target destinationreached fetched t3 : Transition event = emergencystop destinationreached delivered currentstate s : Shuttle assign(source, target) 29
30 Summary Code generation for Structural diagrams (Class diagrams) Inheritance Associations Behavioral diagrams which refine class diagrams Activity diagrams (usually for control flow of methods) Story diagrams (refine activity diagrams) State machines (usually for behavior of reactive components, i.e. whole classes instead of single methods) 30
Constructs considered
3. Code Generation Design Goals: Readability (Integration on the code level with frameworks, devices, platforms etc.) Maintainability (manual adaption of code sometimes necessary, e.g. optimization) 1
More informationLecture 3. COMP1006/1406 (the Java course) Summer M. Jason Hinek Carleton University
Lecture 3 COMP1006/1406 (the Java course) Summer 2014 M. Jason Hinek Carleton University today s agenda assignments 1 (graded) & 2 3 (available now) & 4 (tomorrow) a quick look back primitive data types
More informationStatechart Modeling with Fujaba
GraBaTs 04 Preliminary Version Statechart Modeling with Fujaba Leif Geiger Albert Zündorf University of Kassel, Software Engineering Research Group, Wilhelmshöher Allee 73, 34121 Kassel, Germany {leif.geiger
More informationCMSC 202. Containers
CMSC 202 Containers Container Definition A container is a data structure whose purpose is to hold objects. Most languages support several ways to hold objects. Arrays are compiler-supported containers.
More informationIntroduction to Programming Using Java (98-388)
Introduction to Programming Using Java (98-388) Understand Java fundamentals Describe the use of main in a Java application Signature of main, why it is static; how to consume an instance of your own class;
More informationUML & OO FUNDAMENTALS CSCI 4448/5448: OBJECT-ORIENTED ANALYSIS & DESIGN LECTURE 3 08/30/2011
UML & OO FUNDAMENTALS CSCI 4448/5448: OBJECT-ORIENTED ANALYSIS & DESIGN LECTURE 3 08/30/2011 1 Goals of the Lecture Review the material in Chapter 2 of the Textbook Cover key parts of the UML notation
More informationProgramming Language Concepts Object-Oriented Programming. Janyl Jumadinova 28 February, 2017
Programming Language Concepts Object-Oriented Programming Janyl Jumadinova 28 February, 2017 Three Properties of Object-Oriented Languages: Encapsulation Inheritance Dynamic method binding (polymorphism)
More informationCOP 3330 Final Exam Review
COP 3330 Final Exam Review I. The Basics (Chapters 2, 5, 6) a. comments b. identifiers, reserved words c. white space d. compilers vs. interpreters e. syntax, semantics f. errors i. syntax ii. run-time
More informationDistributed Systems Recitation 1. Tamim Jabban
15-440 Distributed Systems Recitation 1 Tamim Jabban Office Hours Office 1004 Tuesday: 9:30-11:59 AM Thursday: 10:30-11:59 AM Appointment: send an e-mail Open door policy Java: Object Oriented Programming
More informationAutomatic generation of behavioral code - too ambitious or even unwanted?
Automatic generation of behavioral - too ambitious or even unwanted? Gregor Engels University of Twente, The Netherlands 23 June 2009 Professional Activities Gregor Engels University of Paderborn Head
More informationArrays. Chapter Arrays What is an Array?
Chapter 8 Arrays 81 Arrays 811 What is an Array? To motivate why we might be interested in using arrays, let us implement an app that creates a collection of doubles We will keep track of the number of
More informationSOFTWARE DESIGN COSC 4353 / Dr. Raj Singh
SOFTWARE DESIGN COSC 4353 / 6353 Dr. Raj Singh UML - History 2 The Unified Modeling Language (UML) is a general purpose modeling language designed to provide a standard way to visualize the design of a
More informationJAVA MOCK TEST JAVA MOCK TEST II
http://www.tutorialspoint.com JAVA MOCK TEST Copyright tutorialspoint.com This section presents you various set of Mock Tests related to Java Framework. You can download these sample mock tests at your
More informationCMSC 202H. Containers and Iterators
CMSC 202H Containers and Iterators Container Definition A container is a data structure whose purpose is to hold objects. Most languages support several ways to hold objects Arrays are compiler-supported
More informationDOWNLOAD PDF CORE JAVA APTITUDE QUESTIONS AND ANSWERS
Chapter 1 : Chapter-wise Java Multiple Choice Questions and Answers Interview MCQs Java Programming questions and answers with explanation for interview, competitive examination and entrance test. Fully
More informationData Abstraction and Abstract Data Types
Data Abstraction and Abstract Data Types Tessema M. Mengistu Department of Computer Science Southern Illinois University Carbondale tessema.mengistu@siu.edu Room - 3131 1 Outline Abstract Data types (ADT)
More informationWeek. Lecture Topic day (including assignment/test) 1 st 1 st Introduction to Module 1 st. Practical
Name of faculty: Gaurav Gambhir Discipline: Computer Science Semester: 6 th Subject: CSE 304 N - Essentials of Information Technology Lesson Plan Duration: 15 Weeks (from January, 2018 to April, 2018)
More informationDay 3. COMP 1006/1406A Summer M. Jason Hinek Carleton University
Day 3 COMP 1006/1406A Summer 2016 M. Jason Hinek Carleton University today s agenda assignments 1 was due before class 2 is posted (be sure to read early!) a quick look back testing test cases for arrays
More informationStory Diagrams: A new Graph Grammar Language based on the Unified Modelling Language and Java
Story Diagrams: A new Graph Grammar Language based on the Unified Modelling Language and Java Thorsten Fischer, Jörg Niere, Lars Torunski, Albert Zündorf AG-Softwaretechnik, Fachbereich 17, Universität
More informationSubclass Gist Example: Chess Super Keyword Shadowing Overriding Why? L10 - Polymorphism and Abstract Classes The Four Principles of Object Oriented
Table of Contents L01 - Introduction L02 - Strings Some Examples Reserved Characters Operations Immutability Equality Wrappers and Primitives Boxing/Unboxing Boxing Unboxing Formatting L03 - Input and
More informationConcepts of Programming Languages
Concepts of Programming Languages Lecture 10 - Object-Oriented Programming Patrick Donnelly Montana State University Spring 2014 Patrick Donnelly (Montana State University) Concepts of Programming Languages
More informationCSCI-142 Exam 1 Review September 25, 2016 Presented by the RIT Computer Science Community
CSCI-12 Exam 1 Review September 25, 2016 Presented by the RIT Computer Science Community http://csc.cs.rit.edu 1. Provide a detailed explanation of what the following code does: 1 public boolean checkstring
More informationLecture 16: Hierarchical State Machines II
Software Design, Modelling and Analysis in UML Lecture 6: Hierarchical State Machines II 206-0-9 6 206-0-9 main Prof. Dr. Andreas Podelski, Dr. Bernd Westphal Albert-Ludwigs-Universität Freiburg, Germany
More informationIndex. Index. More information. block statements 66 y 107 Boolean 107 break 55, 68 built-in types 107
A abbreviations 17 abstract class 105 abstract data types 105 abstract method 105 abstract types 105 abstraction 92, 105 access level 37 package 114 private 115 protected 115 public 115 accessors 24, 105
More informationSELECTION. (Chapter 2)
SELECTION (Chapter 2) Selection Very often you will want your programs to make choices among different groups of instructions For example, a program processing requests for airline tickets could have the
More informationDay 4. COMP1006/1406 Summer M. Jason Hinek Carleton University
Day 4 COMP1006/1406 Summer 2016 M. Jason Hinek Carleton University today s agenda assignments questions about assignment 2 a quick look back constructors signatures and overloading encapsulation / information
More information2.4 Graph Grammars Part 2
2.4 Graph Grammars Part 2 Studentische Hilfskraft (m/w) MBSE mit UML/SysML Themengebiet: Model-Based Systems Engineering Die Entwicklung mechatronischer Systeme erfordert das Zusammenarbeiten verschiedenster
More information182 review 1. Course Goals
Course Goals 182 review 1 More experience solving problems w/ algorithms and programs minimize static methods use: main( ) use and overload constructors multiple class designs and programming solutions
More informationJava Fundamentals (II)
Chair of Software Engineering Languages in Depth Series: Java Programming Prof. Dr. Bertrand Meyer Java Fundamentals (II) Marco Piccioni static imports Introduced in 5.0 Imported static members of a class
More informationDistributed Systems Recitation 1. Tamim Jabban
15-440 Distributed Systems Recitation 1 Tamim Jabban Office Hours Office 1004 Sunday, Tuesday: 9:30-11:59 AM Appointment: send an e-mail Open door policy Java: Object Oriented Programming A programming
More informationSoftware Service Engineering
Software Service Engineering Lecture 4: Unified Modeling Language Doctor Guangyu Gao Some contents and notes selected from Fowler, M. UML Distilled, 3rd edition. Addison-Wesley Unified Modeling Language
More informationTopics in Object-Oriented Design Patterns
Software design Topics in Object-Oriented Design Patterns Material mainly from the book Design Patterns by Erich Gamma, Richard Helm, Ralph Johnson and John Vlissides; slides originally by Spiros Mancoridis;
More informationGrouping Objects (I)
KTH ROYAL INSTITUTE OF TECHNOLOGY Stockholm Sweden Grouping Objects (I) Managing collections of objects Ric Glassey glassey@kth.se Main concepts to be covered Grouping Objects Using ArrayLists Looping
More informationAbout this exam review
Final Exam Review About this exam review I ve prepared an outline of the material covered in class May not be totally complete! Exam may ask about things that were covered in class but not in this review
More informationChapter 1: Principles of Programming and Software Engineering
Chapter 1: Principles of Programming and Software Engineering Data Abstraction & Problem Solving with C++ Fifth Edition by Frank M. Carrano Software Engineering and Object-Oriented Design Coding without
More informationLecture 3. Lecture
True Object-Oriented programming: Dynamic Objects Static Object-Oriented Programming Reference Variables Eckel: 30-31, 41-46, 107-111, 114-115 Riley: 5.1, 5.2 D0010E Object-Oriented Programming and Design
More informationData abstractions: ADTs Invariants, Abstraction function. Lecture 4: OOP, autumn 2003
Data abstractions: ADTs Invariants, Abstraction function Lecture 4: OOP, autumn 2003 Limits of procedural abstractions Isolate implementation from specification Dependency on the types of parameters representation
More informationObject Oriented Programming: In this course we began an introduction to programming from an object-oriented approach.
CMSC 131: Chapter 28 Final Review: What you learned this semester The Big Picture Object Oriented Programming: In this course we began an introduction to programming from an object-oriented approach. Java
More informationCS/B.TECH/CSE(New)/SEM-5/CS-504D/ OBJECT ORIENTED PROGRAMMING. Time Allotted : 3 Hours Full Marks : 70 GROUP A. (Multiple Choice Type Question)
CS/B.TECH/CSE(New)/SEM-5/CS-504D/2013-14 2013 OBJECT ORIENTED PROGRAMMING Time Allotted : 3 Hours Full Marks : 70 The figures in the margin indicate full marks. Candidates are required to give their answers
More informationITI Introduction to Computing II
ITI 1121. Introduction to Computing II Marcel Turcotte School of Electrical Engineering and Computer Science Binary search tree (part I) Version of March 24, 2013 Abstract These lecture notes are meant
More informationAP COMPUTER SCIENCE JAVA CONCEPTS IV: RESERVED WORDS
AP COMPUTER SCIENCE JAVA CONCEPTS IV: RESERVED WORDS PAUL L. BAILEY Abstract. This documents amalgamates various descriptions found on the internet, mostly from Oracle or Wikipedia. Very little of this
More informationITI Introduction to Computing II
ITI 1121. Introduction to Computing II Marcel Turcotte School of Electrical Engineering and Computer Science Binary search tree (part I) Version of March 24, 2013 Abstract These lecture notes are meant
More informationSDC Design patterns GoF
SDC Design patterns GoF Design Patterns The design pattern concept can be viewed as an abstraction of imitating useful parts of other software products. The design pattern is a description of communicating
More informationLecture 2: Java & Javadoc
Lecture 2: Java & Javadoc CS 62 Fall 2018 Alexandra Papoutsaki & William Devanny 1 Instance Variables or member variables or fields Declared in a class, but outside of any method, constructor or block
More informationNews and information! Review: Java Programs! Feedback after Lecture 2! Dead-lines for the first two lab assignment have been posted.!
True object-oriented programming: Dynamic Objects Reference Variables D0010E Object-Oriented Programming and Design Lecture 3 Static Object-Oriented Programming UML" knows-about Eckel: 30-31, 41-46, 107-111,
More informationJava How to Program, 10/e. Copyright by Pearson Education, Inc. All Rights Reserved.
Java How to Program, 10/e Education, Inc. All Rights Reserved. Each class you create becomes a new type that can be used to declare variables and create objects. You can declare new classes as needed;
More informationDesign Patterns with Fujaba Intense Course, 5th-9th October Ruben Jubeh
Design Patterns with Fujaba Intense Course, 5th-9th October 2009 Ruben Jubeh ruben.jubeh@uni-kassel.de Kassel University Department of Software Engineering Wilhelmshöher Allee 73 34121 Kassel Germany Timetable
More informationCONTENTS. PART 1 Structured Programming 1. 1 Getting started 3. 2 Basic programming elements 17
List of Programs xxv List of Figures xxix List of Tables xxxiii Preface to second version xxxv PART 1 Structured Programming 1 1 Getting started 3 1.1 Programming 3 1.2 Editing source code 5 Source code
More informationIntroduction to Visual Basic and Visual C++ Introduction to Java. JDK Editions. Overview. Lesson 13. Overview
Introduction to Visual Basic and Visual C++ Introduction to Java Lesson 13 Overview I154-1-A A @ Peter Lo 2010 1 I154-1-A A @ Peter Lo 2010 2 Overview JDK Editions Before you can write and run the simple
More informationPASS4TEST IT 인증시험덤프전문사이트
PASS4TEST IT 인증시험덤프전문사이트 http://www.pass4test.net 일년동안무료업데이트 Exam : 1z0-809 Title : Java SE 8 Programmer II Vendor : Oracle Version : DEMO Get Latest & Valid 1z0-809 Exam's Question and Answers 1 from
More informationSubclassing for ADTs Implementation
Object-Oriented Design Lecture 8 CS 3500 Fall 2009 (Pucella) Tuesday, Oct 6, 2009 Subclassing for ADTs Implementation An interesting use of subclassing is to implement some forms of ADTs more cleanly,
More informationChapter 1: Programming Principles
Chapter 1: Programming Principles Object Oriented Analysis and Design Abstraction and information hiding Object oriented programming principles Unified Modeling Language Software life-cycle models Key
More informationLecturer: Sebastian Coope Ashton Building, Room G.18 COMP 201 web-page:
Lecturer: Sebastian Coope Ashton Building, Room G.18 E-mail: coopes@liverpool.ac.uk COMP 201 web-page: http://www.csc.liv.ac.uk/~coopes/comp201 Lecture 17 Concepts of Object Oriented Design Object-Oriented
More informationMIT AITI Lecture 18 Collections - Part 1
MIT AITI 2004 - Lecture 18 Collections - Part 1 Collections API The package java.util is often called the "Collections API" Extremely useful classes that you must understand to be a competent Java programmer
More informationIndex COPYRIGHTED MATERIAL
Index COPYRIGHTED MATERIAL Note to the Reader: Throughout this index boldfaced page numbers indicate primary discussions of a topic. Italicized page numbers indicate illustrations. A abstract classes
More informationModel Solutions. COMP 103: Test May, 2013
Family Name:............................. Other Names:............................. ID Number:............................... Signature.................................. Instructions Time allowed: 45 minutes
More informationCollections, Maps and Generics
Collections API Collections, Maps and Generics You've already used ArrayList for exercises from the previous semester, but ArrayList is just one part of much larger Collections API that Java provides.
More informationUNIT I. 3. Write a short notes on process view of 4+1 architecture. 4. Why is object-oriented approach superior to procedural approach?
Department: Information Technology Questions Bank Class: B.E. (I.T) Prof. Bhujbal Dnyaneshwar K. Subject: Object Oriented Modeling & Design dnyanesh.bhujbal11@gmail.com ------------------------------------------------------------------------------------------------------------
More informationWhat is it? CMSC 433 Programming Language Technologies and Paradigms Spring Approach 1. Disadvantage of Approach 1
CMSC 433 Programming Language Technologies and Paradigms Spring 2007 Singleton Pattern Mar. 13, 2007 What is it? If you need to make sure that there can be one and only one instance of a class. For example,
More informationTop Down Design vs. Modularization
6.170 Quiz Review Topics: 1. Decoupling 2. 3. AF & RI 4. Iteration Abstraction & Iterators 5. OMs and Invariants 6. Equality, Copying, Views 7. 8. Design Patterns 9. Subtyping 10. Case Studies Decomposition
More informationArrays. https://docs.oracle.com/javase/tutorial/java/nutsandbolts/arrays.html
1 Arrays Arrays in Java an array is a container object that holds a fixed number of values of a single type the length of an array is established when the array is created 2 https://docs.oracle.com/javase/tutorial/java/nutsandbolts/arrays.html
More informationBCS THE CHARTERED INSTITUTE FOR IT. BCS HIGHER EDUCATION QUALIFICATIONS BCS Level 5 Diploma in IT OBJECT ORIENTED PROGRAMMING
BCS THE CHARTERED INSTITUTE FOR IT BCS HIGHER EDUCATION QUALIFICATIONS BCS Level 5 Diploma in IT OBJECT ORIENTED PROGRAMMING Wednesady 23 rd March 2016 Afternoon Answer any FOUR questions out of SIX. All
More informationFAQ: Classes & Objects
Question 1: How do I define a class as a data type? Answer 1: Data types in Java can be simple data types such as integers and floating point numbers. Data types can also be complex, collecting many different
More informationC08: Inheritance and Polymorphism
CISC 3120 C08: Inheritance and Polymorphism Hui Chen Department of Computer & Information Science CUNY Brooklyn College 2/26/2018 CUNY Brooklyn College 1 Outline Recap and issues Project progress? Practice
More informationWeiss Chapter 1 terminology (parenthesized numbers are page numbers)
Weiss Chapter 1 terminology (parenthesized numbers are page numbers) assignment operators In Java, used to alter the value of a variable. These operators include =, +=, -=, *=, and /=. (9) autoincrement
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 informationProgramming Languages and Techniques (CIS120)
Programming Languages and Techniques () Lecture 20 February 28, 2018 Transition to Java Announcements HW05: GUI programming Due: THURSDAY!! at 11:59:59pm Lots of TA office hours today Thursday See Piazza
More informationIntroduction to Unified Modelling Language (UML)
IMPORTANT NOTICE TO STUDENTS These slides are NOT to be used as a replacement for student notes. These slides are sometimes vague and incomplete on purpose to spark a class discussion Introduction to Unified
More informationLecture 6. COMP1006/1406 (the OOP course) Summer M. Jason Hinek Carleton University
Lecture 6 COMP1006/1406 (the OOP course) Summer 2014 M. Jason Hinek Carleton University today s agenda assignments A1,A2,A3 are all marked A4 marking just started A5 is due Friday, A6 is due Monday a quick
More informationPieter van den Hombergh. Fontys Hogeschool voor Techniek en Logistiek. September 9, 2016
Pieter van den Hombergh Fontys Hogeschool voor Techniek en Logistiek September 9, 2016 Contents /FHTenL September 9, 2016 2/35 UML State Uses and application In behaviour is modeled with state charts (diagrams)
More informationCOMP200 INHERITANCE. OOP using Java, from slides by Shayan Javed
1 1 COMP200 INHERITANCE OOP using Java, from slides by Shayan Javed 2 Inheritance Derive new classes (subclass) from existing ones (superclass). Only the Object class (java.lang) has no superclass Every
More informationCOMP 202 Java in one week
COMP 202 Java in one week... Continued CONTENTS: Return to material from previous lecture At-home programming exercises Please Do Ask Questions It's perfectly normal not to understand everything Most of
More informationClasses, interfaces, & documentation. Review of basic building blocks
Classes, interfaces, & documentation Review of basic building blocks Objects Data structures literally, storage containers for data constitute object knowledge or state Operations an object can perform
More informationUML & OO Fundamentals. CSCI 4448/5448: Object-Oriented Analysis & Design Lecture 3 09/04/2012
UML & OO Fundamentals CSCI 4448/5448: Object-Oriented Analysis & Design Lecture 3 09/04/2012 1 Goals of the Lecture Review the material in Chapter 2 of the Textbook Cover key parts of the UML notation
More informationOutline. Computer Science 331. Information Hiding. What This Lecture is About. Data Structures, Abstract Data Types, and Their Implementations
Outline Computer Science 331 Data Structures, Abstract Data Types, and Their Implementations Mike Jacobson 1 Overview 2 ADTs as Interfaces Department of Computer Science University of Calgary Lecture #8
More informationObject Oriented Programming is a programming method that combines: Advantage of Object Oriented Programming
Overview of OOP Object Oriented Programming is a programming method that combines: a) Data b) Instructions for processing that data into a self-sufficient object that can be used within a program or in
More informationAbstract Classes and Interfaces
Abstract Classes and Interfaces Reading: Reges and Stepp: 9.5 9.6 CSC216: Programming Concepts Sarah Heckman 1 Abstract Classes A Java class that cannot be instantiated, but instead serves as a superclass
More informationPieter van den Hombergh Thijs Dorssers Stefan Sobek. January 11, 2018
Inheritance and Inheritance and Pieter van den Hombergh Thijs Dorssers Stefan Sobek Java Inheritance Example I Visibility peekabo Constructors Fontys Hogeschool voor Techniek en Logistiek January 11, 2018
More informationObject Oriented Programming in Java. Jaanus Pöial, PhD Tallinn, Estonia
Object Oriented Programming in Java Jaanus Pöial, PhD Tallinn, Estonia Motivation for Object Oriented Programming Decrease complexity (use layers of abstraction, interfaces, modularity,...) Reuse existing
More informationInheritance and Polymorphism
Object Oriented Programming Designed and Presented by Dr. Ayman Elshenawy Elsefy Dept. of Systems & Computer Eng.. Al-Azhar University Website: eaymanelshenawy.wordpress.com Email : eaymanelshenawy@azhar.edu.eg
More informationDay 6. COMP1006/1406 Summer M. Jason Hinek Carleton University
Day 6 COMP1006/1406 Summer 2016 M. Jason Hinek Carleton University today s agenda assignments Assignment 3 is due on Monday a quick look back abstract classes and interfaces casting objects abstract data
More information2 UML for OOAD. 2.1 What is UML? 2.2 Classes in UML 2.3 Relations in UML 2.4 Static and Dynamic Design with UML. UML for OOAD Stefan Kluth 1
2 UML for OOAD 2.1 What is UML? 2.2 Classes in UML 2.3 Relations in UML 2.4 Static and Dynamic Design with UML UML for OOAD Stefan Kluth 1 2.1 UML Background "The Unified Modelling Language (UML) is a
More information15CS45 : OBJECT ORIENTED CONCEPTS
15CS45 : OBJECT ORIENTED CONCEPTS QUESTION BANK: What do you know about Java? What are the supported platforms by Java Programming Language? List any five features of Java? Why is Java Architectural Neutral?
More informationEfficient Java (with Stratosphere) Arvid Heise, Large Scale Duplicate Detection
Efficient Java (with Stratosphere) Arvid Heise, Large Scale Duplicate Detection Agenda 2 Bottlenecks Mutable vs. Immutable Caching/Pooling Strings Primitives Final Classloaders Exception Handling Concurrency
More informationDesign Pattern What is a Design Pattern? Design Pattern Elements. Almas Ansari Page 1
What is a Design Pattern? Each pattern Describes a problem which occurs over and over again in our environment,and then describes the core of the problem Novelists, playwrights and other writers rarely
More informationConcurrent Programming using Threads
Concurrent Programming using Threads Threads are a control mechanism that enable you to write concurrent programs. You can think of a thread in an object-oriented language as a special kind of system object
More informationEXAMINATIONS 2011 Trimester 2, MID-TERM TEST. COMP103 Introduction to Data Structures and Algorithms SOLUTIONS
T E W H A R E W Ā N A N G A O T E Ū P O K O O T E I K A A M Ā U I VUW V I C T O R I A UNIVERSITY OF WELLINGTON Student ID:....................... EXAMINATIONS 2011 Trimester 2, MID-TERM TEST COMP103 Introduction
More informationPrelim 2. CS 2110, November 20, 2014, 7:30 PM Extra Total Question True/False Short Answer
Prelim 2 CS 2110, November 20, 2014, 7:30 PM 1 2 3 4 5 Extra Total Question True/False Short Answer Complexity Induction Trees Graphs Extra Credit Max 20 10 15 25 30 5 100 Score Grader The exam is closed
More informationFundamental language mechanisms
Java Fundamentals Fundamental language mechanisms The exception mechanism What are exceptions? Exceptions are exceptional events in the execution of a program Depending on how grave the event is, the program
More informationQuestions: ECE551 PRACTICE Final
ECE551 PRACTICE Final This is a full length practice midterm exam. If you want to take it at exam pace, give yourself 175 minutes to take the entire test. Just like the real exam, each question has a point
More informationFor this section, we will implement a class with only non-static features, that represents a rectangle
For this section, we will implement a class with only non-static features, that represents a rectangle 2 As in the last lecture, the class declaration starts by specifying the class name public class Rectangle
More informationTopic 10: The Java Collections Framework (and Iterators)
Topic 10: The Java Collections Framework (and Iterators) A set of interfaces and classes to help manage collections of data. Why study the Collections Framework? very useful in many different kinds of
More informationECE 122. Engineering Problem Solving with Java
ECE 122 Engineering Problem Solving with Java Lecture 17 Inheritance Overview Problem: Can we create bigger classes from smaller ones without having to repeat information? Subclasses: a class inherits
More informationExercise Unit 2: Modeling Paradigms - RT-UML. UML: The Unified Modeling Language. Statecharts. RT-UML in AnyLogic
Exercise Unit 2: Modeling Paradigms - RT-UML UML: The Unified Modeling Language Statecharts RT-UML in AnyLogic Simulation and Modeling I Modeling with RT-UML 1 RT-UML: UML Unified Modeling Language a mix
More informationCMPSCI 187: Programming With Data Structures. Lecture #21: Array-Based Lists David Mix Barrington 26 October 2012
CMPSCI 187: Programming With Data Structures Lecture #21: Array-Based Lists David Mix Barrington 26 October 2012 Array-Based Lists Comparing Objects: equals and Comparable Lists: Unsorted, Sorted, and
More informationCOMP 401 Spring 2013 Midterm 1
COMP 401 Spring 2013 Midterm 1 I have not received nor given any unauthorized assistance in completing this exam. Signature: Name: PID: Please be sure to put your PID at the top of each page. This page
More informationThe Fujaba Statechart Synthesis Approach
The Fujaba Statechart Synthesis Approach Thomas Maier, Albert Zündorf University of Kassel, Germany thomas.maier@uni-kassel.de, albert.zuendorf@uni-kassel.de Abstract The Fujaba project tries to provide
More informationOperational Semantics. One-Slide Summary. Lecture Outline
Operational Semantics #1 One-Slide Summary Operational semantics are a precise way of specifying how to evaluate a program. A formal semantics tells you what each expression means. Meaning depends on context:
More informationUnified Modeling Language
Unified Modeling Language Software technology Szoftvertechnológia Dr. Balázs Simon BME, IIT Outline UML Diagrams: Sequence Diagram Communication Diagram Interaction Overview Diagram Dr. Balázs Simon, BME,
More informationProgramming II (CS300)
1 Programming II (CS300) Chapter 11: Binary Search Trees MOUNA KACEM mouna@cs.wisc.edu Fall 2018 General Overview of Data Structures 2 Introduction to trees 3 Tree: Important non-linear data structure
More information