Today s Topics. Program Realisation 2. How code and configuration data of forms are organized.

Size: px
Start display at page:

Download "Today s Topics. Program Realisation 2. How code and configuration data of forms are organized."

Transcription

1 Program Realisation Today s Topics hemerik/ip0/ Lecture 9 Kees Hemerik Tom Verhoeff Technische Universiteit Eindhoven Faculteit Wiskunde en Informatica Software Engineering & Technology Feedback to T.Verhoeff@TUE.NL How code and configuration data of forms are organized Event mechanism in Delphi Call-Back routines to reduce coupling Memory leaks, dangling references UML: Unified Modeling Language Final Assignment part 3: Backtracking to solve packing puzzles Conclusion c 007, T. TUE.NL 1 Program Realization : Lecture 9 c 007, T. TUE.NL Program Realization : Lecture 9 Code Organization of Forms and Controls in Unit1.pas 1 unit Unit1; 3 interface 4 5 uses 6..., Forms,...; 7 8 type 9 TForm1 = class(tform) 10 (* Controls and other components, managed by Delphi IDE *) (* Event handlers declarations, managed by Delphi IDE *) c 007, T. TUE.NL 3 Program Realization : Lecture 9 Code Organization of Forms and Controls in Unit1.pas 15 // Additional fields & methods, declared by appl. developer 16 private public end; 1 var 3 Form1: TForm1; 4 5 implementation 6 // Event handler implementations, provided by appl. developer 7 // Additional method implementations by appl developer end. c 007, T. TUE.NL 3 Program Realization : Lecture 9

2 Main.pas of Final Assignment Configuration Parameters of Forms and Controls in Unit1.dfm 1 uses..., Forms,..., Base, PuzzleIO,...; 3 type 4 TForm1 = class(tform) 5 PiecesGrid: TStringGrid; procedure PiecesGridDrawCell(Sender: TObject; ACol, ARow: Integer; 8 Rect: TRect; State: TGridDrawState); public 11 FPuzzle: TPuzzle; // the puzzle being manipulated 1 13 // Globals to support dragging of a piece 14 FDragOldPosition: TPosition; // position of piece at start of drag 15 FDragPlacement: TPlacement; // piece and orientation being dragged end; 1 object Form1: TForm1 Left = 9 3 Top = Width = Height = Caption = Form object PiecesGrid: TStringGrid 9 Left = 5 10 Top = Width = Height = ColCount = end end c 007, T. TUE.NL 4 Program Realization : Lecture 9 c 007, T. TUE.NL 5 Program Realization : Lecture 9 Event Mechanism in Delphi: Main Event Loop 1 program PuzzleProject; 3 uses 4 Forms, 5 Main in Main.pas {Form1}, 6 Base in Base.pas ; 7 8 begin 9 Application.Initialize; 10 Application.CreateForm(TForm1, Form1); 11 Application.Run; 1 end. Application.Run starts the main event loop The main event loop waits for an event and calls its event handler c 007, T. TUE.NL 6 Program Realization : Lecture 9 Event Mechanism in Delphi: Event Events are triggered by user actions and object state changes Events are implemented as private fields with method pointers, e.g. of type TNotifyEvent TNotifyEvent = procedure (Sender: TObject) of object; Procedure types Cannot be accommodated in the static call graph c 007, T. TUE.NL 7 Program Realization : Lecture 9

3 Event Handlers Configured in Main.dfm of Final Assignment Adding Automatic Solvers to Final Assignment 1 object Form1: TForm object PiecesGrid: TStringGrid OnDragDrop = PiecesGridDragDrop 6 OnDragOver = PiecesGridDragOver 7 OnDrawCell = PiecesGridDrawCell 8 OnEndDrag = PiecesGridEndDrag 9 OnMouseDown = PiecesGridMouseDown 10 OnStartDrag = PiecesGridStartDrag 11 end end Problem : provide unit Solvers, finding solutions and showing them on the main form Dilemma : Main.pas needs to use Solvers.pas to invoke a solver Solvers.pas needs to access Main.pas to show solutions This could result in mutual dependence: tight coupling Tight coupling reduces maintainability c 007, T. TUE.NL 8 Program Realization : Lecture 9 c 007, T. TUE.NL 9 Program Realization : Lecture 9 Using Call-Backs to User Interface to reduce coupling In Solvers.pas, define OnFound: TNotifyEvent, which the solver invokes to signal that a solution is found Main.pas uses Solvers.pas and configures OnFound with a local handler Main.pas invokes the solver when user clicks FindAll button Solvers.pas does not need to know where OnFound is handled Solvers.pas does not use Main.pas; both use Classes (TNotifyEvent) and Base.pas (FPuzzle) c 007, T. TUE.NL 10 Program Realization : Lecture 9 1 unit Solvers; 3 interface 4 5 uses Call-Back in Solvers.pas 6 Classes, Base; (* does not use Main *) 7 8 type 9 TSolver = class(tobject) 10 protected 11 FPuzzle: TPuzzle; 1 FSolutionCount: Integer; 13 FOnFound: TNotifyEvent; 14 procedure SolutionFound; c 007, T. TUE.NL 11 Program Realization : Lecture 9

4 15 public Call-Back in Solvers.pas 16 // construction/destruction constructor Create(APuzzle: TPuzzle); 18 { create a solver for APuzzle, calling OnFound for each sol 19 // commands procedure FindAll; virtual; abstract; 1 // pre: FPuzzle <> nil // post: all solutions have been found, and 3 // SolutionFound has been called for each of them. 4 5 property Puzzle: TPuzzle read FPuzzle write FPuzzle; 6 property SolutionCount: Integer read FSolutionCount; 7 property OnFound: TNotifyEvent read FOnFound write FOnFound; 8 end; c 007, T. TUE.NL 11 Program Realization : Lecture implementation Call-Back in Solvers.pas 34 procedure TSolver.SolutionFound; 35 begin 36 FSolutionCount := FSolutionCount + 1; 37 if Assigned(FOnFound) 38 then FOnFound(Self); 39 end; c 007, T. TUE.NL 11 Program Realization : Lecture 9 Setting up Call-Back in Main.pas 1 FSolver: TSolver; // the selected automatic solver... 3 procedure TForm1.SolutionFound(Sender: TObject); 4 begin 5 UpdateViews; 6 LogBoxState( Format( Solution: %d, [FSolver.SolutionCount])); 7 end; 8 9 procedure TForm1.ShowSolutionsCheckBoxClick(Sender: TObject); 10 begin 11 if ShowSolutionsCheckBox.Checked 1 then FSolver.OnFound := SolutionFound 13 else FSolver.OnFound := nil; 14 end; c 007, T. TUE.NL 1 Program Realization : Lecture 9 Memory Leaks and Dangling References Memory leak : after p := q or New(p) or p :=...Create(...), (old p)ˆ is possibly still allocated but unreachable The amount of usable memory has diminished ( leaked away) GetHeapStatus reports some memory statistics (e.g. TotalAllocated) Dangling references : after Dispose(p) or p.free, other references could still point to (old p)ˆ References to disposed/freed objects are called dangling The objects pointed to are no longer valid and must not be used c 007, T. TUE.NL 13 Program Realization : Lecture 9

5 Memory Leaks and Dangling References: Examples See final assignment, Main.pas: 1 procedure TForm1.DoReadPuzzle(AFileName: String); begin 3 ClearPiecesGrid; 4 FPuzzle.Free; 5 FPuzzle := ReadPuzzle(AFileName); 6 end; Omitting FPuzzle.Free causes a memory leak after line 5 Omitting ClearPiecesGrid, causes the placements in PiecesGrid.Objects to contain dangling references after line 4 It is an (implicit) invariant that PiecesGrid.Objects contains placements referring to FPuzzle. c 007, T. TUE.NL 14 Program Realization : Lecture 9 Differences between Dispose, Destroy, Free, FreeAndNil procedure Dispose(p: Pointer) frees dynamic variable pˆ created by New destructor Destroy; virtual; cleans up memory; override in descendant for additional clean-up; do not call directly procedure Free (method) invokes Destroy if Self <> nil procedure FreeAndNil(var Obj) frees Obj and sets it to nil c 007, T. TUE.NL 15 Program Realization : Lecture 9 UML: Unified Modeling Language Standard graphical language for modeling object-oriented software Final Assignment: Part 3 Process (count, show) each solution of packing puzzle P once Syntax: Diagrams, but also textual representation (OCL) Semantics: somewhat controversial For (static) structure and (dynamic) behavior Extensible, still evolving Not a design method c 007, T. TUE.NL 16 Program Realization : Lecture 9 Generalization: once process each solution of P that is an extension of partial solution Q Original problem: Q = Trivial when Q is total solution: box full or all pieces used Step: extend partial solution with a placement Various options: occupy unoccupied cell or use available piece c 007, T. TUE.NL 17 Program Realization : Lecture 9

6 Final Assignment: Backtracking ingredients Backtracking optimizations 1. Determine whether a partial solution is total. Process a solution 3. Traverse all unoccupied box cells C 4. Traverse all available pieces 5. For each available piece, traverse all its orientations 6. For each orientation, traverse all its possible placements at C 7. Determine whether a placement fits 8. Do a placement 9. Remove a placement c 007, T. TUE.NL 18 Program Realization : Lecture 9 Which unoccupied cell to occupy? Which placements to try of an available piece? Most placements can be eliminated, when taking into account the shape constraint of the occupied region and the order of positions in an orientation... Note: Currently no order constraint on positions in an orientation c 007, T. TUE.NL 19 Program Realization : Lecture 9 Finishing IP0 Main Theme: Modular Structure Registered in PEACH for PR/0607 Sufficient results for all lab assignments Final Assignment: individual work Submission deadline first round: Sun 1 July 007 at 3:00 Manage Complexity Separation of Concerns Divide and Conquer Design by Contract Submission deadline second round: Sun 30 Sept 007 at 3:00 c 007, T. TUE.NL 0 Program Realization : Lecture 9 c 007, T. TUE.NL 1 Program Realization : Lecture 9

7 Why Modular Structure? How to Design Correct construction Manage complexity Team construction Reduce development time Verification Errors are inevitable Adaptation Change is inevitable Reuse Reduce budget c 007, T. TUE.NL Program Realization : Lecture 9 During design, many decisions must be made Design guidelines, principles, and methods are needed Modular structure: how to find the modules Top-down design, stepwise refinement, functional decomposition Bottom-up design Functionality versus data as basis for modularity c 007, T. TUE.NL 3 Program Realization : Lecture 9 Main Themes What Next? Abstract Data Types and object-oriented programming Recursion, both in control and in data Event-driven, interactive Graphical User Interfaces Borland Delphi with Object Pascal New curriculum... Algorithms and Data Structures Threads, Network communication, database connection c 007, T. TUE.NL 4 Program Realization : Lecture 9 c 007, T. TUE.NL 5 Program Realization : Lecture 9

Programming, Block C. Today s Topics. wstomv/2ip05/ Branching dynamic data structures with pointers: Lecture 15.

Programming, Block C. Today s Topics.   wstomv/2ip05/ Branching dynamic data structures with pointers: Lecture 15. Programming, Block C Today s Topics http://www.win.tue.nl/ wstomv/2ip05/ Lecture 15 Tom Verhoeff Kees Hemerik Technische Universiteit Eindhoven Faculteit Wiskunde en Informatica Software Engineering &

More information

Programming Block C. Today s Topics. wstomv/2ip05/ Lecture 13. Implement an ADT, given its contract.

Programming Block C. Today s Topics.   wstomv/2ip05/ Lecture 13. Implement an ADT, given its contract. Programming Block C Today s Topics http://www.win.tue.nl/ wstomv/2ip05/ Lecture 13 Tom Verhoeff Technische Universiteit Eindhoven Faculteit Wiskunde en Informatica Software Engineering & Technology Implement

More information

Parsing Delphi mode, Include Assertion Code, Use Ansi Strings. Code Checks: I/O, Range, Overflow, Stack

Parsing Delphi mode, Include Assertion Code, Use Ansi Strings. Code Checks: I/O, Range, Overflow, Stack Programming Block C Steps to Construct a GUI Application in Lazarus (1) http://www.win.tue.nl/ wstomv/2ip0/ Lecture 12 Tom Verhoeff Technische Universiteit Eindhoven Faculteit Wiskunde en Informatica Software

More information

CGS 2405 Advanced Programming with C++ Course Justification

CGS 2405 Advanced Programming with C++ Course Justification Course Justification This course is the second C++ computer programming course in the Computer Science Associate in Arts degree program. This course is required for an Associate in Arts Computer Science

More information

Review and Recursion

Review and Recursion Midterm Exam Review Division of Mathematics and Computer Science Maryville College Outline Midterm Exam Review 1 Midterm Exam Review 2 Questions 1-10 Midterm Exam Review 1 What are some of the main challenges

More information

Today we spend some time in OO Programming (Object Oriented). Hope you did already work with the first Starter and the box at:

Today we spend some time in OO Programming (Object Oriented). Hope you did already work with the first Starter and the box at: maxbox Starter 2 Start with OO Programming 1.1 First Step Today we spend some time in OO Programming (Object Oriented). Hope you did already work with the first Starter and the box at: http://www.softwareschule.ch/download/maxbox_starter.pdf

More information

2IP15 Programming Methods

2IP15 Programming Methods Lecture 5: Iteration Abstraction 2IP15 Programming Methods From Small to Large Programs Tom Verhoeff Eindhoven University of Technology Department of Mathematics & Computer Science Software Engineering

More information

Software Construction

Software Construction Lecture 2: Decomposition and Java Methods Software Construction in Java for HSE Moscow Tom Verhoeff Eindhoven University of Technology Department of Mathematics & Computer Science Software Engineering

More information

G Programming Languages - Fall 2012

G Programming Languages - Fall 2012 G22.2110-003 Programming Languages - Fall 2012 Lecture 2 Thomas Wies New York University Review Last week Programming Languages Overview Syntax and Semantics Grammars and Regular Expressions High-level

More information

Software Construction

Software Construction Lecture 1: Introduction Software Construction in Java for HSE Moscow Tom Verhoeff Eindhoven University of Technology Department of Mathematics & Computer Science Software Engineering & Technology Group

More information

2IP15 Programming Methods

2IP15 Programming Methods Lecture 1: Introduction, Functional Decomposition 2IP15 Programming Methods From Small to Large Programs Tom Verhoeff Eindhoven University of Technology Department of Mathematics & Computer Science Software

More information

Software Construction

Software Construction Lecture 7: Type Hierarchy, Iteration Abstraction Software Construction in Java for HSE Moscow Tom Verhoeff Eindhoven University of Technology Department of Mathematics & Computer Science Software Engineering

More information

Classes and Methods גרא וייס המחלקה למדעי המחשב אוניברסיטת בן-גוריון

Classes and Methods גרא וייס המחלקה למדעי המחשב אוניברסיטת בן-גוריון Classes and Methods גרא וייס המחלקה למדעי המחשב אוניברסיטת בן-גוריון 2 Roadmap Lectures 4 and 5 present two sides of OOP: Lecture 4 discusses the static, compile time representation of object-oriented

More information

Software Construction

Software Construction Lecture 11: Command Design Pattern Software Construction in Java for HSE Moscow Tom Verhoeff Eindhoven University of Technology Department of Mathematics & Computer Science Software Engineering & Technology

More information

Compiler Construction

Compiler Construction Compiler Construction Thomas Noll Software Modeling and Verification Group RWTH Aachen University https://moves.rwth-aachen.de/teaching/ss-16/cc/ Recap: Static Data Structures Outline of Lecture 18 Recap:

More information

News and information! Review: Java Programs! Feedback after Lecture 2! Dead-lines for the first two lab assignment have been posted.!

News 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 information

Compiler Construction

Compiler Construction Compiler Construction Lecture 18: Code Generation V (Implementation of Dynamic Data Structures) Thomas Noll Lehrstuhl für Informatik 2 (Software Modeling and Verification) noll@cs.rwth-aachen.de http://moves.rwth-aachen.de/teaching/ss-14/cc14/

More information

Object Oriented Programming

Object Oriented Programming Binnur Kurt kurt@ce.itu.edu.tr Istanbul Technical University Computer Engineering Department 1 Version 0.1.2 About the Lecturer BSc İTÜ, Computer Engineering Department, 1995 MSc İTÜ, Computer Engineering

More information

Relationship Manager

Relationship Manager Relationship Manager Graeme Geldenhuys 2009-07-10 In this article we are going to look at the problem surrounding object oriented programming and object relationships. We will look at the traditional way

More information

(1) Trump (1) Trump (2) (1) Trump ExampleU ExampleP (2) Caption. TrumpU (2) Caption. (3) Image FormTrump. Top 0 Left 0.

(1) Trump (1) Trump (2) (1) Trump ExampleU ExampleP (2) Caption. TrumpU (2) Caption. (3) Image FormTrump. Top 0 Left 0. B 114 18 (1) 18.1 52 54 Trump http://www.ss.u-tokai.ac.jp/~ooya/jugyou/joronb/trumpbmp.exe (1) (2) Trump 18.2 (1) Trump ExampleU ExampleP (2) Name Caption FormMain 18.3 (1) TrumpU (2) Name Caption FormTrump

More information

Model driven Engineering & Model driven Architecture

Model driven Engineering & Model driven Architecture Model driven Engineering & Model driven Architecture Prof. Dr. Mark van den Brand Software Engineering and Technology Faculteit Wiskunde en Informatica Technische Universiteit Eindhoven Model driven software

More information

The undo stack and reusing the memento pattern

The undo stack and reusing the memento pattern The undo stack and reusing the memento pattern Michaël Van Canneyt March 31, 2009 Abstract In a previous contribution, the memento pattern was introduced. In this article, the memento pattern is used in

More information

Classes and Methods לאוניד ברנבוים המחלקה למדעי המחשב אוניברסיטת בן-גוריון

Classes and Methods לאוניד ברנבוים המחלקה למדעי המחשב אוניברסיטת בן-גוריון Classes and Methods לאוניד ברנבוים המחלקה למדעי המחשב אוניברסיטת בן-גוריון 22 Roadmap Lectures 4 and 5 present two sides of OOP: Lecture 4 discusses the static, compile time representation of object-oriented

More information

Object Pascal Language Guide

Object Pascal Language Guide Object Pascal Language Guide Borland Object Pascal Borland Software Corporation 100 Enterprise Way, Scotts Valley, CA 95066-3249 www.borland.com Borland Software Corporation may have patents and/or pending

More information

Getting started with Lazarus

Getting started with Lazarus Getting started with Lazarus Michaël Van Canneyt March 4, 2006 Abstract Lazarus is a cross-platform 2-way RAD tool which can be used to develop almost any kind of program for Windows, Linux, Solaris or

More information

Simple Factory Pattern

Simple Factory Pattern Simple Factory Pattern Graeme Geldenhuys 2008-08-02 In this article I am going to discuss one of three Factory design patterns. The Factory patterns are actually subtle variations of each other and all

More information

Today's Topics. CISC 458 Winter J.R. Cordy

Today's Topics. CISC 458 Winter J.R. Cordy Today's Topics Last Time Semantics - the meaning of program structures Stack model of expression evaluation, the Expression Stack (ES) Stack model of automatic storage, the Run Stack (RS) Today Managing

More information

3.Constructors and Destructors. Develop cpp program to implement constructor and destructor.

3.Constructors and Destructors. Develop cpp program to implement constructor and destructor. 3.Constructors and Destructors Develop cpp program to implement constructor and destructor. Constructors A constructor is a special member function whose task is to initialize the objects of its class.

More information

Delphi Language Guide

Delphi Language Guide Delphi Language Guide Borland Delphi Borland Software Corporation 100 Enterprise Way, Scotts Valley, CA 95066-3249 http://www.borland.com Refer to the DEPLOY document located in the root directory of your

More information

Example. program sort; var a : array[0..10] of integer; procedure readarray; : function partition (y, z :integer) :integer; var i, j,x, v :integer; :

Example. program sort; var a : array[0..10] of integer; procedure readarray; : function partition (y, z :integer) :integer; var i, j,x, v :integer; : Runtime Environment Relationship between names and data objects (of target machine) Allocation & de-allocation is managed by run time support package Each execution of a procedure is an activation of the

More information

EINDHOVEN UNIVERSITY OF TECHNOLOGY

EINDHOVEN UNIVERSITY OF TECHNOLOGY EINDHOVEN UNIVERSITY OF TECHNOLOGY Department of Mathematics & Computer Science Exam Programming Methods, 2IP15, Wednesday 17 April 2013, 09:00 12:00 TU/e THIS IS THE EXAMINER S COPY WITH (POSSIBLY INCOMPLETE)

More information

TECHNISCHE UNIVERSITEIT EINDHOVEN Faculteit Wiskunde en Informatica

TECHNISCHE UNIVERSITEIT EINDHOVEN Faculteit Wiskunde en Informatica TECHNISCHE UNIVERSITEIT EINDHOVEN Faculteit Wiskunde en Informatica Examination Architecture of Distributed Systems (2IMN10 / 2II45), on Monday November 2, 2015, from 13.30 to 16.30 hours. Indicate on

More information

Activities Common to Software Projects. Software Life Cycle. Activities Common to Software Projects. Activities Common to Software Projects

Activities Common to Software Projects. Software Life Cycle. Activities Common to Software Projects. Activities Common to Software Projects Activities Common to Software Projects Software Life Cycle Mark van den Brand Requirements and specification Domain analysis Defining the problem Requirements gathering Obtaining input from as many sources

More information

The following topics will be covered in this course (not necessarily in this order).

The following topics will be covered in this course (not necessarily in this order). The following topics will be covered in this course (not necessarily in this order). Introduction The course focuses on systematic design of larger object-oriented programs. We will introduce the appropriate

More information

Lecture 3. Lecture

Lecture 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 information

Log4Delphi Coding Standards

Log4Delphi Coding Standards Table of contents 1 Coding Standards Used By Log4Delphi Developers...2 1.1 Introduction... 2 1.2 General Source Conventions... 2 1.3 Object Pascal Conventions... 3 1.4 File Conventions...4 1.5... 5 2 Other

More information

Special Topics: Programming Languages

Special Topics: Programming Languages Lecture #17 0 V22.0490.001 Special Topics: Programming Languages B. Mishra New York University. Lecture # 17 Lecture #17 1 Slide 1 Runtime Representations Variable Names Environment L-values Scope, Extent

More information

UNIT 3

UNIT 3 UNIT 3 Presentation Outline Sequence control with expressions Conditional Statements, Loops Exception Handling Subprogram definition and activation Simple and Recursive Subprogram Subprogram Environment

More information

Hoare triples. Floyd-Hoare Logic, Separation Logic

Hoare triples. Floyd-Hoare Logic, Separation Logic Hoare triples Floyd-Hoare Logic, Separation Logic 1. Floyd-Hoare Logic 1969 Reasoning about control Hoare triples {A} p {B} a Hoare triple partial correctness: if the initial state satisfies assertion

More information

Short Notes of CS201

Short Notes of CS201 #includes: Short Notes of CS201 The #include directive instructs the preprocessor to read and include a file into a source code file. The file name is typically enclosed with < and > if the file is a system

More information

Delphi Generics.Collections

Delphi Generics.Collections Delphi Generics.Collections Copyright(C) 2008 Embarcadero Technologies, Inc. All Rights Reserved. Delphi Generics.Collections Table of Contents Generics.Collections.TCollectionNotification 1 Generics.Collections.TCollectionNotifyEvent

More information

CS201 - Introduction to Programming Glossary By

CS201 - Introduction to Programming Glossary By CS201 - Introduction to Programming Glossary By #include : The #include directive instructs the preprocessor to read and include a file into a source code file. The file name is typically enclosed with

More information

Compilation and Program Analysis (#11) : Hoare triples and shape analysis

Compilation and Program Analysis (#11) : Hoare triples and shape analysis Compilation and Program Analysis (#11) : Hoare triples and shape analysis Laure Gonnord http://laure.gonnord.org/pro/teaching/capm1.html Laure.Gonnord@ens-lyon.fr Master 1, ENS de Lyon dec 2017 Inspiration

More information

Classes and Methods עזאם מרעי המחלקה למדעי המחשב אוניברסיטת בן-גוריון מבוסס על השקפים של אותו קורס שניתן בשנים הקודמות

Classes and Methods עזאם מרעי המחלקה למדעי המחשב אוניברסיטת בן-גוריון מבוסס על השקפים של אותו קורס שניתן בשנים הקודמות Classes and Methods עזאם מרעי המחלקה למדעי המחשב אוניברסיטת בן-גוריון מבוסס על השקפים של אותו קורס שניתן בשנים הקודמות 2 Roadmap Lectures 4 and 5 present two sides of OOP: Lecture 4 discusses the static,

More information

Software Design and Analysis for Engineers

Software Design and Analysis for Engineers Software Design and Analysis for Engineers by Dr. Lesley Shannon Email: lshannon@ensc.sfu.ca Course Website: http://www.ensc.sfu.ca/~lshannon/courses/ensc251 Simon Fraser University Slide Set: 4 Date:

More information

Object-Oriented Software Engineering Practical Software Development using UML and Java

Object-Oriented Software Engineering Practical Software Development using UML and Java Object-Oriented Software Engineering Practical Software Development using UML and Java Chapter 5: Modelling with Classes Lecture 5 5.1 What is UML? The Unified Modelling Language is a standard graphical

More information

CSE 307: Principles of Programming Languages

CSE 307: Principles of Programming Languages CSE 307: Principles of Programming Languages Variables and Constants R. Sekar 1 / 22 Topics 2 / 22 Variables and Constants Variables are stored in memory, whereas constants need not be. Value of variables

More information

Software Development Fundamentals (SDF)

Software Development Fundamentals (SDF) 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 Software Development Fundamentals (SDF) Fluency in the process of software development is a prerequisite to the study of most

More information

CHAPTER 1 Introduction to Computers and Programming CHAPTER 2 Introduction to C++ ( Hexadecimal 0xF4 and Octal literals 031) cout Object

CHAPTER 1 Introduction to Computers and Programming CHAPTER 2 Introduction to C++ ( Hexadecimal 0xF4 and Octal literals 031) cout Object CHAPTER 1 Introduction to Computers and Programming 1 1.1 Why Program? 1 1.2 Computer Systems: Hardware and Software 2 1.3 Programs and Programming Languages 8 1.4 What is a Program Made of? 14 1.5 Input,

More information

Chapter 13. Object Oriented Programming

Chapter 13. Object Oriented Programming Chapter 13. Object Oriented Programming Byoung-Tak Zhang TA: Hanock Kwak Biointelligence Laboratory School of Computer Science and Engineering Seoul National University http://bi.snu.ac.kr Computer Programming

More information

Object Oriented Programming in Java. Jaanus Pöial, PhD Tallinn, Estonia

Object 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 information

Chapter 1: Object-Oriented Programming Using C++

Chapter 1: Object-Oriented Programming Using C++ Chapter 1: Object-Oriented Programming Using C++ Objectives Looking ahead in this chapter, we ll consider: Abstract Data Types Encapsulation Inheritance Pointers Polymorphism Data Structures and Algorithms

More information

INITIALISING POINTER VARIABLES; DYNAMIC VARIABLES; OPERATIONS ON POINTERS

INITIALISING POINTER VARIABLES; DYNAMIC VARIABLES; OPERATIONS ON POINTERS INITIALISING POINTER VARIABLES; DYNAMIC VARIABLES; OPERATIONS ON POINTERS Pages 792 to 800 Anna Rakitianskaia, University of Pretoria INITIALISING POINTER VARIABLES Pointer variables are declared by putting

More information

Information System Design (IT60105)

Information System Design (IT60105) Information System Design (IT60105) Lecture 26 Object-Oriented System Testing Lecture #23 Procedural vs OO paradigms Why not Traditional Testing? Issues Methodology 2 Procedural Vs OO p Procedural Vs OO

More information

PASCAL - OBJECT ORIENTED

PASCAL - OBJECT ORIENTED PASCAL - OBJECT ORIENTED http://www.tutorialspoint.com/pascal/pascal_object_oriented.htm Copyright tutorialspoint.com We can imagine our universe made of different objects like sun, earth, moon, etc. Similarly,

More information

Lecture 6 Dynamic Classes and the Law of the Big Three. Instructor: George Wolberg Department of Computer Science City College of New York

Lecture 6 Dynamic Classes and the Law of the Big Three. Instructor: George Wolberg Department of Computer Science City College of New York CSC212 Data Structure Lecture 6 Dynamic Classes and the Law of the Big Three Instructor: George Wolberg Department of Computer Science City College of New York @ George Wolberg, 2016 1 Why Dynamic Classes

More information

RPC BROKER GETTING STARTED WITH THE BROKER DEVELOPMENT KIT (BDK) Version 1.1 September 1997

RPC BROKER GETTING STARTED WITH THE BROKER DEVELOPMENT KIT (BDK) Version 1.1 September 1997 RPC BROKER GETTING STARTED WITH THE BROKER DEVELOPMENT KIT (BDK) Version 1.1 September 1997 Department of Veterans Affairs VISTA Software Development OpenVISTA Product Line Table of Contents 1. Introduction...

More information

Unit-3 Software Design (Lecture Notes)

Unit-3 Software Design (Lecture Notes) Unit-3 Software Design (Lecture Notes) Prepared by Jay Nanavati, Assistant Professor, SEMCOM Topics Software Design - Introduction Design Principles Module Level concepts Overview of Structured design

More information

Programming Languages

Programming Languages Programming Languages Tevfik Koşar Lecture - VIII February 9 th, 2006 1 Roadmap Allocation techniques Static Allocation Stack-based Allocation Heap-based Allocation Scope Rules Static Scopes Dynamic Scopes

More information

Programming Languages (PL)

Programming Languages (PL) 1 2 3 4 5 6 7 8 9 10 11 Programming Languages (PL) Programming languages are the medium through which programmers precisely describe concepts, formulate algorithms, and reason about solutions. In the course

More information

For 100% Result Oriented IGNOU Coaching and Project Training Call CPD TM : ,

For 100% Result Oriented IGNOU Coaching and Project Training Call CPD TM : , Course Code : MCS-032 Course Title : Object Oriented Analysis and Design Assignment Number : MCA (3)/032/Assign/2014-15 Assignment Marks : 100 Weightage : 25% Last Dates for Submission : 15th October,

More information

CPSC 427: Object-Oriented Programming

CPSC 427: Object-Oriented Programming CPSC 427: Object-Oriented Programming Michael J. Fischer Lecture 11 October 3, 2018 CPSC 427, Lecture 11, October 3, 2018 1/24 Copying and Assignment Custody of Objects Move Semantics CPSC 427, Lecture

More information

Inheritance, and Polymorphism.

Inheritance, and Polymorphism. Inheritance and Polymorphism by Yukong Zhang Object-oriented programming languages are the most widely used modern programming languages. They model programming based on objects which are very close to

More information

7. Implementation Phase. 7.1 Architecture Diagrams 7.2 OO Languages: Java 7.3 Constraint Languages: OCL

7. Implementation Phase. 7.1 Architecture Diagrams 7.2 OO Languages: Java 7.3 Constraint Languages: OCL 7. Implementation Phase 7.1 Architecture Diagrams 7.2 OO Languages: Java 7.3 Constraint Languages: OCL Architecture Design Models An architecture model (structure model) is a model of a data processing

More information

Level 3 Computing Year 2 Lecturer: Phil Smith

Level 3 Computing Year 2 Lecturer: Phil Smith Level 3 Computing Year 2 Lecturer: Phil Smith Previously We started to build a GUI program using visual studio 2010 and vb.net. We have a form designed. We have started to write the code to provided the

More information

A method is a procedure that is always associated with an object and defines the behavior of that object.

A method is a procedure that is always associated with an object and defines the behavior of that object. Using Form Components Old Content - visit altium.com/documentation Modified by Rob Evans on 15-Feb-2017 Parent page: VBScript Using Components in VBScript Forms Although Forms and Components are based

More information

CS113: Lecture 4. Topics: Functions. Function Activation Records

CS113: Lecture 4. Topics: Functions. Function Activation Records CS113: Lecture 4 Topics: Functions Function Activation Records 1 Why functions? Functions add no expressive power to the C language in a formal sense. Why have them? Breaking tasks into smaller ones make

More information

Course materials Reges, Stuart, and Stepp, Martin. Building Java Programs: A Back to Basics Approach. 2d ed. (Boston: Addison-Wesley, 2011).

Course materials Reges, Stuart, and Stepp, Martin. Building Java Programs: A Back to Basics Approach. 2d ed. (Boston: Addison-Wesley, 2011). AP Computer Science A Advanced Placement Computer Science A is a fast-paced course equivalent to a college introductory programming class. Students will learn about the exciting kinds of problems tackled

More information

OOPs: The Harsh Realities of Programming

OOPs: The Harsh Realities of Programming Division of Mathematics and Computer Science Maryville College Outline Course Overview 1 Course Overview 2 3 4 Preliminaries Course Overview Required Materials Big C++ 2nd Edition by Cay Horstmann An Account

More information

Memory Management: The Details

Memory Management: The Details Lecture 10 Memory Management: The Details Sizing Up Memory Primitive Data Types Complex Data Types byte: char: short: basic value (8 bits) 1 byte 2 bytes Pointer: platform dependent 4 bytes on 32 bit machine

More information

Memory Management. Didactic Module 14 Programming Languages - EEL670 1

Memory Management. Didactic Module 14 Programming Languages - EEL670 1 Memory Management Didactic Module 14 Programming Languages - EEL670 1 Dynamic Memory Allocation Lots of things need memory at runtime: Activation records Objects Explicit allocations: new, malloc, etc.

More information

Memory Management. Chapter Fourteen Modern Programming Languages, 2nd ed. 1

Memory Management. Chapter Fourteen Modern Programming Languages, 2nd ed. 1 Memory Management Chapter Fourteen Modern Programming Languages, 2nd ed. 1 Dynamic Memory Allocation Lots of things need memory at runtime: Activation records Objects Explicit allocations: new, malloc,

More information

Programming Data Structures and Algorithms Prof. Shankar Balachandran Department of Computer Science Indian Institute of Technology, Madras

Programming Data Structures and Algorithms Prof. Shankar Balachandran Department of Computer Science Indian Institute of Technology, Madras Programming Data Structures and Algorithms Prof. Shankar Balachandran Department of Computer Science Indian Institute of Technology, Madras Module 12B Lecture - 41 Brief introduction to C++ Hello, welcome

More information

OpenMP Lab on Nested Parallelism and Tasks

OpenMP Lab on Nested Parallelism and Tasks OpenMP Lab on Nested Parallelism and Tasks Nested Parallelism 2 Nested Parallelism Some OpenMP implementations support nested parallelism A thread within a team of threads may fork spawning a child team

More information

Software Engineering: Theory and Practice. Verification by Testing. Test Case Design. Tom Verhoeff

Software Engineering: Theory and Practice. Verification by Testing. Test Case Design. Tom Verhoeff Software Engineering: Theory and Practice Verification by Testing Test Case Design Tom Verhoeff Eindhoven University of Technology Department of Mathematics & Computer Science Software Engineering & Technology

More information

The compilation process is driven by the syntactic structure of the program as discovered by the parser

The compilation process is driven by the syntactic structure of the program as discovered by the parser Semantic Analysis The compilation process is driven by the syntactic structure of the program as discovered by the parser Semantic routines: interpret meaning of the program based on its syntactic structure

More information

Learning Objectives. C++ For Artists 2003 Rick Miller All Rights Reserved xli

Learning Objectives. C++ For Artists 2003 Rick Miller All Rights Reserved xli Identify and overcome the difficulties encountered by students when learning how to program List and explain the software development roles played by students List and explain the phases of the tight spiral

More information

Department of Computer science and Engineering Sub. Name: Object oriented programming and data structures Sub. Code: EC6301 Sem/Class: III/II-ECE Staff name: M.Kavipriya Two Mark Questions UNIT-1 1. List

More information

Francesco Nidito. Programmazione Avanzata AA 2007/08

Francesco Nidito. Programmazione Avanzata AA 2007/08 Francesco Nidito in the Programmazione Avanzata AA 2007/08 Outline 1 2 3 in the in the 4 Reference: Micheal L. Scott, Programming Languages Pragmatics, Chapter 7 What is a type? in the What is a type?

More information

Lecture 13: Object orientation. Object oriented programming. Introduction. Object oriented programming. OO and ADT:s. Introduction

Lecture 13: Object orientation. Object oriented programming. Introduction. Object oriented programming. OO and ADT:s. Introduction Lecture 13: Object orientation Object oriented programming Introduction, types of OO languages Key concepts: Encapsulation, Inheritance, Dynamic binding & polymorphism Other design issues Smalltalk OO

More information

Object Oriented Programming. Assistant Lecture Omar Al Khayat 2 nd Year

Object Oriented Programming. Assistant Lecture Omar Al Khayat 2 nd Year Object Oriented Programming Assistant Lecture Omar Al Khayat 2 nd Year Syllabus Overview of C++ Program Principles of object oriented programming including classes Introduction to Object-Oriented Paradigm:Structures

More information

JScript Reference. Contents

JScript Reference. Contents JScript Reference Contents Exploring the JScript Language JScript Example Altium Designer and Borland Delphi Run Time Libraries Server Processes JScript Source Files PRJSCR, JS and DFM files About JScript

More information

Chapter 5: Procedural abstraction. Function procedures. Function procedures. Proper procedures and function procedures

Chapter 5: Procedural abstraction. Function procedures. Function procedures. Proper procedures and function procedures Chapter 5: Procedural abstraction Proper procedures and function procedures Abstraction in programming enables distinction: What a program unit does How a program unit works This enables separation of

More information

Questions? Static Semantics. Static Semantics. Static Semantics. Next week on Wednesday (5 th of October) no

Questions? Static Semantics. Static Semantics. Static Semantics. Next week on Wednesday (5 th of October) no Questions? First exercise is online: http://www.win.tue.nl/~mvdbrand/courses/glt/1112/ Deadline 17 th of October Next week on Wednesday (5 th of October) no lectures!!! Primitive types Primitive value

More information

AADL Graphical Editor Design

AADL Graphical Editor Design AADL Graphical Editor Design Peter Feiler Software Engineering Institute phf@sei.cmu.edu Introduction An AADL specification is a set of component type and implementation declarations. They are organized

More information

Creating an object Instance variables

Creating an object Instance variables Introduction to Objects: Semantics and Syntax Defining i an object Creating an object Instance variables Instance methods What is OOP? Object-oriented programming (constructing software using objects)

More information

1. Describe History of C++? 2. What is Dev. C++? 3. Why Use Dev. C++ instead of C++ DOS IDE?

1. Describe History of C++? 2. What is Dev. C++? 3. Why Use Dev. C++ instead of C++ DOS IDE? 1. Describe History of C++? The C++ programming language has a history going back to 1979, when Bjarne Stroustrup was doing work for his Ph.D. thesis. One of the languages Stroustrup had the opportunity

More information

Absolute C++ Walter Savitch

Absolute C++ Walter Savitch Absolute C++ sixth edition Walter Savitch Global edition This page intentionally left blank Absolute C++, Global Edition Cover Title Page Copyright Page Preface Acknowledgments Brief Contents Contents

More information

2. COURSE DESIGNATION: 3. COURSE DESCRIPTIONS:

2. COURSE DESIGNATION: 3. COURSE DESCRIPTIONS: College of San Mateo Official Course Outline 1. COURSE ID: CIS 278 TITLE: (CS1) Programming Methods: C++ C-ID: COMP 122 Units: 4.0 units Hours/Semester: 48.0-54.0 Lecture hours; 48.0-54.0 Lab hours; and

More information

Part I Basic Concepts 1

Part I Basic Concepts 1 Introduction xiii Part I Basic Concepts 1 Chapter 1 Integer Arithmetic 3 1.1 Example Program 3 1.2 Computer Program 4 1.3 Documentation 5 1.4 Input 6 1.5 Assignment Statement 7 1.5.1 Basics of assignment

More information

Big Java Late Objects

Big Java Late Objects Big Java Late Objects Horstmann, Cay S. ISBN-13: 9781118087886 Table of Contents 1. Introduction 1.1 Computer Programs 1.2 The Anatomy of a Computer 1.3 The Java Programming Language 1.4 Becoming Familiar

More information

Introduction to Linked Lists. Introduction to Recursion Search Algorithms CS 311 Data Structures and Algorithms

Introduction to Linked Lists. Introduction to Recursion Search Algorithms CS 311 Data Structures and Algorithms Introduction to Linked Lists Introduction to Recursion Search Algorithms CS 311 Data Structures and Algorithms Lecture Slides Friday, September 25, 2009 Glenn G. Chappell Department of Computer Science

More information

G Programming Languages - Fall 2012

G Programming Languages - Fall 2012 G22.2110-003 Programming Languages - Fall 2012 Lecture 4 Thomas Wies New York University Review Last week Control Structures Selection Loops Adding Invariants Outline Subprograms Calling Sequences Parameter

More information

Constructors and Destructors. OOC 4 th Sem, B Div Prof. Mouna M. Naravani

Constructors and Destructors. OOC 4 th Sem, B Div Prof. Mouna M. Naravani Constructors and Destructors OOC 4 th Sem, B Div 2016-17 Prof. Mouna M. Naravani A constructor guarantees that an object created by the class will be initialized automatically. Ex: create an object integer

More information

Advanced Systems Programming

Advanced Systems Programming Advanced Systems Programming Introduction to C++ Martin Küttler September 19, 2017 1 / 18 About this presentation This presentation is not about learning programming or every C++ feature. It is a short

More information

Acknowledgement. CS Compiler Design. Semantic Processing. Alternatives for semantic processing. Intro to Semantic Analysis. V.

Acknowledgement. CS Compiler Design. Semantic Processing. Alternatives for semantic processing. Intro to Semantic Analysis. V. Acknowledgement CS3300 - Compiler Design Intro to Semantic Analysis V. Krishna Nandivada IIT Madras Copyright c 2000 by Antony L. Hosking. Permission to make digital or hard copies of part or all of this

More information

Model transformations. Model transformations. Model transformations. Model transformations

Model transformations. Model transformations. Model transformations. Model transformations The initialization of the attributes of a generated target model element by assigning references: Model target element generated by current rule Default target model element generated by another rule Non-default

More information

2559 : Introduction to Visual Basic.NET Programming with Microsoft.NET

2559 : Introduction to Visual Basic.NET Programming with Microsoft.NET 2559 : Introduction to Visual Basic.NET Programming with Microsoft.NET Introduction Elements of this syllabus are subject to change. This five-day instructor-led course provides students with the knowledge

More information

Inheritance (Chapter 7)

Inheritance (Chapter 7) Inheritance (Chapter 7) Prof. Dr. Wolfgang Pree Department of Computer Science University of Salzburg cs.uni-salzburg.at Inheritance the soup of the day?! Inheritance combines three aspects: inheritance

More information

Software Engineering with Objects and Components Open Issues and Course Summary

Software Engineering with Objects and Components Open Issues and Course Summary Software Engineering with Objects and Components Open Issues and Course Summary Massimo Felici Software Engineering with Objects and Components Software development process Lifecycle models and main stages

More information