Cramming for CS 247. FAQ Q: Will you post these slides online? A: Yes.

Slides:



Advertisements
Similar presentations
Brown Bag #2 Advanced C++. Topics  Templates  Standard Template Library (STL)  Pointers and Smart Pointers  Exceptions  Lambda Expressions  Tips.
Advertisements

Abstract Data Types Data abstraction, or abstract data types, is a programming methodology where one defines not only the data structure to be used, but.
Inheritance Polymorphism Briana B. Morrison CSE 1302C Spring 2010.
Lecture 3 Feb 4 summary of last week’s topics and review questions (handout) Today’s goals: Chapter 1 overview (sections 1.4 to 1.6) c++ classes constructors,
. Templates. Example… A useful routine to have is void Swap( int& a, int &b ) { int tmp = a; a = b; b = tmp; }
ISBN Chapter 11 Abstract Data Types and Encapsulation Concepts.
Rossella Lau Lecture 11, DCO10105, Semester B, DCO10105 Object-Oriented Programming and Design  Lecture 11: Template and Operator overload  Template.
. Ex4 – preliminary feedback. Comments on Ex4 Cautionary note: u These are observations on some of the submitted exercises u The emphasis is to explain.
Chapter 16 Templates. Copyright © 2006 Pearson Addison-Wesley. All rights reserved Learning Objectives  Function Templates  Syntax, defining 
OOP Project Develop an Application which incorporates the following OO Mechanisms and Principals: – Classes Visibility Constructor(s) Class Variable (if.
1 Chapter 6 Lists Plus. ADT Sorted List Operations Transformers n MakeEmpty n InsertItem n DeleteItem Observers n IsFull n LengthIs n RetrieveItem Iterators.
Lecture 9 Concepts of Programming Languages
CS 2511 Fall Features of Object Oriented Technology  Abstraction Abstract class Interfaces  Encapsulation Access Specifiers Data Hiding  Inheritance.
CSE 332: C++ Classes From Procedural to Object-oriented Programming Procedural programming –Functions have been the main focus so far Function parameters.
Data Structures Using C++1 Chapter 2 Object-Oriented Design (OOD) and C++
CIT241 Prerequisite Knowledge ◦ Variables ◦ Operators ◦ C++ Syntax ◦ Program Structure ◦ Classes  Basic Structure of a class  Concept of Data Hiding.
CSE 332: C++ templates and generic programming I Motivation for Generic Programming in C++ We’ve looked at procedural programming –Reuse of code by packaging.
OOP Languages: Java vs C++
C++ / G4MICE Course Session 3 Introduction to Classes Pointers and References Makefiles Standard Template Library.
Object Oriented Programming using C++. Overview Problem Solving Features of an OOL Basic Syntax Programming Paradigms.
CSIS 123A Lecture 12 Templates. Introduction  C++ templates  Allow very ‘general’ definitions for functions and classes  Type names are ‘parameters’
Data Structures Using C++1 Chapter 2 Object-Oriented Design (OOD) and C++
1 Nell Dale Chapter 6 Lists Plus Slides by Sylvia Sorkin, Community College of Baltimore County - Essex Campus C++ Plus Data Structures.
CSE 332: C++ templates This Week C++ Templates –Another form of polymorphism (interface based) –Let you plug different types into reusable code Assigned.
Programming Languages and Paradigms Object-Oriented Programming (Part II)
Programming Languages and Paradigms Object-Oriented Programming.
1 Linked Stack Chapter 4. 2 Linked Stack We can implement a stack as a linked list. Same operations. No fixed maximum size. Stack can grow indefinitely.
Java Objects and Classes. Overview n Creating objects that belong to the classes in the standard Java library n Creating your own classes.
Software Design 1.1 Tapestry classes -> STL l What’s the difference between tvector and vector  Safety and the kitchen sink What happens with t[21] on.
1 Object-Oriented Programming Using C++ CLASS 1. 2 Review of Syllabus Catalog Description –An introduction to object oriented programming techniques using.
L11-12: Design Patterns Definition Iterator (L4: Inheritance)‏ Factory (L4: Inheritance)‏ Strategy (L5: Multiple Inheritance)‏ Composite (L6: Implementation.
Computing IV Singleton Pattern Xinwen Fu.
Pointer and Array Lists Chapter 3, Summary CS 244 Brent M. Dingle, Ph.D. Game Design and Development Program Department of Mathematics, Statistics, and.
1 Recall Definition of Stack l Logical (or ADT) level: A stack is an ordered group of homogeneous items (elements), in which the removal and addition of.
ISBN Chapter 11 Abstract Data Types and Encapsulation Concepts.
C++ Review Part 1: Mechanics Part 2: Basics Part 3: References Part 4: Const Part 5: Inheritance Part 6: Libraries Acknowledgement: Adapted from: Brown.
CS 11 C++ track: lecture 1 Administrivia Need a CS cluster account sysadmin/account_request.cgi Need to know UNIX (Linux)
Computer Science Projects Internal Assessment. Mastery Item Claimed Justification Where Listed Random Access File – Searching Lines P. 53 Random.
OOP using C Abstract data types How to accomplish the task??? Requirements Details Input, output, process Specify each task in terms of input.
1 OOP - An Introduction ISQS 6337 John R. Durrett.
OOP in C++ CS 124. Program Structure C++ Program: collection of files Source (.cpp) files be compiled separately to be linked into an executable Files.
Methodology First and Language Second -A Way to Teach Object-Oriented Programming Haibin Zhu, PhD Department of Computer Science and Mathematics Nipissing.
CS-1030 Dr. Mark L. Hornick 1 Basic C++ State the difference between a function/class declaration and a function/class definition. Explain the purpose.
1.Which of the following statements is correct?
1 CS Programming Languages Class 22 November 14, 2000.
Chapter 3 Templates. Objective In Chapter 3, we will discuss: The concept of a template Function templates Class templates vector and matrix classes Fancy.
C++ Classes C++ Interlude 1 Data Structures and Problem Solving with C++: Walls and Mirrors, Carrano and Henry, © 2013.
Chapter 11: Inheritance and Composition. Introduction Two common ways to relate two classes in a meaningful way are: – Inheritance (“is-a” relationship)
Lecture 7.  There are 2 types of libraries used by standard C++ The C standard library (math.h) and C++ The C++ standard template library  Allows us.
Object-Oriented programming in C++ Classes as units of encapsulation Information Hiding Inheritance polymorphism and dynamic dispatching Storage management.
Copyright © 2012 Pearson Education, Inc. Chapter 10 Advanced Topics.
Interlude 1 C++ Classes CS Data Structures Mehmet H Gunes Modified from authors’ slides.
CS 215 Final Review Ismail abumuhfouz Fall 2014.
Abstract Data Types and Encapsulation Concepts
Object-Oriented Programming (OOP) Lecture No. 45
C++ Plus Data Structures
Object-Orientated Programming
C++ Classes C++ Interlude 1
Lecture 9 Concepts of Programming Languages
Exam 1 Review CS 3358.
Abstract Data Types and Encapsulation Concepts
Andy Wang Object Oriented Programming in C++ COP 3330
Exam 1 Review CS 3358.
Doubly Linked List Implementation
CMSC 341 C++ and OOP.
Andy Wang Object Oriented Programming in C++ COP 3330
Doubly Linked List Implementation
Final Exam Review Inheritance Template Functions and Classes
CMSC 341 C++ and OOP.
Lecture 9 Concepts of Programming Languages
Presentation transcript:

Cramming for CS 247

FAQ Q: Will you post these slides online? A: Yes.

Single ADT Design

02 - Classes in C++ ADTs, Classes, Objects Constructor Destructor Private vs public Friends

03 – Design decisions for a single class Should we write a constructor? Should the constructor be explicit? class Stack{ public: explicit Stack(int size); };

03 – Design decisions for a single class Accessor and Mutator class Integer{ int x; public: void setX(const int x); int getX() const; };

03 – Design decisions for a single class Operator overloading class Integer{ int x; public: Integer operator+ (const Integer &y) const; };

04 – Consts and References int *p; const int *p; int const *p; int *const p; const int *const p;

05 – Copy constructor Purpose: Duplicating an existing object How copy constructors work How operator= works How operator== works More design decisions

Multiple ADT Design

06 – Modules.h files contain DECLARATIONS.cpp files contain DEFINITIONS The “make” command Makefile

06 – Modules Namespaces What does “using namespace” std mean?

08 – UML Diagrams Visual representation of ADTs class Integer{ int x; public: void setX(const int x); int getX() const; } Integer - x : int + setX(int) + getX() : int

08 – UML Diagrams Arrows : navigability A has a pointer to B Numbers : multiplicity A has 2 instances of B A B A B 2

08 – UML Diagrams A and B are related B is part of A B is part of A, and B cannot exist without A A B A B A B

09 – Aggregation and Composition How to code aggregation and composition in C++ A B A B

10 - Inheritance Creating new classes based on previous ones class Animal { public: void walk(); }; class Cat : public Animal { public: void purr(); }; Animal has 1 function: walk Cat has 2 functions: purr walk

11 - Polymorphism Allowing objects to take many forms Animal *a = new Animal(); //OK Animal *b = new Cat(); //Also OK Function override, virtual functions

12 – Design principles What CAN we inherit? What SHOULD we inherit? HOW should we inherit? Inheritance vs Composition

Program Maintenance

07 - Testing What is unit testing? System vs Integration testing What is boundary testing? Black box vs white box testing Assert function

15 - Debugging Using the GDB debugger Debugger commands

14 - Exceptions try and catch syntax in C++ More design principles – When SHOULD we try and catch? – When SHOULDN’T we try and catch?

Design Patterns

16 – 19 - Design Patterns An algorithm is a standard step-by-step routine for solving a problem (e.g. quicksort) A data structure is a standard organization of data in memory (e.g. linked list) A design pattern is a standard object-oriented architectural layout (e.g. strategy pattern)

16 – 19 - Design Patterns Strategy Pattern SortStrategy sort() Quicksort sort() Mergesort sort() SortedArray sort() Element *

16 – 19 - Design Patterns Strategy Pattern Template Method Factory Method Observer Pattern Model View Controller Composite Pattern Iterator Pattern Decorator Pattern

STL

20 - Templates Classes that support multiple data types template class Stack{ … }; Stack integerStack; Stack floatStack;

21 – Generic Algorithms in STL #include – copy – find #include

21 – Generic Contains in STL #include More STL iterators