COMP 304B Object-Oriented Software Design -- Assignment 1
COMP 304B Object-Oriented Software Design - Assignment 1
Practical information
- Due date: Saturday 31 January 2009, before 23:55.
- The TA for this assignment is Amr Al Mallah. Ask your questions on WebCT or
make an appointment to meet with Amr.
- Team size == 2 (pair programming) !
- Each team submits only one full solution.
Use the index.html template provided on the
assignments page. Use exactly this
format to specify names and IDs of the team members.
The other team member must submit a single
index.html file containing only the coordinates of
both team members. This will allow us to put in grades for
both team members in WebCT. Beware: after the submission deadline
there is no way of adding the other team member's
index.html file!
- Your submission on WebCT must be in the form of a simple HTML
file (index.html) with explicit references to
all submitted files as well as inline inclusion of
images. See the general assignments page for an
index.html template.
- The submission medium is
WebCT.
- To get feedback about the assignment workload, provide the number of
hours you spent on this assignment.
Goals
This assignment will make you familiar with unit testing,
and with object-oriented programming in Python. It will also
introduce you to relational databases. You will convert an Object-Oriented
design into its relational counterpart for storage/retrieval in/from a database.
Upload all source and result files to WebCT and provide
links to all of them from your index.html file.
Assignment
Your solution will be based on prototype3.spreadsheetCells
found in the following archive.
This prototype comprises three modules:
- basicUtility which provides global methods and constant values
needed by several modules. (e.g., error handling, math functions). You will use
this module as is.
- columnNameConversionUtility which provides conversion of column names
to integers and vice-versa. You will implement the conversion routines
def columnNameToColumnNumber(self, columnName):
"""
Transform strings used as cell column names (e.g., "A" in the cell reference "A5")
to integers (for efficiency reasons).
Requirements:
- "A" is converted to 0
- "Z" is converted to 25
- "AA" follows "Z" and is converted to 26, and so on
- only strings in the range "A" to "ZZZZ" are accepted
- column names should be upper case
- in case of an improper columnName input, the
invalidColumnName exception should be raised
"""
def columnNumberToColumnName(self, columnNumber):
"""
Requirements:
- inverse of columnNameToColumnNumber
- only integer numbers in the range
0 .. columnNameToColumnNumber("ZZZZ") are allowed as input
- output must be upper case strings
in case of an improper columnNumber input, the
invalidColumnNumber exception should be raised
"""
as well as the appropriate tests (for success, failure, and sanity) corresponding
to the above requirements.
- spreadsheetCells which implements the efficient representation
of spreadsheet shells. It consists of the following classes:
- CellData:
Instances of this class are stored in the spreadsheet's cells and contain data
(currently only integer numbers, later also formulas , etc. )
- CellCoordinate:
The spreadsheet uses instances of this class to index the cells.
- SpreadsheetData: The basic spreadsheet data structure.
You will use the solution
of the 2002 unittesting assignment,
adapt it and integrate it in this prototype in the spreadsheetCells
directory. This includes constructing the test/teststuite.py.
You will retain only the dictionary variant from 2002 (not the list-based one).
You will add to the 2002 solution (to SpreadsheetData), the following
implementation as well as tests:
- methods for adding/removing rows/columns.
These methods have the following signatures:
def addRow(self, rowNumber):
def addColumn(self, columnNumber):
def removeRow(self, rowNumber):
def removeColumn(self, columnNumber):
Requirements:
- When adding a row, data is shifted down appropriately.
- When adding a row, the new row is empty.
- When removing a row, data in that row is lost and other rows are shifted up
appropriately.
- When adding a column, data is shifted right appropriately.
- When adding a column, the new column is empty.
- When removing a row, data in that row is lost and other rows are shifted up
appropriately.
- when an improper row/column index is given, an invalidRowNumber/invalidColumnNumber
exception is raised.
- serialization to/from a relational database.
You will add the following methods to SpreadsheetData:
def toRelationalDatabase(self, filename):
def fromRelationalDatabase(self, filename):
These methods will implement external storage and retrieval of
the entire spreadsheet. You need to implement as well as test these methods.
Write down reasonable requirements for these methods from which you
will construct the tests.
Before you can implement the methods, you need to design
the relational database's tables based on the design of the
SpreadsheetData structure. Once you have this design,
appropriate queries can be used to implement the above storage
and retrieval methods.
A suite of tests for all the above is executed using the script test.sh.
Note that this script is most easily run on some UNIX variant. You are free to
translate this to Python to make it more portable (to Windows variants for example).
Grading Scheme
Column Conversion
- T1: NameToNumber Implementation and test 10%
- T2: NumberToName Implementation and test 10%
- T3: Conversion Sanity Tests 5%
Column Manipulation (50% or 10% each)
- T4: addRow Implementation and test
- T5: removeRow Implementation and test
- T6: addCol Implementation and test
- T7: removeCol Implementation and test
- T8: Manipulation sanity test
Serialization
- T9: stating reasonable requirements 5%
- T10: fromRelational Implementation and test 5%
- T11: toRelational Implementation and test 5%
- T12: Serliazation Sanity Tests 10%
References
Hans Vangheluwe Winter Term 2009.