Day |
Chapters & Strategies |
Topics |
1 |
Course Introduction
Format and schedule
|
- Course contents - what to expect from the course
- Course format - lectures and workshops, timing
- Scope
|
1 |
C Fundamentals
Fundamental features of the C language that are necessary to learn C++
|
- File structure, main() function, compilations
- Blocks and scope
- Control flow, conditions, loops
- Arrays and pointers
- Structures
- Functions, parameters, return values, standard libraries
- Exercises
|
1 |
Object-Oriented Features
Fundamental OO features, embodied in C++ classes
|
- Basic OO concepts, example
- Classes: definition, attributes, methods
- Customer class: definition/declaration, implementation
- File organization: header files, implementation files
- Minimum class functions: declaration, implementation
|
1 |
Objects
Two different types of C++ objects and safe waysof handling them
|
- Definition, UML syntax, comparison with classes
- Creating C++ objects: automatic, dynamic
- Automatic objects: syntax, proper style, common mistakes
- Dynamic objects: syntax, features, common mistakes
- Managing object pointers to keep them safe.
|
1 |
What we've seen so far...
Reviewing the C++ / OO world
|
- OO concepts
- C++ Keywords
- C++ features
- C++ class versus the UML analysis model
- C++ class versus the UML design model
|
1 |
C++ Application Code
Building a basic C++ application
|
- The required main() function
- The main() function file
- Application files
|
1 |
Lab One
Building the Customer C++ application
|
- The Customer application in C++
- Project, directories and files
- Running the application
|
1 |
Constructors
A fundamental OO feature
|
- Constructor role, syntax
- Example: header file, implementation file
- Constructor with default parameter values
- Constructor header, implementation and usage
- What we just learned
|
1 |
Encapsulating into an object
How a String class can be designed to greatly simplify the Customer class, according to OO strategies
|
- We can accomplish more
- Impact of a String object to the Customer class
- The String class: features, design, attributes, methods
|
1 |
Lab Two
Appreciating the power of encapsulation and specialization
|
- String class implementation
- Using the String class in the Customer class
- Code review and discussion
|
2 |
Destructors
The art of describing complex object interactions
|
- Role, syntax, usage
- Code examples with the Customer and Credit classes
- Header and implementation files for destructors
|
2 |
Lab Three
Implementing the String destructor
|
- Dynamic de-allocation
- Array de-allocation
- Run, test, debug
|
2 |
Associations
How objects stay in touch with each other
|
- Self-reference, the this pointer
- Credit and Customer class associations code
- main(): how the association is used
- Association UML syntax and examples
- Reflexive associations for diagraphs, linked lists, hierarchies.
- Association roles
|
2 |
Lab Four
Making objects interact with each other in C++
|
- Applications made of interacting objects
- Simple linked list example
- List and Link class members
- Putting Customer objects in the list
- Write, test, debug and extra credits
|
2 |
Inner Classes
The proper syntax for private objects and true encapsulation
|
- Principles
- Inline Syntax
- Header / implementation syntax
- Code example
|
2 |
Lab Five
Inner classes at work
|
- Link as an inner class of List
- Credit as an inner class of Customer
- Code, test, debug
- Code review
- Solution discussion
|
3 |
What we've learned...
Summarizing the key OO features and techniques, implemented in C++
|
- Encapsulating string matters in a String class
- C++ application architecture
- Allocation / de-allocation of objects
- Encapsulation / specialization
- Constructors / Destructors
- Associations
- this self reference
- Object design fundamental strategies
- Inner classes
|
3 |
C++ References
A nicer and safer syntax to handle objects
|
- Concept and formal syntax
- Example with the Person class
- Methods returning a reference to self
- Example
- Brief exercise
|
3 |
Initialization
Starting with a value
|
- Object initialization
- Declaration, implementation, usage
- Member initialization
- Example with the String and Person classes
- Initializing primitive type members
- Formal syntax
|
3 |
Lab Six
Initializing many objects and members
|
- Initializing String members in Customer and Credit classes
- Initializing List using either references or pointers
- Write, run, test, debug
- Solution walkthrough
|
3 |
C++ Operators
A simple and powerful syntax to handle a natural need
|
- A natural need
- Alternate syntax for methods
- Examples and formal syntax
- Complete case: the Complex class
- Internal and external operators
|
3 |
Lab Seven
Creating your own operators
|
- String class assignment and append operators
- Write, run, test, debug
- Solution walkthrough
|
4 |
Static
Class members as opposed to object members
|
- Beyond objects: class members
- Examples, allocation, initialization
- Brief exercise
|
4 |
Composition / Aggregation
Objects containing or owning other objects
|
- Definition and UML syntax
- The real composition concept
- Multiple parts
- Aggregation versus composition
- Inner class notation
- Class type notation
- Examples in C++
- Brief exercise
|
4 |
Constant members (const)
A simple syntax to enforce proper OO design strategies
|
- Const members
- Const parameters
- Const variables
- Const methods
- Examples
- Brief exercise
|
4 |
Inheritance
Modeling type hierarchies
|
- Definition and UML syntax
- Instantiation limitations
- Inheritance versus the Is A relationship
- Inherited object examples
- Multiple sub-classes and multiple inheritance
|
4 |
Inheritance C++ syntax
Coding inheritance in C++
|
- Derivation model and code: simple inheritance
- Multiple inheritance
- Initialization according to constructor needs
- Initialization according to inheritance type
- Example with Contract / Development / Maintenance
- Virtual methods
|
4 |
Lab Eight
Coding a C++ project involving inheritance, associations, aggregation
|
- The Retail problem domain model
- Associations, compositions
- Inheritance and virtual methods
- show() and getPrice() methods
- Write, test, debug and solution code walkthrough
|
We'll consult with you and pick one or two chapters from the following list of optional topics. More details about these topics are given below.
Day |
Chapters & Strategies |
Topics |
5 |
Interfaces (optional)
Generalizing a group of methods that form a functional concept
|
- The concept of interface and UML notation
- Pure virtual classes and inheritance for interfaces
- C++ examples
- Brief exercise
|
5 |
Exception Handling (optional)
Encapsulating and processing exceptions outside the main business logic.
|
- Inner class exception type and value
- try, throw and catch
- Call stack handling
- Throwing objects for better exception handling
- Building self-contained exception classes
- Building exception class hierarchies
- Exceptions with templates
- Exceptions and constructors
- Exception interface specification
- Examples
- Exercise
|
5 |
Object Design (optional)
Fundamental principles and basic patterns
|
- Specialization, self-sufficiency, interface
- Delegation, propagation
- A common object design pattern
- Application to the Deal model
- Multiple and cascading object interactions in C++
- Object sequence and collaboration diagrams
- Examples
- Brief exercise
|
5 |
C++ implementation of associations and association classes (optional)
Design and coding of the most common relationships
|
- Implementation algorithm
- Single or multiple links
- Single or bi-directional traversals
- References or lists of references
- Association classes implementation
- Examples
- Brief exercise
|
5 |
Templates (optional)
Beyond classes and models: templates and meta models
|
- Concept, flexibility and power
- Examples, formal syntax
- Header and implementation parts (both in header file)
- Complex class complete example
- Brief exercise on the Complex class
|
5 |
Lab Nine (optional)
Implementing a whole template
|
- Concept of a parametized List<T>
- Implementing the Link<T> template
- Implementing the List<T> template
- Additional methods
- Write, test, debug and solution code walkthrough
|