COMP345:
Advanced Program Design with C++
Slides Set_0
Department of Computer Science and Software Engineering Concordia University
Contents
1. 2. 3.
Course outline History of C++
C++ tools and libraries
Course Administration
▪ Instructor: Dr. Nora Houari, P. Eng.
E-mail: houari@encs.concordia.ca
Office hours: via zoom/ private by appointment
▪ Lectures ” Remote”
➢ Live session: W-F: 14:45-16:00 Remote via zoom ➢ recorded (Moodle), available on Sunday
➢ Labs: livestream zoom + recording
➢ Course information and updates on Moodle
Lectures
❑ Asynchronous (non-interactive videos)
▪ covers material presented on the course Notes
▪ objective: absorb the material at your own pace/schedule
▪ videos posted at then end of every week for next week’s material
▪ listen to the videos carefully before coming to online zoom meeting
❑ Synchronous (interactive zoom lecture)
▪ zoom class meeting during normal lecture time
▪ objective: discuss the material presented in the videos
▪ come prepared with questions about the material presented in the videos
Laboratories
▪ Start the week: Jan 20th
▪ Same as for the lectures
asynchronous videos posted every week
zoom meeting during lab time for discussions
much more useful if you come prepared to the lab time
▪ Objectives of the labs:
go in more details onto the examples presented in the lectures give more examples
answer questions from the students about the examples
help working on the assignments
▪ There will be a programming examination (15%) on April 7th / 9th during lab time
Zoom Etiquette
▪ Use your real name
▪ to prevent Zoom Bombing, users not on my class roster will be removed
▪ Do not share the Zoom link
▪ to prevent Zoom Bombing, users not on my class roster will be removed
▪ If possible, Turn ON your camera
▪ it’s nice to know who I am talking to 😉
▪ we can see your facial expressions and better judge if you understand or not
▪ Recordings
▪ Lecture time & tutorials will be recorded and posted on Moodle (just for us)
▪ if you do not want to be recorded, turn Off your camera ;-( but a picture of yourself would be appreciated
Zoom Etiquette
▪ Mute yourself
▪ unless I ask you to unmute yourself to ask a question
▪ If you have a question
▪ use the public chat to ask your question o to say “I have a question”
▪ you can raise your virtual hand, but since we are 160 in the class, I will probably not see it ▪ If I miss your question, I am sorry, just send me an email after
▪ Chit-Chat vs Question to me
▪ Use the public chat only for “real” questions
▪ chit-chat with your friends go on privates chats (but try to avoid in case you make a mistake, and your comment goes public 😉
Course information
Prerequisites
▪ COMP352 previously or concurrently
▪ It is assumed that all students have extensive experience with computer programming,
though no prior knowledge or experience of C++ is assumed.
Course content
▪Introduction to C++.
▪I/O with stream classes.
▪Pointers their usage and types
▪Memory management
▪The Standard Template Library (STL): containers, algorithms, iterators, adaptors, function objects.
▪Class design: constructors, destructors, operator overloading, inheritance, virtual functions. ▪Exception handling
▪Design patterns.
▪Advanced topics: libraries, locales, STL conventions,
▪Template meta-programming
▪Applications of C++: Systems, Engineering, Game Programming
Course: Rationale
▪ MostofourcoursesaretaughtusingtheJavaprogramminglanguage.
▪ C++ programming is pervasive in many key areas of the software industry:
▪ Computer games and entertainment industry ▪ Audio/Video processing
▪ Computer device drivers
▪ Control systems
▪ Telecommunications systems ▪ Embedded software systems ▪ Simulation systems
▪ Medical imaging
▪ Though C++ and Java have many similar syntactical elements and structures, C++ has many subtleties, technicalities and features that differ from Java.
▪ Most importantly, its implementation and runtime systems is very different from Java, which makes it well-adapted to the application areas mentioned previously.
▪ This course aims at teaching C++ to an audience well-trained in computer programming and putting the newly acquired knowledge into practice through a challenging project build through 3 assignments.
Grading Scheme
Midterm exam 20% Final exam* (35+15) 50%
3 Assignments(3×10) 30 % Teams Project
(5 members)
Previous projects
…
…
You must pass: assignments and
final (written & programming)
to pass the course at least (%50)
10
Important Notes Cont’d
❑ All students should install VPN for remote desktop access to Concordia University computer labs
https://www.concordia.ca/it/support/connect-from-home.html
Once you have VPN connection to Concordia University, you can access to all available software in Gina Cody School labs by following the process described in: https://www.concordia.ca/ginacody/aits/support/faq/connect-from-home.html
❑ Download Course specific software:
C++Compilers/ IDEs (e.g. Microsoft Visual C++ 2010; Eclipse for C++; GNU; Apple Xcode C++;) ❑ All students are expected to do online, timed exams
▪ Both midterm and final exams will be through Moodle
▪ Course instructor reserves the right to conduct an individual oral examination to verify
student’s response to online exam questions
Examinations
▪ Online written midterm examination ▪ Moodle
▪ no invigilation
▪ during lecture time
▪ Online written final examination ▪ Moodle
▪ no invigilation
▪ during examination week
▪ Both midterm and written examination
▪
▪ There is multiple choice questions
▪ Questions with details design and code answers
Online programming final examination
▪ you are given some programming exercises
▪ Write code, fix code, add code to existing code
▪ you submit all answers online
▪ Scheduled at the end of the term in the lab(~ Apr 7th and 9th during your class scheduled lab), during ~2 hours
Assignments/Project
▪ The 3 assignments is to be undertaken a team of 5 members. ▪ The assignments are the 3 components of a realistic project.
They consist of building a challengingly large C++ program.
▪ During the 3 deliveries, you have to demonstrate that your code includes many of the C++ features presented in the lectures.
1 3
Assignments/Project
▪ Since you can not meet physically, sharing code will be more problematic
▪ Highly recommended that you use an online versioning system ❖ github
❖ Bitbucket
❖ ..etc
▪ Assignment demonstrations will be online using zoom ▪ Very short presentations: come well-prepared
Assignments/Project Cont’d
▪ Must work as a team in “the real world” ▪ Communicate teammate
▪ Communication problems are natural!
▪ What have you done?
▪ You must document your work!
▪ Everyone must keep an on-line notebook/Forum
▪ Communicate with me
▪ How is the team’s plan/progress is going?
▪ Short progress reports/meetings are required:
▪ What is the responsibility of each of the two members?
References
▪ Y. Daniel Liang. Introduction to Programming with C++. Third Edition, Prentice-Hall, 2014. ISBN-13: 978-0-13-325281-1
▪ Bjarne Stroustrup. The C++ Programming Language. Fourth edition. Addison-Wesley, 2013. ISBN- 13: 978-0-321-56384-2
▪ Walter Savitch. Absolute C++. Fifth Edition, Addison-Wesley, 2013. ISBN-13: 978-0-13-283071-3
▪ Walter Savitch. Problem Solving with C++. Ninth Edition, Pearson, 2014. ISBN-13: 978-0-13-379174-
3
▪ Bjarne Stroustrup. A Tour of C++. Addison-Wesley, 2014. ISBN-13: 978-0-321-958310
▪ Bjarne Stroustrup. Foundations of C++. Proc. 22nd European Symposium on Programming (ESOP). Springer LNCS 7211. April 2012.
▪ Bjarne Stroustrup. A history of C++: 1979–1991. In History of programming languages—II, Thomas J. Bergin, Jr. and Richard G. Gibson, Jr. (Eds.). ACM, New York, NY, USA 699-769. 1996. DOI:10.1145/234286.1057836
▪ Bjarne Stroustrup. The Design and Evolution of C++. Addison Wesley, ISBN:0-201-54330-3. March 1994
References Cont’d
▪ Bjarne Stroustrup. Adding Classes to C: An Exercise in Language Evolution. Software – Practice and Experience, Vol. 13, pp. 139-161, 1983.
▪ Bjarne Stroustrup. Classes: an abstract data type facility for the C language. SIGPLAN Not. 17, 1. January 1982, 42-51. DOI:10.1145/947886.947893
▪ Onlineofficiallanguagedocumentation: ▪ cppreference.com
▪ cplusplus.com
▪ isocpp.org
▪ Microsoft. C++ Language Reference.
▪ Otherusefulresources(amongmanyothers–notofficial): ▪ Stack Overflow
▪ Tutorials Point ▪ Geeks for Geeks ▪ Programmiz
To do from now on….
▪ Sign up for this class on Moodle
❖Monitor the Moodle for course content and announcement ❖Start thinking about project teams (5 members) right away.. ❖You need to pick up your team by Jan 26th at the latest ❖Structure how to work/communicate and have fun!
▪ Decide if you are willing and able to handle the workload.
19
Things You Already Know(aka cheating)…
▪ Cheating includes not only copying the work of another person(or letting another student copy your work), but also excessive collaboration.
▪ It is an academic offence to claim someone else’s work as your own.
▪ Do not copy, paraphrase or translate anything from anywhere without saying where you obtained it!
How to do well in your course ?
▪ This course requires a fair amount of time commitments!
▪ Lectures: Weekly/ 3 assignments, team project, Midterm & Final.
❑ Programming is not “spectator sport”. You need to get your hand dirty by doing the assignments and trying the examples/exercises discussed in class and lab
▪ You need to be steeped in to appreciate it.
▪ Intellectually rich and rewarding experience.
20
CEAB/CIPS Graduate Attributes
▪ This course covered the following attributes ➢ Knowledge-base
➢ Design
➢ Use of tools
➢ Individual and team work ➢ Communication skills
21
Contents
1. 2. 3.
Course outline History of C++
C++ tools and libraries
Introduction to C++
• C++ is a programming language :
❖ statically typed (type of variable known at the compile time) ❖ multi-paradigm ( O.O.; generic programming)
❖ compiled
❖ general-purpose
• It is a middle-level language, as it comprises a combination of both high-level and low-level language features.
• It was developed by a Danish Scientist Prof. Bjarne Stroustrup starting in 1979 at Bell Laboratories as an enhancement to the C programming language following the object-oriented principles pioneered by Simula.
Bjarne Strousroup
Introduction to C++: Principles and goals
▪ Bjarne Stroustrup describes some principles that he used for the design of C++:
▪ Statically typed, general-purpose language, as efficient and portable as C
▪ Direct and comprehensive support for multiple programming styles (procedural programming, data abstraction, object-oriented programming, and generic programming)
▪ Give the programmer choice, even if this makes it possible for the programmer to choose incorrectly
▪ As compatible with C as possible, providing a smooth transition from C
▪ Avoid features that are platform specific or not general purpose
▪ Not incur overhead for features that are not used
▪ Function without a sophisticated programming environment
• Goals:
• Augment C with the notion of classes and inheritance
• Keep the same performance as C
• Keep same applicability as C
Introduction to C++: History, versions
▪ Stroustrup began to work on C++ in 1979.
▪ The idea of creating a new language originated from Stroustrup’s experience in programming for his
Ph.D. thesis.
▪ Stroustrup found that Simula had features that were very helpful for large software development, but the language was too slow for practical use.
▪ Remembering his Ph.D. experience, Stroustrup set out to enhance the C language with Simula-like features.
▪ C was chosen because it was general-purpose, fast, portable and widely used.
▪ Besides C and Simula, some other languages that inspired him were ALGOL 68 (as most modern programming languages), Ada (templates), CLU (exception handling, templates) and ML (lambda expressions).
Introduction to C++: History, versions
▪ InitialmodificationstoCincluded(1980):
▪ type checking and conversion for function parameters
▪ classes: data structures (struct) encapsulating functions ▪ derived classes (inheritance)
▪ public/private access modifiers
▪ constructors/destructors
▪ friend classes
▪ Lateradded(1981): ▪ inline functions
▪ default function parameters
▪ overloading of assignment operator
▪ The resulting language was named “C with Classes“
▪ Furtherevolutions(1983-1984):
▪ virtual methods and dynamic binding mechanism ▪ method and operator overloading
▪ reference types
▪ After this, the language was renamed as “C++”.
Introduction to C++: History, versions
▪ Commercialimplementations: ▪ Release 1.0 (1985):
▪ implemented as a C++ to C language translation system called Cfront ▪ Release 2.0 (1989):
▪ multiple inheritance,
▪ abstract classes,
▪ static member functions, ▪ const member functions, ▪ protected members
▪ Release 3.0 (1990): ▪ templates
▪ exception handling
▪ namespaces
▪ new type cast operations ▪ Boolean type
Introduction to C++: History, versions
▪ Standards:
▪ C++98 (1998): First C++ standard
▪ C++03 (2003): Minor revision
▪ C++11 (2011): Major revision
▪ C++14 (2014): Small extension of C++11
▪ C++14 (2017): ISO/IEC 14882:2017
▪ C++20(2020) approved on 4th September 2020,and published by ISO in December 2020.
Source https://isocpp.org/std/the-standard
Introduction to C++: Positive and negative aspects
▪ Positive aspects:
▪ General purpose language
▪ Language implementation focus on high performance and lean runtime system ▪ Provides both high-level abstraction and low-level programming features
▪ Popularity and availability of tools
▪ Negative aspects:
▪ Very large and complex language that requires deep technical knowledge in order to properly use
it
▪ Its low-level capacities and focus on efficiency make it an unsecure language
▪ Many C++ developments, such as the Standard Template Library add features that add security and abstraction, and free the programmer from low-level programming, but to the detriment of performance compared to C
C++
Introduction to C++: Popularity and significance
❑ Factors for popularity:
❖ C++ is a superset of C: a C++ compiler can compile C programs, and C code and libraries can
be reused in C++ classes and programs
❖ C++ was designed for performance similar with C
❖ A great number of reliable C++ compilers are available for most platforms
❖ C++ was the first object-oriented programming language suitable for the development of large commercial software
❖ A very wide array of C++ libraries are available, both for general use and for specialized purposes
❖ An enormous amount of C++ code has been written, which in turn either makes it prone to reuse or binds the developers to the language
Introduction to C++: Popularity and significance
❖ C++ is widely used in the software industry.
❖ In terms of usage, is one of the most popular languages ever created.
❖ Some of its application domains include key areas of software development such as systems software, device drivers, application software, embedded software, high-performance server and client applications, video and audio processing, and entertainment software such as video games and computer animation.
❖ C++ continues to be one of the preferred programming languages to develop professional applications.
❖ The language has gone from being initially mostly Western to attracting programmers from all over the world.
Contents
1. 2. 3.
Course outline History of C++
C++ tools and libraries
C++ Tools and Libraries
❑ Compilers and IDEs
▪ Apple Xcode C++
▪ Bloodshed Dev-C++
▪ Code::Blocks
▪ Cygwin
▪ Eclipse for C++
▪ MINGW – “Minimalist GNU for Windows”
▪ GNU CC
▪ The LLVM Compiler
Infrastructure
▪ Microsoft Visual C++ 2010
▪ Sun Studio NetBeans
❑ General
▪ Boost
▪ MFC: Microsoft Foundation classes
▪ STL: Standard Template Library ❑ GUI
▪ MFC GUI
▪ Qt
▪ SFML
▪ WxWidgets
▪ …. Other open source libraries
Remark on what follows
▪ “Keep simple things simple,
as simple as possible, but not simpler!” (Einstein)
▪ Problem: where to start when learning a programming language?
❖ In order to be able to start at all we have to …
1. take certain things for granted
2. learn the WHY over time
Advice
▪ Don’t be afraid
▪ Learning a new language takes time
▪ Practice, practice, practice
▪ Read a lot about it (books and C++ forums / as well as code) ▪ Do the lab exercises
▪ Always ask yourself: Why does this work?
❖ If you are curious about something →use forum
❖ … and share your knowledge and discuss with friends
▪ Programming will be fun when understood
Recap of the week and what is next
We look at
▪ Course outline ▪ What is C++? ▪ History of C++ ▪ Compilers
▪ C++ program structure
▪ Component and compilation unit
▪ header file and compilation file ▪ Namespaces
▪ Basic terms & concepts
Introduction to C++: References
▪ International Organization for Standardization. ISO/IEC 14882:1998 Programming languages – C++. 1998.
▪ International Organization for Standardization. ISO/IEC 14882:1998 Programming languages – C++. 2003.
▪ International Organization for Standardization. ISO/IEC 14882:1998 Information technology — Programming languages – C++. 2011.
▪ International Organization for Standardization. ISO/IEC 14882:2020
▪ Bjarne Stroustrup. A Tour of C++. Addison-Wesley, 2014. ISBN-13: 978-0-321-958310
▪ Bjarne Stroustrup. The Design and Evolution of C++. Addison Wesley, ISBN:0-201-54330-3. March 1994
▪ Bjarne Stroustrup. A history of C++: 1979–1991. In History of programming languages—II, Thomas J. Bergin, Jr. and Richard G. Gibson, Jr. (Eds.). ACM, New York, NY, USA 699-769. 1996. DOI:10.1145/234286.1057836
▪ Joey Paquet COMP345 course Notes Concordia university.