n We have discussed classes in previous lectures n Here, we discuss design of classes n Library design considerations
|
|
- Derek Murphy
- 5 years ago
- Views:
Transcription
1 Chapter 14 Graph class desig Bjare Stroustrup Abstract We have discussed classes i previous lectures Here, we discuss desig of classes Library desig cosideratios Class hierarchies (object-orieted programmig) Data hidig 2 Ideals Our ideal of program desig is to represet the cocepts of the applicatio domai directly i code. If you uderstad the applicatio domai, you uderstad the code, ad vice versa. For example: Widow a widow as preseted by the operatig system Lie a lie as you see it o the scree Poit a coordiate poit Color as you see it o the scree Shape what s commo for all shapes i our Graph/GUI view of the world The last example, Shape, is differet from the rest i that it is a geeralizatio. You ca t make a object that s just a Shape Ideals SPOT Pricipal : Sigle Poit of Truth Never do aythig more tha oce Ecapsulate commoly-occurrig sets of actios as fuctios, which ca be re-used Why? Why make more work for yourself? "We will ecourage you to develop the three great virtues of a programmer: laziess, impatiece, ad hubris." -- LarryWall, Programmig Perl (1st editio) Eases maiteace If we eed to chage the way a operatio works, oly eed to chage it i oe place. It s easier to chage data defied oce tha redudatly-defied data (Bak accout example) 3 4 1
2 Logically idetical operatios have the same ame For every class, draw_lies() does the drawig move(dx,dy) does the movig s.add(x) adds some x (e.g., a poit) to a shape s. For every property x of a Shape, x() gives its curret value ad set_x() gives it a ew value e.g., Color c = s.color(); s.set_color(color::blue); p1: p2: Logically differet operatios have differet ames Lies l; Poit p1 100,200 Poit p2 200,300 l.add(p1,p2); wi.attach(l); // add poits to l (make copies) // attach l to widow Why ot wi.add(l)? add() copies iformatio; attach() just creates a referece we ca chage a displayed object after attachig it, but ot after addig it (100,200) (200,300) add() l: (100,200) (200,300) attach() wi: &l 5 6 Expose uiformly Data should be private Data hidig so it will ot be chaged iadvertetly Use private data, ad pairs of public access fuctios to get ad set the data c.set_radius(12); // set radius to 12 c.set_radius(c.radius()*2); // double the radius (fie) c.set_radius(-9); // set_radius() could check for egative, // but does t yet double r = c.radius(); // returs value of radius c.radius = -9; // error: radius is a fuctio (good!) c.r = -9; // error: radius is private (good!) Our fuctios ca be private or public Public for iterface Private for fuctios used oly iterally to a class What does private buy us? We ca chage our implemetatio after release We do t expose FLTK types used i represetatio to our users We could replace FLTK with aother library without affectig user code We could provide checkig i access fuctios But we have t doe so systematically (later?) Fuctioal iterfaces ca be icer to read ad use E.g., s.add(x) rather tha s.poits.push_back(x) We eforce immutability of shape Oly color ad style chage; ot the relative positio of poits cost member fuctios The value of this ecapsulatio varies with applicatio domais Is ofte most valuable Is the ideal i.e., hide represetatio uless you have a good reaso ot to 7 8 2
3 Regular iterfaces Lie l Poit100,200,Poit300,400 Mark m Poit100,200, 'x' // display a sigle poit as a 'x' Circle c Poit200,200,250 // Alterative (ot supported): Lie l2 x1, y1, x2, y2 // iteger argumets: from (x1,y1) to (x2,y2) // How about? (both supported): Rectagle s1 Poit100,200,200,300 // width==200 height==300 Rectagle s2 Poit100,200,Poit200,300 // width==100 height==100 // but (a error): Rectagle s3 100,200,200,300// is 200,300 a poit or a width plus a height? A library A collectio of classes ad fuctios meat to be used together As buildig blocks for applicatios To build more such buildig blocks A good library models some aspect of a domai It does t try to do everythig Our library aims at simplicity ad small size for graphig data ad for very simple GUI We ca t defie each library class ad fuctio i isolatio A good library exhibits a uiform style ( regularity ) 9 10 All our shapes are based o the Shape class E.g., a Polygo is a kid of Shape Shape Shape is a base class Defies what is commo to all Shapes class Shape public: void draw() cost; // deal with color ad draw lies virtual void move(it dx, it dy); // move the Shape: +=dx ad +=dy Circle Ellipse Ope_polylie Axis Lies Marked_polylie Closed_polylie Marks Image Rectagle Text Fuctio Lie void set_color(color col); color color() cost; Polygo Mark
4 Shape ties our graphics objects to the scree Widow kows about Shapes All our graphics objects are kids of Shapes Shape is the class that deals with color ad style It has Color ad Lie_style members Shape ca hold Poits Shape has a basic otio of how to draw lies It just coects its Poits Shape deals with color ad style It keeps its data private ad provides access fuctios void set_color(color col); Color color() cost; void set_style(lie_style sty); Lie_style style() cost; private: Color lie_color; Lie_style ls; Shape stores Poits It keeps its data private ad provides access fuctios Poit poit(it i) cost; // read-oly access to poits it umber_of_poits() cost; protected: void add(poit p); // add p to poits private: vector<poit> poits; // ot used by all shapes Shape itself ca access poits directly: void Shape::draw_lies() cost // draw coectig lies if (color().visible() && 1<poits.size()) for (it i=1; i<poits.size(); ++i) fl_lie(poits[i-1].x,poits[i-1].y,poits[i].x,poits[i].y); Others (icl. derived classes) use poit() ad umber_of_poits() why? void Lies::draw_lies() cost // draw a lie for each pair of poits for (it i=1; i<umber_of_poits(); i+=2) fl_lie(poit(i-1).x, poit(i-1).y, poit(i).x, poit(i).y);
5 (basic idea of drawig) (implemetatio of drawig) void Shape::draw() cost // The real heart of class Shape (ad of our graphics iterface system) // called by Widow (oly) save old color ad style set color ad style for this shape draw what is specific for this particular shape Note: this varies dramatically depedig o the type of shape e.g. Text, Circle, Closed_polylie reset the color ad style to their old values Note! void Shape::draw() cost // The real heart of class Shape (ad of our graphics iterface system) // called by Widow (oly) Fl_Color oldc = fl_color(); // save old color // there is o good portable way of retrievig the curret style (sigh!) fl_color(lie_color.as_it()); // set color ad style fl_lie_style(ls.style(),ls.width()); draw_lies(); // call the appropriate draw_lies() // a virtual call // here is what is specific for a derived class is doe fl_color(oldc); fl_lie_style(0); // reset color to previous // (re)set style to default is abstract Class shape You ca t make a plai Shape protected: Shape(); For example Shape ss; // protected to make class Shape abstract // error: caot costruct Shape Protected meas ca oly be used from this class or from a derived class Istead, we use Shape as a base class struct Circle : Shape // a Circle is a Shape I class Shape virtual void draw_lies() cost; I class Circle void draw_lies() cost /* draw the Circle */ I class Text void draw_lies() cost /* draw the Text */ Circle, Text, ad other classes Derive from Shape May override draw_lies() // draw the appropriate lies
6 class Shape // deals with color ad style, ad holds a sequece of lies public: void draw() cost; // deal with color ad call draw_lies() virtual void move(it dx, it dy); // move the shape +=dx ad +=dy Display model completed void set_color(color col); // color access it color() cost; style ad fill_color access fuctios Poit poit(it i) cost; // (read-oly) access to poits it umber_of_poits() cost; protected: Shape(); // protected to make class Shape abstract void add(poit p); // add p to poits virtual void draw_lies() cost; // simply draw the appropriate lies private: vector<poit> poits; // ot used by all shapes Color lcolor; // lie color Lie_style ls; // lie style Color fcolor; // fill color draw_lies() draw_lies() Shape Circle draw_lies() Shape Text draw_lies() draw() draw() Widow attach() our code make objects draw() Display Egie wait_for_butto() prevet copyig Laguage mechaisms A simple class hierarchy Most popular defiitio of object-orieted programmig: OOP == iheritace + polymorphism + ecapsulatio We chose to use a simple (ad mostly shallow) class hierarchy Based o Shape Base ad derived classes // iheritace struct Circle : Shape Also called iheritace Virtual fuctios // polymorphism virtual void draw_lies() cost; Also called ru-time polymorphism or dyamic dispatch Circle Ellipse Axis Ope_polylie Shape Lies Image Text Fuctio Lie Private ad protected // ecapsulatio protected: Shape(); private: vector<poit> poits; Marked_polylie Marks Closed_polylie Polygo Rectagle 23 Mark 24 6
7 Object layout Object layout The data members of a derived class are simply added at the ed of its base class (a Circle is a Shape with a radius) Shape: poits lie_color ls fcolor Virtual fuctio implemetatio Ope_polylie: Circle: poits lie_color ls fcolor vptr draw move Shape::draw_lies() Shape::move() Circle: poits lie_color ls fcolor r 25 poits lie_color ls fcolor vptr r draw move Cicle::draw_lies() 26 Beefits of iheritace Access model Iterface iheritace A fuctio expectig a shape (a Shape&) ca accept ay object of a class derived from Shape. Simplifies use sometimes dramatically We ca add classes derived from Shape to a program without rewritig user code Addig without touchig old code is oe of the holy grails of programmig Implemetatio iheritace Simplifies implemetatio of derived classes Commo fuctioality ca be provided i oe place Chages ca be doe i oe place ad have uiversal effect Aother holy grail A member (data, fuctio, or type member) or a base ca be Private, protected, or public
8 Pure virtual fuctios Ofte, a fuctio i a iterface ca t be implemeted E.g. the data eeded is hidde i the derived class We must esure that a derived class implemets that fuctio Make it a pure virtual fuctio (=0) This is how we defie truly abstract iterfaces ( pure iterfaces ) struct Egie // o data // iterface to electric motors // (usually) o costructor virtual double icrease(it i) =0; // must be defied i a derived class virtual ~Egie(); // (usually) a virtual destructor Egie eee; // error: Collectio is a abstract class Pure virtual fuctios A pure iterface ca the be used as a base class Costructors ad destructors will be described i detail i chapters Class M123 : public Egie // egie model M123 // represetatio public: M123(); // costrutor: iitializatio, acquire resources double icrease(it i) override /* */ // overrides Egie ::icrease ~M123(); // destructor: cleaup, release resources M123 widow3_cotrol; // OK Techicality: Copyig Techicality: Overridig If you do t kow how to copy a object, prevet copyig Abstract classes typically should ot be copied class Shape Shape(cost Shape&) = delete; // do t copy costruct Shape& operator=(cost Shape&) = delete; // do t copy assig void f(shape& a) Shape s2 = a; a = s2; // error: o Shape copy costructor (it s deleted) // error: o Shape copy assigmet (it s deleted) 31 To override a virtual fuctio, you eed A virtual fuctio Exactly the same ame Exactly the same type struct B void f1(); // ot virtual virtual void f2(char); virtual void f3(char) cost; virtual void f4(it); struct D : B void f1(); // does t override void f2(it); // does t override void f3(char); // does t override void f4(it); // overrides 32 8
9 Techicality: Overridig To override a virtual fuctio, you eed A virtual fuctio Exactly the same ame Exactly the same type struct B void f1(); // ot virtual virtual void f2(char); virtual void f3(char) cost; virtual void f4(it); struct D : B void f1() override; // error void f2(it) override; // error void f3(char) override; // error void f4(it) override; // OK 33 Techicality: Overridig To ivoke a virtual fuctio, you eed A referece, or A poiter D d1; B& bref = d1; bref.f4(2); // d1 is a D, ad a D is a B, so d1 is a B // calls D::f4(2) o d1 sice bref ames a D // poiters are i chapter 17 B *bptr = &d1; // d1 is a D, ad a D is a B, so d1 is a B bptr->f4(2); // calls D::f4(2) o d1 sice bptr poits to a D 34 Next lecture Graphig fuctios ad data 35 9
Overview Chapter 12 A display model
Overview Chapter 12 A display model Why graphics? A graphics model Examples Bjare Stroustrup www.stroustrup.com/programmig 3 Why bother with graphics ad GUI? Why bother with graphics ad GUI? It s very
More informationChapter 10. Defining Classes. Copyright 2015 Pearson Education, Ltd.. All rights reserved.
Chapter 10 Defiig Classes Copyright 2015 Pearso Educatio, Ltd.. All rights reserved. Overview 10.1 Structures 10.2 Classes 10.3 Abstract Data Types 10.4 Itroductio to Iheritace Copyright 2015 Pearso Educatio,
More informationOverview. Chapter 18 Vectors and Arrays. Reminder. vector. Bjarne Stroustrup
Chapter 18 Vectors ad Arrays Bjare Stroustrup Vector revisited How are they implemeted? Poiters ad free store Destructors Iitializatio Copy ad move Arrays Array ad poiter problems Chagig size Templates
More informationCS 11 C track: lecture 1
CS 11 C track: lecture 1 Prelimiaries Need a CMS cluster accout http://acctreq.cms.caltech.edu/cgi-bi/request.cgi Need to kow UNIX IMSS tutorial liked from track home page Track home page: http://courses.cms.caltech.edu/courses/cs11/material
More informationBasic allocator mechanisms The course that gives CMU its Zip! Memory Management II: Dynamic Storage Allocation Mar 6, 2000.
5-23 The course that gives CM its Zip Memory Maagemet II: Dyamic Storage Allocatio Mar 6, 2000 Topics Segregated lists Buddy system Garbage collectio Mark ad Sweep Copyig eferece coutig Basic allocator
More informationChapter 1. Introduction to Computers and C++ Programming. Copyright 2015 Pearson Education, Ltd.. All rights reserved.
Chapter 1 Itroductio to Computers ad C++ Programmig Copyright 2015 Pearso Educatio, Ltd.. All rights reserved. Overview 1.1 Computer Systems 1.2 Programmig ad Problem Solvig 1.3 Itroductio to C++ 1.4 Testig
More informationPython Programming: An Introduction to Computer Science
Pytho Programmig: A Itroductio to Computer Sciece Chapter 6 Defiig Fuctios Pytho Programmig, 2/e 1 Objectives To uderstad why programmers divide programs up ito sets of cooperatig fuctios. To be able to
More informationComputers and Scientific Thinking
Computers ad Scietific Thikig David Reed, Creighto Uiversity Chapter 15 JavaScript Strigs 1 Strigs as Objects so far, your iteractive Web pages have maipulated strigs i simple ways use text box to iput
More informationGoals of the Lecture UML Implementation Diagrams
Goals of the Lecture UML Implemetatio Diagrams Object-Orieted Aalysis ad Desig - Fall 1998 Preset UML Diagrams useful for implemetatio Provide examples Next Lecture Ð A variety of topics o mappig from
More informationChapter 11. Friends, Overloaded Operators, and Arrays in Classes. Copyright 2014 Pearson Addison-Wesley. All rights reserved.
Chapter 11 Frieds, Overloaded Operators, ad Arrays i Classes Copyright 2014 Pearso Addiso-Wesley. All rights reserved. Overview 11.1 Fried Fuctios 11.2 Overloadig Operators 11.3 Arrays ad Classes 11.4
More informationCHAPTER IV: GRAPH THEORY. Section 1: Introduction to Graphs
CHAPTER IV: GRAPH THEORY Sectio : Itroductio to Graphs Sice this class is called Number-Theoretic ad Discrete Structures, it would be a crime to oly focus o umber theory regardless how woderful those topics
More informationJava Inheritance. Class ADT (Abstract Data Type) Interface. Classes implement the concept of ADT: Interfaces define interaction contracts: Rui Moreira
Java Iheritace Rui Moreira Class ADT (Abstract Data Type) Classes implemet the cocept of ADT: Provide a coheret represetatio for the declaratio of structured data types ad also the code for maipulatig
More informationChapter 4. Procedural Abstraction and Functions That Return a Value. Copyright 2015 Pearson Education, Ltd.. All rights reserved.
Chapter 4 Procedural Abstractio ad Fuctios That Retur a Value Copyright 2015 Pearso Educatio, Ltd.. All rights reserved. Overview 4.1 Top-Dow Desig 4.2 Predefied Fuctios 4.3 Programmer-Defied Fuctios 4.4
More informationChapter 9. Pointers and Dynamic Arrays. Copyright 2015 Pearson Education, Ltd.. All rights reserved.
Chapter 9 Poiters ad Dyamic Arrays Copyright 2015 Pearso Educatio, Ltd.. All rights reserved. Overview 9.1 Poiters 9.2 Dyamic Arrays Copyright 2015 Pearso Educatio, Ltd.. All rights reserved. Slide 9-3
More informationGraphical Interface Object Oriented Programming
DM560 Introduction to Programming in C++ Graphical Interface Object Oriented Programming Marco Chiarandini Department of Mathematics & Computer Science University of Southern Denmark [Based on slides by
More informationIMP: Superposer Integrated Morphometrics Package Superposition Tool
IMP: Superposer Itegrated Morphometrics Package Superpositio Tool Programmig by: David Lieber ( 03) Caisius College 200 Mai St. Buffalo, NY 4208 Cocept by: H. David Sheets, Dept. of Physics, Caisius College
More informationCOP4020 Programming Languages. Functional Programming Prof. Robert van Engelen
COP4020 Programmig Laguages Fuctioal Programmig Prof. Robert va Egele Overview What is fuctioal programmig? Historical origis of fuctioal programmig Fuctioal programmig today Cocepts of fuctioal programmig
More informationFrom last week. Lecture 5. Outline. Principles of programming languages
Priciples of programmig laguages From last week Lecture 5 http://few.vu.l/~silvis/ppl/2007 Natalia Silvis-Cividjia e-mail: silvis@few.vu.l ML has o assigmet. Explai how to access a old bidig? Is & for
More informationTopics. Instance object. Instance object. Fundamentals of OT. Object notation. How do objects collaborate? Pearson Education 2007 Appendix (RASD 3/e)
Appedix (RASD 3/e) MACIASZEK, L.A. (2007): Requiremets Aalysis ad System Desig, 3 rd ed. Addiso Wesley, Harlow Eglad ISBN 978-0-321-44036-5 Appedix Fudametals of Object Techology Pearso Educatio Limited
More informationn Learn how resiliency strategies reduce risk n Discover automation strategies to reduce risk
Chapter Objectives Lear how resiliecy strategies reduce risk Discover automatio strategies to reduce risk Chapter #16: Architecture ad Desig Resiliecy ad Automatio Strategies 2 Automatio/Scriptig Resiliet
More informationAbstract. Chapter 4 Computation. Overview 8/13/18. Bjarne Stroustrup Note:
Chapter 4 Computatio Bjare Stroustrup www.stroustrup.com/programmig Abstract Today, I ll preset the basics of computatio. I particular, we ll discuss expressios, how to iterate over a series of values
More informationC++, Visual C++, and Managed C++: What s the Difference?
02 6000 ch01 11/18/03 8:52 AM Page 7 C++, Visual C++, ad Maaged C++: What s the Differece? Differeces Betwee Visual C++ ad C++ C++ is a laguage, ad Visual C++ is a product. The laguage itself was developed
More informationn Haskell n Syntax n Lazy evaluation n Static typing and type inference n Algebraic data types n Pattern matching n Type classes
Aoucemets Quiz 7 HW 9 is due o Friday Raibow grades HW 1-6 plus 8. Please, read our commets o 8! Exam 1-2 Quiz 1-6 Ay questios/cocers, let us kow ASAP Last Class Haskell Sytax Lazy evaluatio Static typig
More informationChapter 4 Threads. Operating Systems: Internals and Design Principles. Ninth Edition By William Stallings
Operatig Systems: Iterals ad Desig Priciples Chapter 4 Threads Nith Editio By William Stalligs Processes ad Threads Resource Owership Process icludes a virtual address space to hold the process image The
More informationtop() Applications of Stacks
CS22 Algorithms ad Data Structures MW :00 am - 2: pm, MSEC 0 Istructor: Xiao Qi Lecture 6: Stacks ad Queues Aoucemets Quiz results Homework 2 is available Due o September 29 th, 2004 www.cs.mt.edu~xqicoursescs22
More informationA SOFTWARE MODEL FOR THE MULTILAYER PERCEPTRON
A SOFTWARE MODEL FOR THE MULTILAYER PERCEPTRON Roberto Lopez ad Eugeio Oñate Iteratioal Ceter for Numerical Methods i Egieerig (CIMNE) Edificio C1, Gra Capitá s/, 08034 Barceloa, Spai ABSTRACT I this work
More informationHow do we evaluate algorithms?
F2 Readig referece: chapter 2 + slides Algorithm complexity Big O ad big Ω To calculate ruig time Aalysis of recursive Algorithms Next time: Litterature: slides mostly The first Algorithm desig methods:
More informationΤεχνολογία Λογισμικού
ΕΘΝΙΚΟ ΜΕΤΣΟΒΙΟ ΠΟΛΥΤΕΧΝΕΙΟ Σχολή Ηλεκτρολόγων Μηχανικών και Μηχανικών Υπολογιστών Τεχνολογία Λογισμικού, 7ο/9ο εξάμηνο 2018-2019 Τεχνολογία Λογισμικού Ν.Παπασπύρου, Αν.Καθ. ΣΗΜΜΥ, ickie@softlab.tua,gr
More informationOnes Assignment Method for Solving Traveling Salesman Problem
Joural of mathematics ad computer sciece 0 (0), 58-65 Oes Assigmet Method for Solvig Travelig Salesma Problem Hadi Basirzadeh Departmet of Mathematics, Shahid Chamra Uiversity, Ahvaz, Ira Article history:
More informationCIS 121 Data Structures and Algorithms with Java Spring Stacks, Queues, and Heaps Monday, February 18 / Tuesday, February 19
CIS Data Structures ad Algorithms with Java Sprig 09 Stacks, Queues, ad Heaps Moday, February 8 / Tuesday, February 9 Stacks ad Queues Recall the stack ad queue ADTs (abstract data types from lecture.
More informationData Structures and Algorithms. Analysis of Algorithms
Data Structures ad Algorithms Aalysis of Algorithms Outlie Ruig time Pseudo-code Big-oh otatio Big-theta otatio Big-omega otatio Asymptotic algorithm aalysis Aalysis of Algorithms Iput Algorithm Output
More informationCS 111: Program Design I Lecture 15: Objects, Pandas, Modules. Robert H. Sloan & Richard Warner University of Illinois at Chicago October 13, 2016
CS 111: Program Desig I Lecture 15: Objects, Padas, Modules Robert H. Sloa & Richard Warer Uiversity of Illiois at Chicago October 13, 2016 OBJECTS AND DOT NOTATION Objects (Implicit i Chapter 2, Variables,
More informationPseudocode ( 1.1) Analysis of Algorithms. Primitive Operations. Pseudocode Details. Running Time ( 1.1) Estimating performance
Aalysis of Algorithms Iput Algorithm Output A algorithm is a step-by-step procedure for solvig a problem i a fiite amout of time. Pseudocode ( 1.1) High-level descriptio of a algorithm More structured
More informationWYSE Academic Challenge Sectional Computer Science 2005 SOLUTION SET
WYSE Academic Challege Sectioal Computer Sciece 2005 SOLUTION SET 1. Correct aswer: a. Hz = cycle / secod. CPI = 2, therefore, CPI*I = 2 * 28 X 10 8 istructios = 56 X 10 8 cycles. The clock rate is 56
More informationService Oriented Enterprise Architecture and Service Oriented Enterprise
Approved for Public Release Distributio Ulimited Case Number: 09-2786 The 23 rd Ope Group Eterprise Practitioers Coferece Service Orieted Eterprise ad Service Orieted Eterprise Ya Zhao, PhD Pricipal, MITRE
More informationOverview. Common tasks. Observation. Chapter 20 The STL (containers, iterators, and algorithms) 8/13/18. Bjarne Stroustrup
Overview Chapter 20 The STL (cotaiers, iterators, ad algorithms) Bjare Stroustrup www.stroustrup.com/programmig Commo tasks ad ideals Geeric programmig Cotaiers, algorithms, ad iterators The simplest algorithm:
More informationCode Review Defects. Authors: Mika V. Mäntylä and Casper Lassenius Original version: 4 Sep, 2007 Made available online: 24 April, 2013
Code Review s Authors: Mika V. Mätylä ad Casper Lasseius Origial versio: 4 Sep, 2007 Made available olie: 24 April, 2013 This documet cotais further details of the code review defects preseted i [1]. of
More informationArchitectural styles for software systems The client-server style
Architectural styles for software systems The cliet-server style Prof. Paolo Ciacarii Software Architecture CdL M Iformatica Uiversità di Bologa Ageda Cliet server style CS two tiers CS three tiers CS
More informationThreads and Concurrency in Java: Part 1
Cocurrecy Threads ad Cocurrecy i Java: Part 1 What every computer egieer eeds to kow about cocurrecy: Cocurrecy is to utraied programmers as matches are to small childre. It is all too easy to get bured.
More informationCMSC Computer Architecture Lecture 12: Virtual Memory. Prof. Yanjing Li University of Chicago
CMSC 22200 Computer Architecture Lecture 12: Virtual Memory Prof. Yajig Li Uiversity of Chicago A System with Physical Memory Oly Examples: most Cray machies early PCs Memory early all embedded systems
More informationCreating Test Harnesses and Starter Applications
03 6000 ch02 11/18/03 8:54 AM Page 27 Creatig Test Haresses ad Starter Applicatios Applicatio Types You Ca Create with Visual C++ Visual C++.NET comes with a package of wizards that geerate startig code
More informationThreads and Concurrency in Java: Part 1
Threads ad Cocurrecy i Java: Part 1 1 Cocurrecy What every computer egieer eeds to kow about cocurrecy: Cocurrecy is to utraied programmers as matches are to small childre. It is all too easy to get bured.
More informationWhat Is Object-Orientation?
Iformatio Systems Cocepts What Is Object-Orietatio? Roma Kotchakov Birkbeck, Uiversity of Lodo Based o Chapter 4 of Beett, McRobb ad Farmer: Object Orieted Systems Aalysis ad Desig Usig UML, (4th Editio),
More informationAppendix D. Controller Implementation
COMPUTER ORGANIZATION AND DESIGN The Hardware/Software Iterface 5 th Editio Appedix D Cotroller Implemetatio Cotroller Implemetatios Combiatioal logic (sigle-cycle); Fiite state machie (multi-cycle, pipelied);
More informationCopyright 2016 Ramez Elmasri and Shamkant B. Navathe
Copyright 2016 Ramez Elmasri ad Shamkat B. Navathe CHAPTER 22 Database Recovery Techiques Copyright 2016 Ramez Elmasri ad Shamkat B. Navathe Itroductio Recovery algorithms Recovery cocepts Write-ahead
More informationExercise Set: Implementing an Object-Oriented Design
Exercise Set: Implemetig a Object-Orieted Desig I this exercise set, we have marked questios we thik are harder tha others with a [ ]. We have also marked questios for which solutios are provided at the
More informationBaan Tools User Management
Baa Tools User Maagemet Module Procedure UP008A US Documetiformatio Documet Documet code : UP008A US Documet group : User Documetatio Documet title : User Maagemet Applicatio/Package : Baa Tools Editio
More informationCS 111: Program Design I Lecture 15: Modules, Pandas again. Robert H. Sloan & Richard Warner University of Illinois at Chicago March 8, 2018
CS 111: Program Desig I Lecture 15: Modules, Padas agai Robert H. Sloa & Richard Warer Uiversity of Illiois at Chicago March 8, 2018 PYTHON STANDARD LIBRARY & BEYOND: MODULES Extedig Pytho Every moder
More informationPython Programming: An Introduction to Computer Science
Pytho Programmig: A Itroductio to Computer Sciece Chapter 1 Computers ad Programs 1 Objectives To uderstad the respective roles of hardware ad software i a computig system. To lear what computer scietists
More informationClasses and Objects. Again: Distance between points within the first quadrant. José Valente de Oliveira 4-1
Classes ad Objects jvo@ualg.pt José Valete de Oliveira 4-1 Agai: Distace betwee poits withi the first quadrat Sample iput Sample output 1 1 3 4 2 jvo@ualg.pt José Valete de Oliveira 4-2 1 The simplest
More informationCS 111: Program Design I Lecture # 7: First Loop, Web Crawler, Functions
CS 111: Program Desig I Lecture # 7: First Loop, Web Crawler, Fuctios Robert H. Sloa & Richard Warer Uiversity of Illiois at Chicago September 18, 2018 What will this prit? x = 5 if x == 3: prit("hi!")
More informationLearning to Shoot a Goal Lecture 8: Learning Models and Skills
Learig to Shoot a Goal Lecture 8: Learig Models ad Skills How do we acquire skill at shootig goals? CS 344R/393R: Robotics Bejami Kuipers Learig to Shoot a Goal The robot eeds to shoot the ball i the goal.
More informationRunning Time. Analysis of Algorithms. Experimental Studies. Limitations of Experiments
Ruig Time Aalysis of Algorithms Iput Algorithm Output A algorithm is a step-by-step procedure for solvig a problem i a fiite amout of time. Most algorithms trasform iput objects ito output objects. The
More informationChapter 3 Classification of FFT Processor Algorithms
Chapter Classificatio of FFT Processor Algorithms The computatioal complexity of the Discrete Fourier trasform (DFT) is very high. It requires () 2 complex multiplicatios ad () complex additios [5]. As
More informationCOMPUTER ORGANIZATION AND DESIGN The Hardware/Software Interface. Chapter 4. The Processor. Single-Cycle Disadvantages & Advantages
COMPUTER ORGANIZATION AND DESIGN The Hardware/Software Iterface 5 th Editio Chapter 4 The Processor Pipeliig Sigle-Cycle Disadvatages & Advatages Clk Uses the clock cycle iefficietly the clock cycle must
More informationLinked Lists 11/16/18. Preliminaries. Java References. Objects and references. Self references. Linking self-referential nodes
Prelimiaries Liked Lists public class StrageObject { Strig ame; StrageObject other; Arrays are ot always the optimal data structure: A array has fixed size eeds to be copied to expad its capacity Addig
More informationBezier curves. Figure 2 shows cubic Bezier curves for various control points. In a Bezier curve, only
Edited: Yeh-Liag Hsu (998--; recommeded: Yeh-Liag Hsu (--9; last updated: Yeh-Liag Hsu (9--7. Note: This is the course material for ME55 Geometric modelig ad computer graphics, Yua Ze Uiversity. art of
More informationRunning Time ( 3.1) Analysis of Algorithms. Experimental Studies. Limitations of Experiments
Ruig Time ( 3.1) Aalysis of Algorithms Iput Algorithm Output A algorithm is a step- by- step procedure for solvig a problem i a fiite amout of time. Most algorithms trasform iput objects ito output objects.
More informationAnalysis of Algorithms
Aalysis of Algorithms Iput Algorithm Output A algorithm is a step-by-step procedure for solvig a problem i a fiite amout of time. Ruig Time Most algorithms trasform iput objects ito output objects. The
More informationGoals of this Lecture Activity Diagram Example
Goals of this Lecture Activity Diagram Example Object-Orieted Aalysis ad Desig - Fall 998 Preset a example activity diagram Ð Relate to requiremets, use cases, ad class diagrams Also, respod to a questio
More informationCOP4020 Programming Languages. Subroutines and Parameter Passing Prof. Robert van Engelen
COP4020 Programmig Laguages Subrouties ad Parameter Passig Prof. Robert va Egele Overview Parameter passig modes Subroutie closures as parameters Special-purpose parameters Fuctio returs COP4020 Fall 2016
More informationOutline. Research Definition. Motivation. Foundation of Reverse Engineering. Dynamic Analysis and Design Pattern Detection in Java Programs
Dyamic Aalysis ad Desig Patter Detectio i Java Programs Outlie Lei Hu Kamra Sartipi {hul4, sartipi}@mcmasterca Departmet of Computig ad Software McMaster Uiversity Caada Motivatio Research Problem Defiitio
More information9.1. Sequences and Series. Sequences. What you should learn. Why you should learn it. Definition of Sequence
_9.qxd // : AM Page Chapter 9 Sequeces, Series, ad Probability 9. Sequeces ad Series What you should lear Use sequece otatio to write the terms of sequeces. Use factorial otatio. Use summatio otatio to
More informationElementary Educational Computer
Chapter 5 Elemetary Educatioal Computer. Geeral structure of the Elemetary Educatioal Computer (EEC) The EEC coforms to the 5 uits structure defied by vo Neuma's model (.) All uits are preseted i a simplified
More informationWeb OS Switch Software
Web OS Switch Software BBI Quick Guide Nortel Networks Part Number: 213164, Revisio A, July 2000 50 Great Oaks Boulevard Sa Jose, Califoria 95119 408-360-5500 Mai 408-360-5501 Fax www.orteletworks.com
More informationThe Magma Database file formats
The Magma Database file formats Adrew Gaylard, Bret Pikey, ad Mart-Mari Breedt Johaesburg, South Africa 15th May 2006 1 Summary Magma is a ope-source object database created by Chris Muller, of Kasas City,
More informationCS 111: Program Design I Lecture # 7: Web Crawler, Functions; Open Access
CS 111: Program Desig I Lecture # 7: Web Crawler, Fuctios; Ope Access Robert H. Sloa & Richard Warer Uiversity of Illiois at Chicago September 13, 2016 Lab Hit/Remider word = "hi" word.upper() à "HI" Questio
More informationCSC 220: Computer Organization Unit 11 Basic Computer Organization and Design
College of Computer ad Iformatio Scieces Departmet of Computer Sciece CSC 220: Computer Orgaizatio Uit 11 Basic Computer Orgaizatio ad Desig 1 For the rest of the semester, we ll focus o computer architecture:
More informationHomework 1 Solutions MA 522 Fall 2017
Homework 1 Solutios MA 5 Fall 017 1. Cosider the searchig problem: Iput A sequece of umbers A = [a 1,..., a ] ad a value v. Output A idex i such that v = A[i] or the special value NIL if v does ot appear
More informationTask scenarios Outline. Scenarios in Knowledge Extraction. Proposed Framework for Scenario to Design Diagram Transformation
6-0-0 Kowledge Trasformatio from Task Scearios to View-based Desig Diagrams Nima Dezhkam Kamra Sartipi {dezhka, sartipi}@mcmaster.ca Departmet of Computig ad Software McMaster Uiversity CANADA SEKE 08
More informationModule 8-7: Pascal s Triangle and the Binomial Theorem
Module 8-7: Pascal s Triagle ad the Biomial Theorem Gregory V. Bard April 5, 017 A Note about Notatio Just to recall, all of the followig mea the same thig: ( 7 7C 4 C4 7 7C4 5 4 ad they are (all proouced
More informationBaan Finance Financial Statements
Baa Fiace Fiacial Statemets Module Procedure UP041A US Documetiformatio Documet Documet code : UP041A US Documet group : User Documetatio Documet title : Fiacial Statemets Applicatio/Package : Baa Fiace
More informationWhat does JFC stand for?
IS4300 HCI No-Quiz What does JFC stad for?! Java Fudametal Classes! Java Foudatio Creator! Java Fried Chicke! Java Foudatio Classes! Java Framework Creator 1 No-Quiz What is pluggable look ad feel?! Swig
More informationArea As A Limit & Sigma Notation
Area As A Limit & Sigma Notatio SUGGESTED REFERENCE MATERIAL: As you work through the problems listed below, you should referece Chapter 5.4 of the recommeded textbook (or the equivalet chapter i your
More informationDefinitions. Error. A wrong decision made during software development
Debuggig Defiitios Error A wrog decisio made durig software developmet Defiitios 2 Error A wrog decisio made durig software developmet Defect bug sometimes meas this The term Fault is also used Property
More informationAnalysis of Algorithms
Aalysis of Algorithms Ruig Time of a algorithm Ruig Time Upper Bouds Lower Bouds Examples Mathematical facts Iput Algorithm Output A algorithm is a step-by-step procedure for solvig a problem i a fiite
More informationΤεχνολογία Λογισμικού
ΕΘΝΙΚΟ ΜΕΤΣΟΒΙΟ ΠΟΛΥΤΕΧΝΕΙΟ Σχολή Ηλεκτρολόγων Μηχανικών και Μηχανικών Υπολογιστών Τεχνολογία Λογισμικού, 7ο/9ο εξάμηνο 2018-2019 Τεχνολογία Λογισμικού Ν.Παπασπύρου, Αν.Καθ. ΣΗΜΜΥ, ickie@softlab.tua,gr
More informationCIS 121. Introduction to Trees
CIS 121 Itroductio to Trees 1 Tree ADT Tree defiitio q A tree is a set of odes which may be empty q If ot empty, the there is a distiguished ode r, called root ad zero or more o-empty subtrees T 1, T 2,
More informationCopyright 2016 Ramez Elmasri and Shamkant B. Navathe
Copyright 2016 Ramez Elmasri ad Shamkat B. Navathe CHAPTER 20 Itroductio to Trasactio Processig Cocepts ad Theory Copyright 2016 Ramez Elmasri ad Shamkat B. Navathe Itroductio Trasactio Describes local
More informationTransitioning to BGP
Trasitioig to BGP ISP Workshops These materials are licesed uder the Creative Commos Attributio-NoCommercial 4.0 Iteratioal licese (http://creativecommos.org/liceses/by-c/4.0/) Last updated 24 th April
More informationCS 111: Program Design I Lecture 21: Network Analysis. Robert H. Sloan & Richard Warner University of Illinois at Chicago April 10, 2018
CS 111: Program Desig I Lecture 21: Network Aalysis Robert H. Sloa & Richard Warer Uiversity of Illiois at Chicago April 10, 2018 NETWORK ANALYSIS Which displays a graph i the sese of graph/etwork aalysis?
More informationMinimum Spanning Trees
Miimum Spaig Trees Miimum Spaig Trees Spaig subgraph Subgraph of a graph G cotaiig all the vertices of G Spaig tree Spaig subgraph that is itself a (free) tree Miimum spaig tree (MST) Spaig tree of a weighted
More informationMorgan Kaufmann Publishers 26 February, COMPUTER ORGANIZATION AND DESIGN The Hardware/Software Interface. Chapter 5
Morga Kaufma Publishers 26 February, 28 COMPUTER ORGANIZATION AND DESIGN The Hardware/Software Iterface 5 th Editio Chapter 5 Set-Associative Cache Architecture Performace Summary Whe CPU performace icreases:
More informationThe number n of subintervals times the length h of subintervals gives length of interval (b-a).
Simulator with MadMath Kit: Riema Sums (Teacher s pages) I your kit: 1. GeoGebra file: Ready-to-use projector sized simulator: RiemaSumMM.ggb 2. RiemaSumMM.pdf (this file) ad RiemaSumMMEd.pdf (educator's
More informationThe Implementation of Data Structures in Version 5 of Icon* Ralph E. Gr is wo Id TR 85-8
The Implemetatio of Data Structures i Versio 5 of Ico* Ralph E. Gr is wo Id TR 85-8 April 1, 1985 Departmet of Computer Sciece The Uiversity of Arizoa Tucso. Arizoa 85721 This work was supported by the
More information. Written in factored form it is easy to see that the roots are 2, 2, i,
CMPS A Itroductio to Programmig Programmig Assigmet 4 I this assigmet you will write a java program that determies the real roots of a polyomial that lie withi a specified rage. Recall that the roots (or
More informationn Some thoughts on software development n The idea of a calculator n Using a grammar n Expression evaluation n Program organization n Analysis
Overview Chapter 6 Writig a Program Bjare Stroustrup Some thoughts o software developmet The idea of a calculator Usig a grammar Expressio evaluatio Program orgaizatio www.stroustrup.com/programmig 3 Buildig
More informationSoftware development of components for complex signal analysis on the example of adaptive recursive estimation methods.
Software developmet of compoets for complex sigal aalysis o the example of adaptive recursive estimatio methods. SIMON BOYMANN, RALPH MASCHOTTA, SILKE LEHMANN, DUNJA STEUER Istitute of Biomedical Egieerig
More information6.854J / J Advanced Algorithms Fall 2008
MIT OpeCourseWare http://ocw.mit.edu 6.854J / 18.415J Advaced Algorithms Fall 2008 For iformatio about citig these materials or our Terms of Use, visit: http://ocw.mit.edu/terms. 18.415/6.854 Advaced Algorithms
More informationLast class. n Scheme. n Equality testing. n eq? vs. equal? n Higher-order functions. n map, foldr, foldl. n Tail recursion
Aoucemets HW6 due today HW7 is out A team assigmet Submitty page will be up toight Fuctioal correctess: 75%, Commets : 25% Last class Equality testig eq? vs. equal? Higher-order fuctios map, foldr, foldl
More informationData diverse software fault tolerance techniques
Data diverse software fault tolerace techiques Complemets desig diversity by compesatig for desig diversity s s limitatios Ivolves obtaiig a related set of poits i the program data space, executig the
More informationParametric curves. Reading. Parametric polynomial curves. Mathematical curve representation. Brian Curless CSE 457 Spring 2015
Readig Required: Agel 0.-0.3, 0.5., 0.6-0.7, 0.9 Parametric curves Bria Curless CSE 457 Sprig 05 Optioal Bartels, Beatty, ad Barsy. A Itroductio to Splies for use i Computer Graphics ad Geometric Modelig,
More informationPolynomial Functions and Models. Learning Objectives. Polynomials. P (x) = a n x n + a n 1 x n a 1 x + a 0, a n 0
Polyomial Fuctios ad Models 1 Learig Objectives 1. Idetify polyomial fuctios ad their degree 2. Graph polyomial fuctios usig trasformatios 3. Idetify the real zeros of a polyomial fuctio ad their multiplicity
More informationObject-Oriented Programming n
Object-Orieted Programmig Object-Orieted Programmig = Abstract Data Tpes package represetatio of data structure together with operatios o the data structure ecapsulate iteral implemetatio details + Iheritace
More informationBOOLEAN MATHEMATICS: GENERAL THEORY
CHAPTER 3 BOOLEAN MATHEMATICS: GENERAL THEORY 3.1 ISOMORPHIC PROPERTIES The ame Boolea Arithmetic was chose because it was discovered that literal Boolea Algebra could have a isomorphic umerical aspect.
More informationCS 111: Program Design I Lecture 19: Networks, the Web, and getting text from the Web in Python
CS 111: Program Desig I Lecture 19: Networks, the Web, ad gettig text from the Web i Pytho Robert H. Sloa & Richard Warer Uiversity of Illiois at Chicago April 3, 2018 Goals Lear about Iteret Lear about
More informationChapter 5. Functions for All Subtasks. Copyright 2015 Pearson Education, Ltd.. All rights reserved.
Chapter 5 Fuctios for All Subtasks Copyright 2015 Pearso Educatio, Ltd.. All rights reserved. Overview 5.1 void Fuctios 5.2 Call-By-Referece Parameters 5.3 Usig Procedural Abstractio 5.4 Testig ad Debuggig
More informationA Very Simple Approach for 3-D to 2-D Mapping
A Very Simple Approach for -D to -D appig Sadipa Dey (1 Ajith Abraham ( Sugata Sayal ( Sadipa Dey (1 Ashi Software Private Limited INFINITY Tower II 10 th Floor Plot No. - 4. Block GP Salt Lake Electroics
More informationn The C++ template facility provides the ability to define n A generic facility allows code to be written once then
UCLA PIC 10 B Problem Solvig usig C++ Programmig Ivo Diov, Asst. Prof. i Mathematics, Neurology, Statistics Istructor: Teachig Assistat: Suzae Nezzar, Mathematics Chapter 13 Templates for More Abstractio
More informationThe golden search method: Question 1
1. Golde Sectio Search for the Mode of a Fuctio The golde search method: Questio 1 Suppose the last pair of poits at which we have a fuctio evaluatio is x(), y(). The accordig to the method, If f(x())
More information