Homework 1 Notes

The following is a set of notes, written by Tao and lightly edited by David, that describe a set of problems and issues that arose during grading of the first homework.  They are not complete descriptions of how grading was done, but they (among other things) point out a few common problems.

Reminder: if you have questions about the grading on your assignment, first get in touch with Tao for clarification; if you still feel there are issues to be resolved, then get in touch with David.

  1. Program correctness (40 points, 10 points each)

 

2)      Z (40 points total)

       a.

o      If you explain the reason as ※not making an assignment§, not mentioning ※not limiting other elements in the birthday set§, you will lose 5 points for that. In fact, ※not making an assignment§ is not the problem. Please notice the postcondition has no responsibility to make assignments for any new entities appearing in postcondition. For example, {true}##{x>0}.

o      What postcondition doesn*t specify is ※unknown§, NOT ※false§! For example, new postcondition ※{name? date?} Î birthday'§ only specify the fact ※it should include the new name/date pair§, not ※it ONLY include the new name/date pair§.  Indeed, in some proof system (such as some in AI), what is not specified in the system could be considered as FALSE, however, here you are not allowed to assume so.

       b.

o      You could answer this question using two approaches. One is to decompose DATE atomic element into YEAR, MONTH, DAY atomic elements. The other is to map the DATE atomic element to certain sequence number. Either way will allow for operations, such as distinguishing earlier and later dates, determining the difference between two dates, and any other operations you wish in this general style. 

       c.

o      In v) and vi), some students misunderstand the ※robust§ version. ※Robust§ version is not a version which implements more functionalities, but a version could handle those inputs which include mistakes, please see Z document 1.3 page 7.

o      You are not expected to modify the original specs to make it robust, please refer to Z document 1.3 page 7, ※modifying it to describe the handling of incorrect input could only make it obscure§.

o      Some students only list those additional operations to handle the error input, but don*t specify the specification for the robust version of operation, which combines the original operation and error handling operations.

 

3. Finite state specifications (40 points)

       You are expected to capture satisfactorily enough details of the system. A few students just describe the system too simply. To assume you present your statechart to implementers, they will feel rather confused on ※how to do§, because you don*t give them enough ※what to do§ information.

       ※Use Parallel States (AND decomposition)!!§, in fact, in this system, many states transition could be performed in parallel. It is hard to describe this feature without using parallel states David introduced in class.

       It is recommended to use the hierarchical structure to control the complexity, but not strictly required. If your statechart contains too many states, maybe you could consider to compress some closely related states into one high-level state and draw another statechart which contains those states it is decomposed to. If you use this technique, be cautious to make the consistence between high level state and low level corresponding statechart. I mean, they are supposed to have the same ※arrow-in§ and ※arrow-out§.

       Each top level parallel state should have start point. A few students* statecharts don*t have a start state, and this is a problem.

       A few students confused states and transitions (event). You should be careful about this. For example, in the spec, a few students specify ※Play Now§ as a state, in fact, it is a transition or event. Indeed, you could enter ※Playing game§ state after you click the ※Play Now§ button (※Play Now§ transition or event). It is preferable to distinguish the state and transition by giving state some noun phrases and transition some verb phrase.

       A few students draw their statecharts just like flow chart. They include condition diamond in their statecharts. Actually you could decompose the conditional transition into several individual transitions by specifying their conditions in their names. There are still some differences between flow chart and statechart. Maybe students could discuss this in our course mail list?

       When to decompose one state to several states and when not ( I just come out with following two principles, you may come out more):
Internal transition requirement: Just considering the checkbox option, assume when it is check on, you are only allowed to check off, vice versa, then you will have to draw two states for check on state and check off state separately to limit the transitions between them.
External transition requirement: Considering the checkbox option, if other states* transitions depend on which state the system is between check on and check off, for instance, in the cassette tape recorder example David gave in class, you need to decompose the check on/off to two different states.

FYI: In David*s cassette tape recorder example, maybe you would notice the volume control only have one state, different from other option buttons. I guess there are two possible reasons, one is that volume is not easy to quantified. Most importantly the other reason is other state transitions don*t depend on the volume states (how high the volume is). As you may know, some SONY tape recorders have a volume protection option button, if you turn it on, even when you turn the volume up to maximum, the volume sound is still not very high in order to protect your ear from harm. For this type of tape recorder, you may decompose the volume state to several states. You could try it!

       When there are some interactions between different parallel states, for example, in David*s cassette tape recorder example, many state transitions use the option states. In these cases, you may use some internal events to coordinate these parallel states.

       ※Don*t let your system get stuck in a &dead state* in your statechart!!§, in some cases, a few students just use one transition to enter certain state which has no transition to other states. These ※dead states§ are not supposed to be quite common in statechart. So after you finish your statechart to check whether your statechart has dead state and whether your system really should be stuck there or it is your mistake.

       You*d better mark the notations, I mean, names for each transition and state if possible.
 

4)     Miscellaneous (30 points total, 10 points each)
a.

       You are required to pick up those properties your spec has. You are not supposed to specify the properties which could not be checked with model checking using YOUR checker specification.

       Be careful that model checker is not ※magic§, it could only check some properties based on your specs. It only knows the knowledge presented in spec you wrote. So you are supposed to give some concrete properties specific for your spec.