Skip to main content
Department of Information Technology

Methods of Programming DV2 Spring 2009


Here you will find recent updates about the course. Make a habit of reading this page on a regular basis. The teaching assistant has his own information page.

  • (2008-05-07) The lecures scheduled for May 8 and 14 were spare lecture times and have been cancelled.
  • (2008-05-07) Slides from the Profiling and Optimisation lecture (lecture 12) updated with output from the current software versions.
  • (2008-03-05) Slides and notes from Jesper Wilhelmsson's guest lecture are available. See the links section of this page.
  • (2008-02-19) I promised to write up the explanation of the intersection computation for planes. Here it is.
  • (2008-02-19) There will be a guest lecture om March 3, at 10-12, in 1245. Jesper Wilhelmsson from Oracle will talk about testing and testable code.
  • (2008-02-17) There is a new version of the project specification including pictures. (Due to some TeX problem pictures were not included in the previous pdf file.)
  • (2008-02-17) The article collection is now available at UTHgård.
  • (2008-02-03) The Absolute Final Correction Deadline will be June 17.

Course start

The first event is a lecture on Tuesday January 20th at 13:15 in room 1211.

This lecture is mandatory since the students will be registered and various administrative information will be given. Those that cannot be present must contact the lecturer.

Course Goals

The goal of the course is to bring deepened knowledge and skills in methods of programming, by conducting a larger programming project with strict demands on quality in code and documentation.

See also the formal course plan.

Course literature

The main literature is a collection of articles printed by the department, which can soon be purchased for SEK 25 (preliminary price) in the student shop at UTHgård (building 73 on this map).

There is also a recommended book, "The Pragmatic Programmer: From Journeyman to Master" by Andrew Hunt and David Thomas, Addison-Wesley, ISBN 0-20161622-X.


The course is given in conjunction with the Software Engineering course and the two course will have some shared lectures. An overview of the schedule of both courses is here. For details, refer to the official schedule.

Students taking Software Engineering will create requirement specifications that will be used for assignments 2 and 3 in this course. The Software Engineering students will also be responsible for quality assurance (planning tests and code inspection) for those assignments.

In the 3rd period the course will be at a low pace (10% work effort). During the 4th period the pace will increase (30% work effort).


The bulk of the course is a project which is divided into five parts (assignments), which can be found here here. For carrying out the project, a number of coding and documentation rules apply.

Some of the information needed to complete the assignments (for instance information about the XML parser) are not in the project specification but on this page.

The project should be done in groups of exactly 3 people. These groups should be registered with the teaching assistant at the start of the course. You should provide a catchy name for the group as well as name and email of all members of the group. If you have no one to work with, contact the teaching assistant and you will be assigned to a group. If the number of students taking the course is not a multiple of three or in exceptional circumstances, a group may have 2 or 4 members after approval by the instructor (Lars-Henrik). There is a list of the groups here.

Solutions to assignments can have a "passed" grade without being 100% correct. Minor errors will not require immediate correction but must be fixed by the next assignment hand-in. You should therefore get your graded assignments as soon as possible, even if they got a "passed" grade. If any errors noted by the teaching assistant have not been corrected by the next assignment deadline, the project will be failed.

Assignments should be handed in on paper, with documentation and source code (see the project specification for details). When handing in the assignment your group should also provide a "tar file" containing the source code for your code. It is recommended that you list the complete name and directory of the tar file at the beginning of the assignment document you handed in, so the teaching assistant can find the file. When the tar file is unpacked it should create a directory with the same name as the group. Executing make in this directory should build the tracer program (not required for assigment 1).

Note that for assignments 2 and 3, the Software Engineering students will create a requirements specification which you should follow while programming your solution. This means that error messages and functionality should follow the specification, after it has been approved by the Software Engineering teaching assistant. Also, for these assignments, the Software Engineering students will do testing. Note that this is testing for quality assurance purposes, not development purposes. You should of course test and debug your program yourselves and not hand it over to the Software Engineering students until you are satisfied that it works properly.


  • Assignment 1: February 16 at 08:00
  • Assignment 2 (test): March 30 at 08:00
  • Assignment 2: April 6 at 08:00
  • Assignment 3 (test): May 4 at 08:00
  • Assignment 3: May 11 at 08:00
  • Assignment 4: June 3 at 08:00
  • Assignment 5: June 3 at 08:00
  • Absolute Final Correction Deadline: June 17 at 08:00

In all cases the assignments are to be handed in to the teaching assistant. If there is a "test" deadline, it indicate that the assignment is to be handed over for the purpose of testing by the Software Engineering students. In that case the proper deadline is a week later, so that you have the chance to correct problems found in testing. If the teaching assistant requests corrections, they must be done when the next assignment is handed in. Corrections to assignments 4 and 5 must be handed in before the Absolute Final Correction Deadline. Assignments not handed in by this final deadline will not be graded.

Test files

Ray tracing test files in XML format can be found on the Unix systems in the /it/kurs/pm2/vt09/xml directory.

Larger test files in the ppm format can be found on the Unix systems in the /it/kurs/pm2/vt09/ppm directory. To view the contents of a ppm file you can use the xview program. Smaller test files can be found on the last page of the project specification, or be constructed manually.


Read an XML presentation in Swedish (slides) or a short introduction to XML in English. There is also a lot of information on the web. For instance, you can do a Google search for XML tutorial.

Example files for the ray tracer in XML format can be found in the /it/kurs/pm2/vt09/xml directory. The DTD for the ray tracer files is here (URI, /it/kurs/pm2/public_html/VT09/pm2gl.dtd in the Unix file system).

This couse will be using the libxml2 XML parser to read XML files following the DOM (document object model). There is an introduction to libxml2, also in pdf format. libxml2 is installed on the department's Unix systems. When compiling and linking a program using libxml2, you need to give gcc the -I /it/sw/www/include/libxml2 -L /it/sw/www/lib -l xml2 options. In the /it/kurs/pm2/vt09/xmltest directory there is a program xmltest.c which is based on a program in the XML introductions above. It parses and validates an XML file, and prints the file's element names with indentation corresponding to the structure of the file.

To view or edit XML files the xmlpro XML editor can be used. The executable can be found as /it/kurs/pm2/vt09/xmlpro on the Unix systems. Documentation is available in pdf format. Before running xmlpro you must copy its license file /it/kurs/pm2/vt09/xmlpro2.01/xmlpro.prp to your working directory.

Examination and grading

The examination consists of an assessment of your project, a two day take-home exam, and a voluntary traditional exam. On the home exam there will be questions regarding your specific solution to the assignments (for instance, "briefly describe how you would change your code to add the following functionality..."). For a passing grade you must pass both the project and the take-home exam.

Both the exams and the project will be graded using the U345 scale. If you desire higher grade than the basic pass grade ("3"), you have two options: If you don't take (or don't pass) the voluntary traditional exam, you can at most get a "4" grade and this requires at least a "4" grade on both the project and the take-home exam. If you do take and pass the voluntary exam, your grade will be the average of the grades from the three examination parts (project, take-home exam, traditional exam). If the average calculation requires rounding, the rounding may be affected by an overall evaluation. E.g. a 3/5/5 examination would normally result in a "4" grade on the course, but could give a "5" grade if the three grades were all strong. Similarly, a 4/5/5 examination would normally result in a "5" grade on the course, but could give a "4" grade if the three grades were all weak. International students will of course also get an ECTS grade for the entire course (not for the parts).

The take-home exam will be on May 25 and May 26. You do not have to register to take this exam. The exam will be handed out in office 1342 between 08:30 and 09:00 on May 25. You can also have the exam sent by e-mail shortly after 09:00, if you have emailed the examiner and requested this in advance. All aids are permitted for answering the take-home exam, except for asking other people. To this end, every member of each group will get a different version of the exam.

The take-home exam should be handed in (on paper!) to Lars-Henrik's mailbox (outside the department's coffee room in house 1 on the fourth floor) by 16:00 on May 26.

If you come to pick up the exam yourself, you must show a valid student registration card (kårleg). If you get the exam by e-mail, you must visit the examiner (Lars-Henrik) and show a valid student registration card before the results will be registered. If you fail the take-home exam or choose not to take it, a re-exam can be arranged in the August re-exam period. Contact the examiner if you want a re-exam opportunity.

The voluntary traditional exam is on June 4th (time and place to be determined). You must register for this exam in the usual manner. Since a passed grade cannot be raised afterwards, there will be no re-exam for the voluntary exam.

Some old exams: Take-home exam 980814 (in Swedish), Voluntary exam 971024 (in Swedish), English translations of the exam questions.



Using another group's solution for an assignment when doing your own solution, or even handing in a superficially altered copy of someone else's code, is considered cheating. This also applies if different groups collaborate to solve their assignments. Cheating that is detected will result in disciplinary actions and possible suspension from all teaching and examination at the university for a specified time.

It is of course allowed (indeed encouraged) to discuss methods and solutions between groups, but the actual code and documentation you hand in must be your own and not based on someone else's. If you think that such discussions may lead to two groups handing in "too similar" solutions, then inform the teaching assistant in advance to avoid problems. We may give you additional assignments if we think you have collaborated too much.

Updated  2009-05-07 14:14:45 by Lars-Henrik Eriksson.