Synopsis:
Last time we discussed the course syllabus, exams and projects. Today we focus on implementing Abstract Data Types using
the C++ Programming Language.
Readings and Activities for the Week:
- CPPPL Text: Chapters 6, 16, 17. Treat Chapters 7 - 15 as reference material.
- Look carefully at your first Project assignment: Projects > Project #1
- Compare that to the first Sample Project: Projects > Project #1 Sample
Glossary of Terms
-
Abstract Data Type (ADT):
"Formally, an ADT may be defined as a class of objects whose logical behavior is defined by a set of values and a set of operations" - Wikipedia. We take some liberty with that (accepted) definition, and use the following: An abstract Data Type is a user defined class that is used to create instances behaving very like built-in primitive types. That means that instances can be created in static, stack, or heap memory, copied and assigned, and destroyed when the thread of program execution leaves the scope in which the ADT instance was declared. They can be passed to functions by value or by reference, and arrays of instances can be created with the same syntax used for primitive types.
Lecture Content:
-
Thinking about Projects:
In these video lectures we will discuss Sample Projects, similar to the ones you will be implementing. In the corresponding synchronous lectures the instructor will provide some limited guidance for each of your projects.-
Sample Project #1,
Code folder
Lexical Analyzer - returns sets of tokens for subsequent analysis. -
Sample Project #2,
Code folder
Rule-based parser When starting an implementation you think about:- Tasks
- Processing flow
- Communication
- Sharing
-
Sample Project #3,
Code folder
Abstract Syntax Tree -
Sample Project #4,
Code folder
Remote Multi-threaded Code Analysis Implementation
-
Sample Project #1,
Code folder
-
Primary Focus Today - Abstract Data Types:
Abstract Data Types Presentation, pptx
What does it take to make objects of your class behave like built in types? STR class
This is the code used as the primary example in the presentation, above. It is a good example of an ADT. However, you should prefer the std::string class for all your development work. C++ Operators pptx vector3D
An example of an Abstract Data Type that is rich in operators. Shows the accepted style for building ADT classes with mathematical operations. Design Principles
Principles that guide Object Oriented Design. -
Looking ahead, getting to know templates:
Quick overview Templates Presentation, pptx
Templates are one of the terrific features of the C++ language. Almost all of the Standard Template Library (STL) is implemented with templates, and they are very useful in day-to-day programming. fully functional C++ Properties, courtesy of templates
This project demonstrates how easy it is to extend the C++ language. C++ doesn't natively support properties but it's not hard to provide them. First template demo
Provides a simple type to string conversion facility. Template Code Examples
Basic and some more advanced template examples. STL Container examples
This code contains a simple example of the new Variadic Template functionality in the "inserter" project. Survey of STL Container Classes
Simple demos of almost all of the STL containers. STL Template-based Functors and Algorithms
Another set of template code examples, including functors, algorithms, and several other things you need to know. Functor examples Excellent template Q&A
This is a good place to find information to supplement class texts and notes. -
Preparation for Synchronous Discussion:
- Look carefully at the ADT presentation. Be prepared to discuss differences between copy and move construction.
-
Lecture Take-away:
The most important things covered today were:- Details provided in the ADT presentation and STR class.
Next week, in Wk 3a, we will begin discussing C++ Templates, using the resources listed above, so please review this weekend.
- Both Workflowy and gliffy are Google tools, available without charge, from Google play store. It works best to install them from the chrome browser.