CSCE-622 Generic Programming

The Essentials

CourseCPSC-622 : Generic Programming, MWF 10:20AM-11:10PM CE 203
InstructorJaakko Järvi
Course pages
Office hoursBy appointment (my office is 416)
Teaching AssistantJohn Freeman (, office hours: Tuesdays and Wednesdays, 2–3PM, HRBB 414D


Wed Nov 10 00:30:17 2010
The fourth assignment is out
Wed Oct 27 01:10:23 2010
The third assignment is out
The first assignment is out
The second assignment is out

In a nutshell

Study of the generic programming approach to design and systematic classification of software components. Techniques for achieving correctness, efficiency, and generality of algorithms, data structures, and memory management. Methods of structuring a library of generic software components for maximum usability are practiced in a significant design and implementation project, or analyzed in a research project.

The main programming tool used in the course is C++, but we take a close look of language constructs for generic programming in several other programming languages, including Generics in Java (or C#), and Haskell, We will also get acquainted with new language features of C++ that improve support for generic programming in C++.

  • Note to a prospective student:

    If you are thinking of a research career in programming languages, or in such areas of software engineering as reusable software libraries, generic or generative programming etc., you are well advised to take the course. Research in this area is very active: generics in several mainstream languages are evolving constantly, as well as the mechanisms to exploit genericity to change and improve programming practices. After Generic Programming, Programming Language Design (604) in the spring is the next natural choice if you are serious in pursuing research in this field.


Course work

The course will have (about) five programming assignments and one final project. The final project is either a large design and implementation project done in a group, or a research project, that can be individual.

Assignments will be managed and turned in electronically (preferably via CSNET). You may be required to demonstrate your programs to the instructor. Some assignments, as well as the final project, will be done in groups of two or three students. You may form groups on your own, but you will be in the same group for the entire semester. For the problem sets, each group will turn in one copy of the assignment, with the names of all group members on it.

Each programming assignment will cover a major course topic and may (will) involve a significant amount of programming. **Do not wait until the night before an assignment is due to start working on it!**

Late work will be accepted, but a penalty of 20% per calendar day late will be assessed. Assignments are due at 11:59PM on their due date, unless otherwise instructed.


Your course grade will be based on assignments (50%), and term projects (50%). Class presentations affect the grading of term projects. After assigning the grade based on the above criteria, not participating in classes can reduce your grade by up to 10 percent points. A perfect attendance is not required, but expect this clause to be in effect if I rarely see you in class.

A grade of 90% or above guarantees an A, 80% or above a B, 70% or above a C, and 60% or above a D.

This grading formula implies that there is no curve; your grade will depend only on how well you do, and not on how well everyone else does. (If everyone does exceptionally badly on some assignment, I may decide the assignment was at fault rather than the students, in which case I'll adjust the grade cutoffs as I deem appropriate. But I won't adjust in the other direction; if everyone gets an A, that's great).

All grade assignments are final—unless there was a mistake made in recording your semester grades or in computing your final grade. If all numbers are correctly recorded and computed, I will not discuss changing the resulting letter grades.

There are situations that may warrant regrading a particular assignment. For example, making addition errors in computing your score, not seeing or recognizing an answer that you gave, or not understanding an answer that you gave. Requests for regrading of assignments must be made within one week after the graded work has been handed back.


Academic Integrity Policy: An Aggie does not lie, cheat, or steal or tolerate those who do. The Honor Council Rules and Procedures are available on the web

Americans with Disabilities Act (ADA) Policy: The Americans with Disabilities Act (ADA) is a federal anti-discrimination statute that provides comprehensive civil rights protection for persons with disabilities. Among other things, this legislation requires that all students with disabilities be guaranteed a learning environment that provides for reasonable accommodation of their disabilities. If you believe you have a disability requiring an accommodation, please contact the Department of Student Life, Services for Students with Disabilities, in Room 126 of the Koldus Building or call 845-1637.


The following is a tentative list of topics discussed during the course:

  • Motivation for genericity, software components, reuse
  • Some necessary C++ background relevant for generic programming
  • The design principles of the STL part of the C++ standard library
  • Process of generic programming
  • Concept taxonomies in library design
  • Concepts as constraints to type parameters
  • Performance of generic code (and how to measure it)
  • Analyzing language features that support generic programming (we look at languages such as C#, Java, Haskell, …)
  • Dissecting the Boost Graph Library
  • Metaprogramming (Boost Metaprogramming Library, Expression Templates, MetaOCaml, …)
  • Generative programming
  • C++ ``concepts'' — constrained generics in C++

Schedule and material

Some of the slides are based on earlier presentations, or other material, contributed by numerous people, in particular, Andrew Lumsdaine, Jeremiah Willcock, Jeremy Siek, Dave Musser, Alex Stepanov, Dave Abrahams, and Doug Gregor.

Mon, Aug 30IntroductionSlides 1
Wed, Sep 1Introduction, C++ template featuresSlides 2
Fri, Sep 3C++ template features
Mon, Sep 6C++ template features
Wed, Sep 8C++ template features
Fri, Sep 10GP Process, STLSlides 3 Slides 3 (4up)
Mon, Sep 13STL, discussion of EoP Ch1
Wed, Sep 15STL, Expressing Concepts, Refinement
Fri, Sep 17STL, Iterator Concepts, Algortihms
Mon, Sep 20STL, Container Concepts, discussion of Eop Ch2
Wed, Sep 22Functions and function objectsSlides 4 Slides 4 (4up)
Fri, Sep 24Adaptors
Mon, Sep 27(Discussion of EoP Ch3), Associated types, traits
Wed, Sep 29Traits, Allocators
Fri, Oct 1Approaches to constrained generics
Mon, Oct 4(EoP Ch4), Approaches to constrained genericsSlides 5 Slides 5 (4up)
Wed, Oct 6Approaches to constrained generics
Fri, Oct 8Projects
Mon, Oct 11Andrew Sutton: Inferring concept constraints
Wed, Oct 13John Freeman: C++0x lambda functions
Fri, Oct 15Approaches to constrained generics, F-bounded polym.Concepts.pptx
Mon, Oct 18(EoP Ch5), Type classes
Wed, Oct 20Type classes, ML Functors
Fri, Oct 22BGLSlides 13 Slides 13 (4up)
Mon, Oct 25(EoP Ch6) BGL
Wed, Oct 27BGL
Fri, Oct 29BGL
Mon, Nov 1(EoP Ch7) BGL, MetaprogrammingSlides 20
Wed, Nov 3Metaprogramming
Fri, Nov 5Metaprogramming
Mon, Nov 8(EoP Ch8) Metaprogramming
Wed, Nov 10Metaprogramming
Fri, Nov 12Metaprogramming.Slides 12
Mon, Nov 15(EoP Ch9) Enable_if.
Wed, Nov 17C# and Java genericsSlides 16
Fri, Nov 19C# and Java generics (Project presentation)
Mon, Nov 22
Wed, Nov 24
Fri, Nov 26Thanksgiving: no class
Mon, Nov 29Project presentations
Wed, Dec 1Project presentations
Fri, Dec 3Project presentations
Mon, Dec 6Project presentations


  • Assignment 1 Due on Tue, 14th of September. This assignment is to be done individually.
  • Assignment 2 Due on Fri, 1st of October. This assignment is to be done individually.
  • Assignment 3 Due on Fri, 5th of November. This assignment is to be done in pairs (within your project teams).
  • Assignment 4 Due on Mon, 22nd of November. This assignment is to be done in pairs (within your project teams).


The projects instruction page.



The main tool you will be needing in this course is a C++ compiler. Get your hands on one by whatever means you wish. I will also ask your returned assignments to come equipped with Makefiles that build your programs; familiarize yourself with make. Also, be prepared to create pdf files by some means; pdf is the format that you are required to return your write-ups in. A handy tool for this is LaTeX (in fact, pdfLaTeX).

Instructions on other software tools we may possibly need will be given later.


Though not following it directly, we will use the book

  • Alexander Stepanov, Paul McJones: Elements of Programming

quite a lot, so I recommend getting it.

The following list of books contain useful reference or otherwise related material for the course (but you do not need to acquire them for just this course):


The Boost Library Collection
SGI STL pages (complete online STL reference manual)

Author: Jaakko Jarvi

Date: 2010-11-17 00:50:56 CST

HTML generated by org-mode 7.01trans in emacs 23