Department of Computer Science
Next:
Course study guide
Further languages course
R.G.Dickerson
Course study guide
Introduction to the course
Description
Motivation
Objectives
Assessment
Organisation of material
Getting access to a C++ compiler
Course contents
Learning schedule for year 2000-2001
Assessment of course
M.Sc. in Computer Science,
Further languages coursework 2002-2003:
Login accounting
Assessed objectives (from front cover)
Task
Hand in:
Marks awarded for: (from frontpage)
File reading hints
Course information form
Previous examination paper
Unit 1, Introduction to C++
Preview
Objectives
Unit
Summary
Unit 2, Functions and classes
Preview
Objectives
Unit
Summary
Unit 3, Arrays and separate compilation
Preview
Objectives
Unit
Exercises
Summary
Unit 4, Pointers
Preview
Objectives
Unit
Summary
Unit 5, References, constructors and templates
Preview
Objectives
Unit
Exercises
Summary
Unit 6, Inheritance
Preview
Objectives
Unit
Exercises
Summary
Unit 7, Features of programming languages and Prolog
Preview
Objectives
Unit
Summary
Unit 8, Functional languages: Haskell
Preview
Objectives
Unit
Exercises
Summary
Unit 9, Types, type checking, polymorphism and subtyping
Preview
Objectives
Unit
Summary
Unit 10, Scope, dependency, program structure and separate compilation
Preview
Objectives
Unit
C++
C++ after Java or Eiffel
C++Basic Components and Layout
First Example
Exercises
Second Example
Third Example
Fourth Example
Exercise
Functions
void
function results and arguments
Value and reference parameters
Exercises
A simple class
Header files
Exercise
Arrays
Arrays: the basics
Trivial exercise
An example class containing an array
Using the Class
The Class Definition
Exercise
Strings and arrays of characters in C++
C++
string
Arrays of characters:
char []
Array parameters
Exercises
Classes: Inline Functions and Outside Members
Non-class functions
The dictionary example
Inline expansion
The overhead of using classes
Program file structure
Avoiding repeated file inclusion
Pointers
Pointer arithmetic
The address operator
Pointers and Arrays
Exercise
Lists and dynamic data structures
Exercise
Lists and iterators
Exercise
When to use linked storage
References
Reference Parameters
Reference Results
Does it violate encapsulation?
More about constructors and destructors
Review of constructors
A new constructor for the
Dictionary
example
Overloading
A destructor for
Dictionary
A destructor for
List
X(const X&)
constructors
Built-in
X(const X&)
initialisation
X(const X&)
and parameters and results
System provided default constructors and class type members
Default constructors and arrays of objects
User-defined operators
Operator
+
example
Rules of Operator Definition
Assignment operator
Assignment and the copy constructor
When to define assignment operators
The equality operator
Indexing as an operator
Streams and I/O
File I/O
Overloading
<<
for Class Objects
const
members
Exercise
Templates
Template
Queue
``Outside'' functions and templates
Templates and separate compilation
The Standard Template Library
Sequential containers
Keyed access containers
Iterators
Examples
A vector
Iterators on a vector
Stream iterator adaptors
The set
Inheritance
Inheritance as extension
Classes cannot
see
all of themselves
Constructors in derived classes
Why didn't
MeanAcc
need a constructor?
Inheritance and sub-typing
Dynamic binding (or inheritance polymorphism)
Re-definition and use in a sub-type context
The limits to redefinition and private inheritance
Summary of scope and derived classes
Using inheritance in program design
Inheritance or composition
The different forms of inheritance
Using sub-type inheritance
Appendix: Answers to exercises
Answers for subsection
Answer for subsection
Answers for subsection
Answers for subsection
Answers for subsection
Answers for subsection
Answers for subsection
Answer for subsection
Answer for subsection
Answer for subsection
Language features and dimensions
The main components of languages
Evaluation Mechanism
Procedural or State-Transition
Functional or Applicative
Goal Achievment with Unification
Comparison
Data Types
Naming and declaration rules
A goal directed programming language: Prolog
Programs, the Interpreter and an Example
Entering Programs
Goals
Goals and Variables
Conjunction of goals
Rules
Rules with Alternatives
Predicates and terms
Syntax of predicates and terms
Syntax of predicates (literals)
Syntax of Terms
Structured terms
Infix expression form of structures
Arithmetic
The Evaluable Predicate
is
Numeric Relational Predicates
Numeric functions in Prolog
Structured Data: Lists
Matching Lists
Predicates Over Lists
An Example
Control and Cut
Rule Ordering
Cut
Input and Output
Files
Writing terms
Reading terms
Other Output Predicates
Example
Reading and Writing Characters
Example Reading Characters
A functional programming language: Haskell
Functional programming languages
Basic components
Primitive, built-in data types
Expressions
if
expressions
let
expressions
Definitions and declarations
Simple function definitions
Type constraint declarations
Type inference
Pre-defined composite types
Lists
Evaluating Haskell programs
More about functions
Patterns
Recusion interlude
Guarded expressions
Where definitions and scope
Polymorphic functions
Types, type checking and polymorphism
Static and dynamic type checking
Static Type Checking
Dynamic Type Checking
Checking with Sub-types
Subtyping and Inheritance
Subranges
Polymorphism
Some motivation for polymorphism
Monomorphism and type checking
Parametric polymorphism
Parametric polymorphism in functional languages
Templates in C++
Parametric polymorphism in Eiffel
What about Java?
Overloading (or ad-hoc polymorphism)
Resolving overloading with sub-types: inheritance polymorphism
Problems with overloading and type inference
Type classes
Haskell classes and classes in object oriented languages
Constrained type parameters to generics in Eiffel
Review of sub-typing and inheritance
Inheritance
Sub-typing and type checking
Subtyping and Inheritance
Overriding and inheritance polymorphism
Non-subtype inheritance
Pure abstract classes and interfaces
Interfaces
Contravariance and type checking
Eiffel example
Conclusion
Names, scope and encapsulation
Basic definitions
The importance of the choice scope rules
Local variables, blocks and nested scopes
Scope and dependency in functional languages
Objects, classes and scope
Class scope examples
Modules, packages and namespaces
Program structure, separate compilation and linking
Motivation
Advantages
Problems or issues
Units of separate compilation
Information required by clients of separate units
Interfaces and implementations of units
Managing re-compilation
Linkage and consistency
Bibliography
Next:
Course study guide
Page generated: 2002-11-04 by Bob Dickerson
© University of Hertfordshire Higher Education Corporation (1998)
Disclaimer