|
CSE307 Spring 2007 Stony Brook |
Principles of Programming Languages
Annie Liu Assignment 5 |
Handout A5 Mar. 29, 2007 Due Apr. 17 |
Object Abstraction --- Organizing Everything
This assignment has two goals: (1) organizing everything we have programmed, and (2) practicing programming with object abstraction.
We have written programs for reading tables, checking syntax against separate declarations, inferring information about data in the table, analyzing static semantics based on a state machine semantics, and implementing a hierarchical state machine semantics. We have used high-level data types, such as lists and dictionaries, and control abstraction, such as iterators, comprehension, and recursion, but we have not defined classes and created object abstraction; we will do this now.
Programming with object abstraction
At least two kinds of uses of object abstraction are possible in what we have programmed.
The most important question, though, is: why would we do these? We should not use objects only for the sake of using objects. Our goal is to make our program better, i.e., clearer and more modular so that it is easier to understand, use, and extend. We would use objects only when they help us achieve our goal. So, would the two kinds of uses of objects help? Would other kinds of uses help? We would not easily know unless we try them out.
Your main task for this assignment is to (1) organize everything you have programmed so that one can easily use all the functionalities, as described below, and that your program is better, i.e., clearer and more modular as you can possibly do in the given time frame, and (2) try the two kinds of uses of objects suggested above, and any other use of objects that you think is better, and compare the result with the best you can improve your program without using objects---which one, or which parts or aspects of which one, you think is clearer or more modular, why, and how much effort it took to achieve that? In particular, when you make your program clearer and more modular, with or without using objects, you should describe what were the problems before, how you improved it, and how much effort it took you to achieve that.
Organizing everything
It is almost never trivial to put everything together, even if you had designed every piece with integration in mind, let alone if you have the goal of making your program clearer and more modular. So, you are asked to document your effort when doing this assignment. Among the many possible things to make your program better, let me emphasize a most important one: don't duplicate code---remember the story I told in class today.
When run, your program should take (1) an input data file name, (2) a few possible kinds of optional arguments, and (3) an output data file name. The optional arguments are one or more of the following forms:
-sort column_name
-check input_declaration_file_name
-infer output_declaration_file_name
-analyze
-implement input_lable_sequence_file_name output_state_sequence_file_name
Extra credit suggestions
Here are some ideas. (1) Organize also the extra credit work you did for the previous assignments, trying the uses of objects, and adding additional optional arguments. (2) Think of other interesting and/or useful things to check and/or to do, and do them; feel free to discuss with me.
Handins
Hand in everything electronically, using Blackboard, by 5pm on the due date. Your handin should include your README file, code, test data, and anything else you have to show your work.
Grading
This assignment will be graded based on 100 points, allocated in proportion to the estimated amount of work for each part. You may do this assignment in a team of two people; the two people will receive the same points. Exceptionally well thought-out and well written work will receive appropriate extra credit. Extra credit work will be graded based on the estimated amount of extra work.
Note that the README file for this assignment will be given 40% of the points, instead of the usual 30%, because of the required documentation of effort and comparisons.