Class Meetings | Mon + Wed 2:00-3:15pm in CIWW 102 |
First Lecture | Jan 23, 2017 |
Last Lecture | May 8, 2017 |
Midterm Project Presentations | March 29, 2017, 2-3:15pm in CIWW 102 |
Final Exam | May 8, 2017, 2-3:15pm in CIWW 102 |
Final Project Presentations | May 15, 2017, 2-3:50pm in CIWW 102 |
Instructor | Thomas Wies |
Office | 60FA 403 |
Office Hours | Wed 3:15-4:30pm, or by appointment |
Teaching Assistants | Xi Huang,
office hour: Thu 5:10-6:10pm in 60FA 406. Sanketh Purwar, office hour: Mon 11am-12pm in CIWW 412 |
Object-oriented (OO) programming has emerged as a significant software development methodology. The goal of this course is to learn how to build and evolve large-scale programs using object-oriented programming. To this end, the course introduces the important concepts of object-oriented languages and design, and explores how these concepts are implemented.
Prerequisites: Computer Systems Organization (CSCI-UA 201).
Acknowledgments: This course is based on the Object-Oriented Programming course designed by Robert Grimm.
In exploring object-oriented programming, we investigate three questions:
Design and primitives matter because they represent the essence of object-oriented programming. Implementation matters because it enables us to debug object-oriented programs and tune their performance.
The focus of our exploration of object-oriented programming is a translator from Java to C++. You design, implement, and evaluate your own translator as a term-long project, working in teams of four to five students. In fact, you build two versions of your translator, taking half a term for each version and presenting your work in class on completion of each version. To make the project manageable, your translator only translates a restricted subset of Java into an even more restricted subset of C++; though the second version covers more functionality than the first version. I also provide you with “helper” code, notably for parsing and pretty printing program source files.
Each group elects a speaker, who coordinates with the members of the group and with me. A new speaker is elected at the middle of the term.
Your group’s midterm and final project presentations address three main issues:
You have a 9 minute slot for your presentation, which includes a demo of your translator and time to set up your laptop.
We will use Piazza for course-related discussions and announcements. I encourage you to ask questions when you are struggling to understand a concept - you can even do so anonymously.
Group project (50%), individual assignments (25%), final exam (25%).
Late submissions of homework solutions will be graded with a 10% penalty per day of late submission. Solutions will not be graded if they are submitted later than one week after the specified deadline.
Please review the departmental academic integrity policy. In this course, you may discuss assignments with other students, but the work you turn in must be your own. Do not copy another student's work. You must do the projects as a group but not with other groups and without consulting previous years' students, code, etc. You should help other students and groups on specific technical issues but you must acknowledge such interactions. Copying code or other work without giving appropriate acknowledgment is a serious offense with consequences ranging from no credit to potential expulsion.
This course relies on three different programming languages:
In more detail, the source language is
Java without nested classes, anonymous classes,
interfaces, enums, annotations, generics, the enhanced for
loop, varargs, and automatic boxing and
unboxing. Furthermore, the source language omits support
for synchronization, i.e., synchronized methods and
statements, and strict arithmetic operations, i.e. the
strictfp
modifier. It also omits support for transient
and
volatile
fields as well as native
methods. Finally, you
may omit method overloading but not method overriding for
the first version of the translator.
The target language is
C++ without virtual methods, inheritance, and, in
general, templates. It also omits features new to C++11,
notably lambda abstractions and type inference,
e.g., auto
and decltype
. It
does, however, include gcc's statement expressions,
i.e., ({ … })
. When compared to C, the target
language does include support for basic classes,
exceptions, and name spaces. For the first version of the
translator, you can ignore memory management and assume an
infinite main memory. For the second version of the
translator, you need to automatically reclaim unused
memory through a so-called smart pointer. The smart
pointer library, as well as any library support for
implementing Java arrays, may use templates.
Most Java statements and expressions translate directly into the corresponding C++ statements and expressions (modulo minor language differences). As a result, the main challenges for the course project are figuring out (1) how to translate Java class hierarchies into C++ without inheritance and (2) how to implement Java’s virtual method dispatch in C++ without virtual method dispatch, (3) how to select the right overloaded method, and (4) how to automatically manage memory without an existing garbage collector. Note that we will explore how to approach each challenge in class; we will also leave the latter two challenges for the second version of the translator.
Besides the programming language itself, any version of
Java includes a rather extensive set of platform
libraries, with the facilities in
the java.lang
package being tightly
integrated with Java’s execution model. For our
translator, we only support
the hashCode()
, equals()
,
and toString()
methods in java.lang.Object
and the printing of numbers and strings through
out.print()
and out.println()
in
java.lang.System
. Furthermore, we do not support the
dynamic loading of Java classes, but rather translate all
Java classes of the source program into one C++ program.
Please note that the translator need not perform any correctness checks on source programs; in other words, you can assume that source programs are free of compile-time errors. At the same time, when writing your own Java test programs, it seems prudent to test them with a regular Java compiler.
Class | Date | Topics | Materials | Assignments |
---|---|---|---|---|
1 | 01/23 |
|
||
2 | 01/25 |
|
|
|
3 | 01/30 |
|
|
|
4 | 02/01 |
|
|
|
5 | 02/06 |
|
|
|
6 | 02/08 |
|
|
|
7 | 02/13 |
|
|
|
8 | 02/15 |
|
|
|
02/20 | No class (Presidents' Day) |
|
||
9 | 02/22 |
|
||
10 | 02/27 |
|
|
|
11 | 03/01 |
|
|
|
12 | 03/06 |
|
|
|
13 | 03/08 |
|
|
|
03/13 | No class (Spring Break) | |||
03/15 | No class (Spring Break) | |||
14 | 03/20 |
|
|
|
15 | 03/22 |
|
||
16 | 03/27 |
|
|
|
17 | 03/29 |
|
|
|
18 | 04/03 |
|
||
19 | 04/05 |
|
|
|
20 | 04/10 |
|
|
|
21 | 04/12 |
|
|
|
22 | 04/17 |
|
||
23 | 04/19 |
|
||
24 | 04/24 |
|
|
|
25 | 04/26 |
|
|
|
26 | 05/01 |
|
|
|
27 | 05/03 |
|
|
|
28 | 05/08 |
|
|
|
29 | 05/15 |
|
|
|