Hoppa till huvudinnehållet
Institutionen för informationsteknologi

Information from the teaching assistants

Assistants on this course are John Håkansson and Pavel Krcal.

Common mistakes

Here is a brief list of common mistakes made for the first hand-in:

  • Missing development log
  • Missing dependencies between modules in external documentation; There should be a description of usage-dependencies between ADTs.
  • Pre- and postconditions should be included both in external and in internal documentation.
  • Error handling: do not print anything, do not exit, just return an error code. It should be up to the application code to present error messages to the user, and to take appropriate action.
  • Program errors (bugs) should be detected and handled by using assert. This will help catch illegal data early, that otherwise could cause some other part of the program to crash. Use assert for example to check the domain of input arguments.
  • Bitmap, color, and vector should be stack allocated. They are small, and especially for colors and vectors there would otherwise be a memory management nightmare. Since the bitmap contains some color matrix, you still need some method to free the associated memory.
  • Long functions: a function should not be longer than what can be printed on one page. Too long functions can be divided into several smaller functions.
  • Incorrect input should not crash your program. An incorrect file can end prematurely, or contain a word with more than 70 characters.

Dictionary

The explanations of these terms are shortened versions of the definitions found in either wikipedia or FOLDOC.

Precondition

A precondition is a fact that must always be true just prior to the execution of a function.
(From wikipedia)

Postcondition

A postcondition is a fact that must always be true just after the execution of a function.
(From wikipedia)

Side-effect

A side-effect is a property of a function that it modifies some state other than its return value. For example, a function might modify a global or "static" variable, modify one of its arguments, write data to a display or file, or read some data from other side-effecting functions.
(From wikipedia)

Uppdaterad  2004-03-03 09:22:16 av John Håkansson.