Description
This course examines how to program in C++ in a robust and safe manner. C++ is an unsafe programming language, meaning each programmer â not the programming language â must enforce basic invariants concerning abstractions and modularity. The purpose of this course is to introduce students to the programming in C++ and its pitfalls; how standard libraries try to eliminate these pitfalls and fail; and what kind of tools programmers use to overcome the pitfalls.
The course reviews basics, including scoping, typing, and primitive data structures. Discusses data types (primitive, array, structure, class, string); addressing/parameter mechanisms (value, pointer, reference); stacks; queues; linked lists; binary trees; hash tables; and the design of classes and class inheritance, emphasizing single inheritance. Considers the instantiation of objects, the trade-offs of stack vs. heap allocation, and the design of constructors and destructors. Emphasizes the need for a strategy for dynamic memory management. Addresses function and operator overloading; templates, the Standard Template Library (STL), and the STL components (containers, generic algorithms, iterators, adaptors, allocators, function objects); streams; exception handling; and system calls for processes and threads.
Learning Objectives
- Learn how to program C++ in a clear, robust, efficient, and safe manner.
- Learn about simple and complex data structures in C++.
- Learn about memory allocation and deallocation from both the C and C++ perspectives.
- Develop a strategy for memory management that will avoid leaks.
- Learn how the features of C++ may be used in a productive way.
- Learn about the pitfalls and bugs that may occur if C++ is used improperly.
- Become knowledgeable about system libraries, especially, the STL.
- Become knowledgeable using a unit testing framework.
- Become knowledgeable using a low-level debugger.
- Become knowledgeable using a memory debugger.
Textbooks
There is no required textbook for this course. But the following books closely follow the weekly course schedule:
- Murach and Delamater - Murach's C++ Programming, 2018
- Deitel and Deitel - C++ How to Program, 9th or 10th edition
We also use material from the following textbooks extensively during our lectures:
- Effective Modern C++: 42 Specific Ways to Improve Your Use of C++11 and C++14 (By Scott Meyers), Oreilly
- Bjarne Stroustrup - The C++ Programming Language: C++11, 4th edition, ISBN-13: 978-0321563842, Addison-Wesley Professional
- Richard Reese - Understand and Using C Pointers: Core Techniques for Memory Management, 1st edition, ISBN-13: 978-1449344184
The following reference books can also be used for some extra reading:
- Advanced C++ Programming Cookbook (By Rian Quinn), Packt Publishing
- Expert C++ (By Vardan Grigoryan, Shunguang Wu), Packt Publishing
- C++ Templates: The Complete Guide (By David Vandevoorde, Nicolai M. Josuttis, Douglas Gregor), 2nd Edition, Addison-Wesley Professional
- C++ Concurrency in Action, (By Anthony Williams), Second Edition, Manning Publications
Note: NU students have free online access to most or all O'Reilly books via the NU
Library. Go to
https://library.northeastern.edu/research/resources/items/oreilly-for-higher-education-previously-safari-books-online
and follow the links. If asked to select your institution, select "None of the Above", which
is the first item on the menu, and log in with your northeastern.edu email address. This
will get you full access, and will also keep track of your favorites, etc.
List of Topics
The following (tentative) schedule is currently planned:
- Module 1: Basic Linux Commands; Using Makefile; Using GitHub; Hello World! Program
- Module 2: Variables, data types and operations; Using libraries like string and cmath; Conditional statements and loops
- Module 3: Number systems and bit-wise operations; Basic debugging; Working with iostream, file stream, string stream; Introduction to pointers
- Module 4: Built-in arrays, array and vector classes, and c-string; Functions, Overloading; Code Organization and using Namespaces
- Module 5: Pointers; Multi-dimensional Arrays and Double Pointers; C-Strings and String Manipulation Libraries
- Module 6: Dynamic memory allocation; Structures with pointer, enumerations, Unions, Bit-fields
- Module 7: Debugging (gnu debugger, and ddd), Memory Leak (valgrind); Standard Template Library
- Module 8: Standard Template Library (containers, iterators and algorithms) and Lamda expressions; Exceptions
- Module 9: Classes; Inheritance and Operator overloading; Object-oriented design
- Module 10: Inheritance and Polymorphism; vtables and vpointers; More object-oriented design with CRC Cards
- Module 11: Special members (rule of 0, rule of 3 and rule of 5); Smart pointers (unique, shared, and weak pointers)
- Module 12: Generic Programming with Templates, Building C++ Libraries; What's new in C++20 (Concepts, Ranges, Modules and Coroutines)
- Module 13: Miscellaneous Topics: Test Driven Development, Code Coverage; Multi-threading and Asynchronous Programming in C++
- Module 14: Advanced Topics in C++11: L-value and R-value references, Perfect Forwarding with Variadic Template Arguments
The weekly outline / schedule can also be found on Canvas.
Grading
My general philosophy is: Your learn programming by doing programming! To that effect, you will have the opportunity to demonstrate your knowledge of the course materials through regular coding work. Some of the work may have to be completed in groups.
The final grade for this course will be
calculated as a weighted average of scores for
practice activities, weekly homeworks, and final project, to be computed as follows:
- Practice Activities: 15%
- Assignments: 70%
- Final {Group} Project: 15%
Grading Scale
A-
[90 - 94)
(that is, 90 ≤ your average
< 94, etc.)
Scores will not be rounded; however, a curve may be introduced at the Instructor's discretion.
Attendance
- All students are required to attend all lectures.
- Attendance will be required to receive any credit on practice activities.
- Sickness or other unplanned or extraordinary events happen and will be dealt with individually. It is your responsibility to ensure your situation is known to the Instructor as soon as reasonably possible. NU's absence policy provides related details.
Instructor Meeting
- To pass this class, you must meet with the instructor during office hours atleast once (after Week 4). The purpose is (1) to get to know you, and (2) help improve your experience in the course {by providing any support you may need}. Please email the instructor to schedule an appointment if the office hours' schedule doesn't work for you.
Late Work and Makeup Policy
- No Late work will be accepted for Practice Activities and Final Project. Assignments may be submitted late without excuse for up to 24 hrs but will incur a 15% penalty. No submission will be accepted after 24 hrs.
- For assignments and practice activities, you will have ONE makeup opportunity {each} during the semester (details will be announced in class).
Final Project
- Final Project is REQUIRED and failure to submit the project will result in âFâ for the course. There is no exam in this course.