COMP345.0.introduction

advertisement
COMP 345 - Advanced Program Design with C++
1
ADVANCED PROGRAM DESIGN
WITH C++
Part 0:
Introduction to the course
Introduction to C++
Concordia University
Department of Computer Science and Software Engineering
Joey Paquet, 2007-2014
COMP 345 - Advanced Program Design with C++
2
INTRODUCTION TO THE
COURSE
Concordia University
Department of Computer Science and Software Engineering
Joey Paquet, 2007-2014
COMP 345 - Advanced Program Design with C++
3
Introduction to the course: Instructor
• Name: Joey Paquet
• Position: Associate Professor, Department of Computer Science and Software
Engineering
• Teaching topics: Programming languages, Compiler design, Software engineering
and programming methodology
• Research topics: Design and implementation of programming languages, Parallel
and/or distributed computing, Demand-driven computation, Context-driven
computation
• Contact information:
• Web: www.cse.concordia.ca/~paquet
• E-mail: paquet@cse.concordia.ca
• Office: EV 3-221
• Office hours: Fridays 10am-12pm
Concordia University
Department of Computer Science and Software Engineering
Joey Paquet, 2007-2014
COMP 345 - Advanced Program Design with C++
4
Introduction to the course: Calendar description
• Prerequisite: COMP 352 previously or concurrently. Introduction to C++. I/O with
stream classes. Pointers and their uses. The Standard Template Library (STL):
containers, algorithms, iterators, adaptors, function objects. Class design:
constructors, destructors, operator overloading, inheritance, virtual functions,
exception handling, memory management. Advanced topics: libraries, locales,
STL conventions, concurrency, template metaprogramming. Applications of C++:
systems, engineering, games programming. Project. Lectures: three hours per
week. Laboratory: two hours per week.
Concordia University
Department of Computer Science and Software Engineering
Joey Paquet, 2007-2014
COMP 345 - Advanced Program Design with C++
5
Introduction to the course: Rationale
• Most of our courses are taught using the Java programming language.
• 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.
Concordia University
Department of Computer Science and Software Engineering
Joey Paquet, 2007-2014
COMP 345 - Advanced Program Design with C++
6
Introduction to the course: Project
• The project is to be undertaken small teams (typically 4 members) and consists of
the building of a challengingly large and complex C++ application.
• The completion of the project is divided into two separate components:
• (1) the Intermediate Project Delivery is a first operational build of the software,
effectively demonstrating the full implementation of some important software
features;
• (2) the Final Project Delivery is the demonstration of the finalized version of
your software.
• During the project deliveries, you also have to demonstrate that your code
includes many of the C++ features presented in the lectures.
• The individual assignments will also be related to the project.
Concordia University
Department of Computer Science and Software Engineering
Joey Paquet, 2007-2014
COMP 345 - Advanced Program Design with C++
7
Introduction to the course: Graduate attributes
• As part of both the Computer Science and Software Engineering program
curriculum accreditation, the content of this course includes material and
exercises related to the teaching and evaluation of graduate attributes.
• Graduate attributes are skills that have been identified by the Canadian
Engineering Accreditation Board (CEAB) and the Canadian Information Processing
Society (CIPS) as being central to the formation of Engineers, computer scientists
and information technology professionals.
• The accreditation criteria for the Software Engineering and Computer Science
programs dictate that graduate attributes are taught and evaluated as part of the
courses.
• This particular course aims at teaching and evaluating 3 graduate attributes. The
following is a description of these attributes, along with a description of how
these attributes are incorporated in the course.
Concordia University
Department of Computer Science and Software Engineering
Joey Paquet, 2007-2014
COMP 345 - Advanced Program Design with C++
8
Introduction to the course: Graduate attributes
• Graduate attribute 1: Problem analysis
• Definition: the ability to use appropriate knowledge and skills to identify, analyze,
and solve complex engineering problems in order to reach substantiated
conclusions.
• The project in this course is defined in a way that requires the students to analyze
the problem at hand before and determine for themselves exactly what needs to
be done, and then determine how and with the help of what tools and software
libraries it can be achieved.
Concordia University
Department of Computer Science and Software Engineering
Joey Paquet, 2007-2014
COMP 345 - Advanced Program Design with C++
9
Introduction to the course: Graduate attributes
• Graduate attribute 2: Design
• Definition: the ability to design solutions for complex, open-ended engineering
problems and to design systems, components or processes that meet specified
needs with appropriate attention to health and safety risks, applicable standards,
and economic, environmental, cultural and societal considerations.
• The project in this course is presented in an open-ended fashion, and its size and
complexity is such that it needs to be tackled in teams. The individual
assignments provide a platform for designing at a smaller level, and provide the
additional difficulty of having to be integrated in the larger design of the project.
Concordia University
Department of Computer Science and Software Engineering
Joey Paquet, 2007-2014
COMP 345 - Advanced Program Design with C++
10
Introduction to the course: Graduate attributes
• Graduate attribute 3: Use of Engineering tools
• Definition: the ability to create, select, apply, adapt, and extend appropriate
techniques, resources, and modern engineering tools to a range of engineering
activities, from simple to complex, with an understanding of the associated
limitations.
• The course teaches the use of the C++ language, and leaves the students free to
select what programming environment and libraries that they will use in the
assignments and project. Selection and use of the right tools and libraries is a
crucial aspect of accomplishing the practical work.
Concordia University
Department of Computer Science and Software Engineering
Joey Paquet, 2007-2014
COMP 345 - Advanced Program Design with C++
11
Introduction to the course: Evaluation
• Individual evaluation components:
• Written examinations (midterm, final): 15% + 30%
• Individual assignments (3):
3 X 5%
45%
15%
• Team work evaluation components:
• Intermediate project delivery:
• Final project delivery:
Concordia University
Department of Computer Science and Software Engineering
15%
25%
Joey Paquet, 2007-2014
COMP 345 - Advanced Program Design with C++
12
Introduction to the course: Bibliography
• Y. Daniel Liang. Introduction to Programming with C++. Third Edition, Prentice•
•
•
•
•
•
•
Hall, 2014. ISBN-13: 978-0-13-325281-1
Walter Savitch. Absolute C++. Fifth Edition, Addison-Wesley, 2013. ISBN-13: 9780-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-321958310
Bjarne Stroustrup. The C++ Programming Language. Fourth edition. AddisonWesley, 2013. ISBN-13: 978-0-321-56384-2
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-20154330-3. March 1994
Concordia University
Department of Computer Science and Software Engineering
Joey Paquet, 2007-2014
COMP 345 - Advanced Program Design with C++
13
Introduction to the course: Bibliography
• 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
Concordia University
Department of Computer Science and Software Engineering
Joey Paquet, 2007-2014
COMP 345 - Advanced Program Design with C++
14
INTRODUCTION TO C++
History
Features and goals
Significance
Tools
Concordia University
Department of Computer Science and Software Engineering
Joey Paquet, 2007-2014
COMP 345 - Advanced Program Design with C++
15
Introduction to C++
• C++ is a statically typed, multi-paradigm, compiled,
general-purpose programming language.
• It is a middle-level language, as it comprises a
combination of both high-level and low-level
language features.
• It was developed by Bjarne Stroustrup starting in 1979
at Bell Laboratories as an enhancement to the C
programming language following the object-oriented
principles pioneered by Simula.
Concordia University
Department of Computer Science and Software Engineering
Bjarne Strousroup
Joey Paquet, 2007-2014
COMP 345 - Advanced Program Design with C++
16
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
Concordia University
Department of Computer Science and Software Engineering
Joey Paquet, 2007-2014
COMP 345 - Advanced Program Design with C++
17
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,
Ada, CLU and ML.
Concordia University
Department of Computer Science and Software Engineering
Joey Paquet, 2007-2014
COMP 345 - Advanced Program Design with C++
18
Introduction to C++: History, versions
• Initial modifications to C included (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
• Later added (1981):
• inline functions
• default function parameters
• overloading of assignment operator
• The resulting language was named "C with Classes“
• Further evolutions (1983-1984):
• virtual methods and dynamic binding mechanism
• method and operator overloading
• reference types
• After this, the language was renamed as “C++”.
Concordia University
Department of Computer Science and Software Engineering
Joey Paquet, 2007-2014
COMP 345 - Advanced Program Design with C++
19
Introduction to C++: History, versions
• Commercial implementations:
• 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
Concordia University
Department of Computer Science and Software Engineering
Joey Paquet, 2007-2014
COMP 345 - Advanced Program Design with C++
20
Introduction to C++: History, versions
• Standards:
• C++98 (1998): First C++ standard
• C++03 (2003): Minor revision
• C++11 (2011): Major revision
Concordia University
Department of Computer Science and Software Engineering
Joey Paquet, 2007-2014
COMP 345 - Advanced Program Design with C++
21
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 insecure 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
Concordia University
Department of Computer Science and Software Engineering
Joey Paquet, 2007-2014
COMP 345 - Advanced Program Design with C++
22
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 extremely great amount of C++ code has been written, which in turn either makes it
prone to reuse or binds the developers to the language
Concordia University
Department of Computer Science and Software Engineering
Joey Paquet, 2007-2014
COMP 345 - Advanced Program Design with C++
23
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.
Concordia University
Department of Computer Science and Software Engineering
Joey Paquet, 2007-2014
COMP 345 - Advanced Program Design with C++
24
Introduction to C++: Tools
• 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
Concordia University
Department of Computer Science and Software Engineering
Joey Paquet, 2007-2014
COMP 345 - Advanced Program Design with C++
25
Introduction to C++: Libraries
• General
• Boost
• MFC: Microsoft Foundation classes
• STL: Standard Template Library
• GUI
• MFC GUI
• Qt
• SFML
• WxWidgets
Concordia University
Department of Computer Science and Software Engineering
Joey Paquet, 2007-2014
COMP 345 - Advanced Program Design with C++
26
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.
Bjarne Stroustrup. A Tour of C++. Addison-Wesley, 2014. ISBN-13: 978-0-321958310
Bjarne Stroustrup. The Design and Evolution of C++. Addison Wesley, ISBN:0-20154330-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
Concordia University
Department of Computer Science and Software Engineering
Joey Paquet, 2007-2014
Download