Skip to main content

Imperative Programming II:  2017-2018

Lecturer

Degrees

Preliminary ExaminationsComputer Science and Philosophy

Preliminary ExaminationsComputer Science

Preliminary ExaminationsMathematics and Computer Science

Term

Overview

This course, given in the Scala programming language, introduces different techniques for the design, specification, and implementation of small to medium size programs within the Object-Oriented Programming (OOP) paradigm. The course only assumes familiarity with the essential concepts and constructs of imperative programming, such as conditionals, loops, etc., but it is self contained otherwise. After introducing Scala, the course focuses on three main topics: Abstract Data Types (ADTs), principles of OOP, and Design Patterns in the OOP framework.

Learning outcomes

After taking the course, participants will be able to

  • Specify simple abstract data types and design implementations using abstraction functions.
  • Use and recognise features of OOP design patterns and give examples of their use.
  • Develop Scala programs following both common design patterns and the priniciples of OOP.
  • Read and modify small to medium size Objected-Oriented programs within software designs.

Synopsis

WEEK 1 OOP in Scala

  • Lecture 01: Programming in Scala
  • Lecture 02: Objects and classes
  • Lecture 03: Concrete Data Structures
  • Lecture 04: Overview of OOP Scala features

WEEK 2 Designing with ADTs

  • Lecture 05: Programming with ADTs
  • Lecture 06: Specifying ADTs
  • Lecture 07: Implementing ADTs
  • Lecture 08: Rules for ADTs

WEEK 3 Designing with Objects

  • Lecture 09: Basic OOP features
  • Lecture 10: Object identity and encapsulation
  • Lecture 11: Subclasses and inheritance
  • Lecture 12: Abstraction and polymorphism

WEEK 4 OOP Design Patterns

  • Lecture 13: Design patterns in OOP
  • Lecture 14: Creational design patterns
  • Lecture 15: Structural design patterns
  • Lecture 16: Behavioural design patterns

Lab sessions: The course is complemented with four lab sessions, using the Scala language.

  • 1. Programming in Scala.
  • 2. Programming with ADTs.
  • 3. Programming with objects.
  • 4. Programming with patterns for OOP.

Syllabus

  • Lecture 01: Programming in Scala. In this lecture the Scala programming language is introduced. The students learn about the following programming language constructs of Scala: conditionals, loops, types, functions, I/O libraries, etc. They also learn how to use the read-eval-loop mode of Scala.  
  • Lecture 02: Objects and classes. In this lecture the students learn how to implement slightly more structured programs with the use of objects and classes in Scala. They also learn about some useful Scala libraries.
  • Lecture 03: Concrete Data Structures. In this lecture the students learn how to use arrays, lists, and other useful concrete data structures already available in the standard distribution of Scala.
  • Lecture 04: Overview of OOP Scala features. In this lecture the students learn about Scala features that will be used to implement OOP features; for instance, abstract classes, traits, parametric methods, subclasses, etc.
  • Lecture 05: Programming with ADTs. In this lecture the students learn the basic concepts of ADTs and how they can be used as the basis for the modular development of very general computer programs.
  • Lecture 06: Specifying ADTs. In this lecture the students learn how to specify ADTs using a pre/post-conditions notation.
  • Lecture 07: Implementing ADTs. In this lecture the students learn how to go from an ADT specification to an actual program.
  • Lecture 08: Rules for ADTs. In this lecture the students learn how to systematically produce a simple concrete data structure from a given ADT specification and how to relate the two in a formal way.
  • Lecture 09: Basic OOP features. In this lecture the students are introduced to the basic concepts behind OOP. They also learn about the main differences between OOP and other paradigms and see some examples.
  • Lecture 10: Object identity and encapsulation. In this lecture the students discuss in more detail two basic OOP features, namely object identity and encapsulation, along with various examples of their implementations in Scala. 2
  • Lecture 11: Subclasses and inheritance. In this lecture the students study in more detail another fundamental concept of OOP briefly discussed before. They also learn how to it can be implemented using Scala.
  • Lecture 12: Abstraction and polymorphism. In this lecture the students investigate different ways in which polymorphism and related abstraction techniques can be realised and how they can be implemented using Scala.  
  • Lecture 13: Design patterns in OOP. In this lecture the main concepts, importance, and usage of design patterns for the construction of good software designs is discussed, in particular within the OOP framework.
  • Lecture 14: Creational design patterns. In this lecture the students learn about particular kinds of creational design patterns, such as factory, singleton, etc., along with examples of their use and Scala implementation.
  • Lecture 15: Structural design patterns. In this lecture the students learn about particular kinds of structural design patterns, such as adapter, decorator, etc., along with examples of their use and Scala implementation.
  • Lecture 16: Behavioural design patterns. In this lecture the students learn about particular kinds of behavioural design patterns, such as observer, command, etc., along with examples of their use and Scala implementation.

Reading list

References: We will not follow a single book in this course. However, there are a few references that can be used as a general guideline for each week/topic of the course.

  1. Programming in Scala. Martin Odersky, Lex Spoon, Bill Venners. Artima. A standard guide for Scala programmers (Week 1).
  2. Abstract Data Types: Speci_cations, Implementations, and Applications. Nell Dale and Henry M. Walker. Jones & Bartlett Learning. A good reference on abstract data types with concrete implementations (Week 2).
  3. An Introduction to Object-Oriented Programming. Timothy Budd. Addison-Wesley. This book aims to present the principles of OOP in a language-independent way (Week 3).
  4. Design Patterns: Elements of Reusable Object-Oriented Software. Erich Gamma, Richard Helm, Ralph Johnson and John Vlissides. Addison-Wesley. A comprehensive reference on design patterns for Object-Oriented software design (Week 4)