Computer Science
Department
CS 216 - Spring 2014

Welcome to the home page for CS 216, 2014 Spring semester.

Final reviewMay 2nd

The final review is posted.
GenericFactoryApril 24th

GenericFactory.h — Example code from lecture.
Programming Assignment 4April 21st

Programming Assignment 4 is posted. Note that PA4 is completely optional, and the deadline on it is rather flexible.
Practicum 12April 21st

Practicum 12 is posted.
Practicum 11April 16th

Practicum 11 is posted.
Practicum 10April 9th

Practicum 10 is posted. Incidentally, if the assignment post to the class web site is delayed, you can always find the practium on the source control web interface...
PA3 infoApril 8th

Programming Assignment 3 will be due on April 26th at midnight. No, the due date on Saturday is not a mistake, dead week starts that Sunday...

What was supposed to be PA4 -- integrating curses (which we'll see in the practica sessions the next two weeks) -- will instead be extra credit for PA3.
Lecture notes updatedApril 7th

Lecture notes are updated and posted, and now conveniently located in the panel to the left...
Practicum 9April 1st

Practicum 9 is posted.

Lecture notes and example source coming tomorrow...
Practicum 8March 26th

Practicum 8 is posted.
Programming Assignment 3March 14th

Programming Assignment 3 is posted.
Practicum 7March 11th

Practicum 7 is posted.

Programming Assignment 3 should be posted soon...
Lecture slidesMarch 5th

Lecture 7 — Programming Assignment 1 Post-mortem
Lecture 8 — Singleton and development models
Midterm reviewMarch 4th

The midterm review is posted.

Due to travel later this week, I will be unable to have office hours on Thursday; if you need to speak with me, please attend practicum on Wednesday, as the practicum sessions will, in general, end a little earlier than normal.
Programming Assignment 2February 28th

Programming Assignment 2 is posted.
Practicum 6February 25th

Practicum 6 is posted. Due to it including more than a couple of reflection questions (which look awfully homework-like), it's due Friday night instead of Thursday night.

Expect Programming Assignment 2 to be posted tomorrow.
Testing for identical filesFebruary 24th

From the Linux command line, to compare two files, say, out.xml and out2.xml:

   diff -s out.xml out2.xml

This is part of the testing procedure for PA1.2 — running your program on the provided xml, then running your program on its output, and then comparing the first and second outputs of the program; both outputs of your program should, ideally, be identical. Note that your output does not have to exactly match world.xml (and, due to world.xml not including quantity, it should not).
Converting strings to intsFebruary 21st

Quick way to convert a string to an int:

Use the following header file:

   #include <cstdlib>

And then:

   atoi(sValue.c_str())

contains the value of the string as converted to an int. While this is the C way as opposed to the C++ way, well, the C++ way is, in my humble opinion, horribly verbose.
Lecture 6 slidesFebruary 21st

Lecture 6 — Toolchain and PA1.2 strategy
Extended office hours this weekFebruary 18th

In support of the programming assignment being due this week, I will have additional office hours:

Wednesday: 10-11:30, 2:30-4
Thursday: 10-11:30, 2:30-4 (well, the 2:30-4 is normal, but worth pointing out here...)
Friday: 2-3

Additionally, please put some time into PA1.2 before Friday's lecture — it will present an excellent opportunity for questions about the assignment...
Practicum 5February 18th

Practicum 5 is posted. Along with it, two example source files to use if needed:

XMLSerializable.h
XMLSerializable.cpp
C++ ClosuresFebruary 17th

Just a quick note on a new feature in C++11 that we can use (requiring both both #include <functional> and --std=c++0x), closures:

A closure is, in this case, an anonymous function declared in the middle of code, and for the simplest form, looks like this:

   []() { }

Which, unfortunately, just gives us a function which does nothing. The indicates a closure is being declared, the () tells it that this particular closure takes no arguments, and the { } is the function itself.

More usefully:

   []() { return new Item; }

is a closure which allocates and returns an Item object. Even more usefully, one can do:

   map<string, function<XMLSerializeable*()>> mapConstructors;
   mapConstructors["Item"] = []() { return new Item; };

Which might happen to be useful for PA1.2.
A strategy for PA1.2February 17th

Here's a suggested strategy for finishing up PA1.2:

So, you've been given code that parses an XML document. If you read through the code, you should notice the following things:

 — At the beginning of the function, the element name is known
 — There's a point in the function (before bDone is set) where you know both the element name and content of an element
 — The existing code has a variable that (somewhat) represents location within the hierarchy — sPrefix

So, with that...

You can store function pointers in a map; using C++ style function pointers (remember both #include <functional> and --std=c++0x!), the following represents a map that maps strings to function pointers that construct XMLSerializable-derived objects:

   map<string, function<XMLSerializeable*()>>

So, you populate such a map with pointers to functions that construct objects of a type, and then, once parseElement knows what the element name is, see if you recognize that element name as a class, and if so, call the function pointer found in the map...

The resulting XMLSerializable* you get can then replace sPrefix. And then, you can call its setElementData method at the point in parseElement mentoined above where it knows both the element name and content of the element...
Code from today's lectureFebruary 17th

xml.cpp — Basic XML parser

You are welcome to use provided code in your PA1.2.
XML file for class/PA1.2February 17th

Here is an example XML file, that can be used to test PA1.2 — we'll cover it in class today (and post the example code that reads it after class).
Lecture notes and codeFebruary 17th

Notes and code from Friday's lecture:

Lecture 5 — Scalars, objects, and constructors
cons.cpp — Constructor example
scalar.cpp — Scalar initialization (or lack thereof) example
Practicum 4February 11th

Practicum 4 is posted.
Example code from classFebruary 11th

Example code from class yesterday is posted; no lecture notes as there weren't any outside of the example program...

merge.cpp
Programming Assignment 1 Part 2February 10th

Programming Assignment 1 Part 2 is posted, and due the 22nd at midnight. Note that a due date of Sunday at midnight does not imply email support Sunday evening...

We'll be discussing import things for PA1P2 in class today (more function pointers) and Friday (a basic framework with provided code for XML deserialization).
Schedule this weekFebruary 10th

I will be out of town this Thursday, and as such be unable to be in my office for office hours; if you need to see me, please email me about an appointment.
Lecture notesFebruary 10th

Added the most recent lecture notes:

Lecture 4virtual, function pointers and XML
One-time submission amnestyFebruary 10th

For this one time only, all assignments turned in tomorrow night by midnight will be graded.

This is primarily to cover any sort of issues with source control; please check to make sure that what you have checked in for your assignments is what you expect to be checked in. A good way to do this is:

svn checkout svn://progit.netlab.uky.edu --username=yourusername sc_test_dir

This will check out everything from the server and show you exactly what your submissions to source control look like. Make sure what's there is what you expect to be there, and if it's not — fix it by adding and committing anything that's missing, and it will get graded.
Lecture SlidesFebruary 4th

Okies, here are the lecture slides from the lectures presented so far:

Lecture 1 — Introduction
Lecture 2 — Object-oriented review, part 1
Lecture 3 — Object-oriented review, part 2 (especially the virtual keyword)

Note that posted lecture slides are, emphatically, not a replacement for attending lectures.
Practicum 3February 4th

Practicum 3 is posted.

Please have at least one working .cpp/.h pair checked in to your source control account before practicum.
Practicum 2 example codeJanuary 29th

Almost forgot -- example code for practicum 2:

Item.h
Item.cpp
Programming Assignment 1 - Part 1January 28th



Well, here's the hierarchy we worked on in class, and the formal assignment: Programming Assignment 1 Part 1.

The assignment is a bit of a simplification of what we talked about in class -- a bare minimum of what we'll be working with. You're free to do as much more than what's required.

We will, of course, be talking about this a bit more in class.
Practicum 2January 28th

Practicum 2 is posted.
Homework 2January 27th

Homework 2 is posted.
Practicum 1January 21st

Practicum 1 is posted.
Homework 1January 17th

Okies -- Homework 1 is posted. Please spend a bit of time with the game, so we can have a better discussion of how we might implement something similar in class next Friday.
Getting Things StartedJanuary 10th

You should be getting an email from Paul Linton (if you haven't already) regarding your Multilab accounts if you don't already have one. If you don't have access to a Multilab account by Thursday (January 16th), please contact Paul.

You should also be getting an email with instructions about setting up your source control account -- used both for submitting assignments as well as checking your grade on or about Wednesday the 15th.

The practicum sessions will not be meeting on Wednesday, January 15th.