Presentation is loading. Please wait.

Presentation is loading. Please wait.

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

Similar presentations


Presentation on theme: "Cramming for CS 247. FAQ Q: Will you post these slides online? A: Yes."— Presentation transcript:

1 Cramming for CS 247

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

3 Single ADT Design

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

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

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

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

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

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

10 Multiple ADT Design

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

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

13 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

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

15 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

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

17 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

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

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

20 Program Maintenance

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

22 15 - Debugging Using the GDB debugger Debugger commands

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

24 Design Patterns

25 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)

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

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

28 STL

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

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

31 21 – Generic Contains in STL #include More STL iterators


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

Similar presentations


Ads by Google