i219 Software Design Methodology 

Lecturer: OGATA, Kazuhiro (email: ogata at jaist dot ac dot jp)
Room: i1
Term: 2-2, FY2016

Contents:
News
Software tools used in the course
Lecture schedule
 (Lecture materials can be downloaded there.)
Assignments
Useful links


News

- Jan 18: Note that you should use try { ... } catch ( ... ) { ... } in Sender<E> and Receiver<E> in Lecture 10 (and Lecture 11 as well).
- Jan 11: All lecture notes & assignments were available.
- Jan 11: In Assignments, Exercise i  is about lectureNotefor each i  = 1, ..., 11.
- Jan 10: A typo of the description of Assignment 8 was corrected. Note that you are supposed to draw the whole diagram on that page (p.5) and write all interfaces and classes appearing in it. You can reuse some of them if you have already written but are supposed to submit all of them.
- Jan 06: Programs & diagrams for Assignment 11 were uploaded.
- Jan 05: Lecture notes 10 & 11 were uploaded. The assignment scores were corrected.
- Dec 21: Lecture notes 7, 8 & 9 were uploaded.
- Dec 20: Three more assignments 8-10 were added. The total score of assignments is 60. Note that assignments 8-12 were given different numbers 11-15.
- Dec 20: Note that each super.m2(new B(),new B()) of class SubB in lecture note 5 should be super.m2(x,y).
- Dec 06: Private attributes: please download A.java & B.java and cpmpile them with javac. 
- Dec 06: Please write import java.util.*; in each .java file to be made before writing the class.
- Dec 02: Note that lecture schedule in Jan has been changed because Feb 02, Thursday, will be treated as Monday as lecture schedule.
- Dec 01: This website was open. 
 Participants are strongly recommended to install software tools used in the course on their computers in advance.
 Participants are strongly recommended to learn lecture materials (lecture notes, programs, etc.) in advance, finding what they do not understand, actively attend each class to do their best to understand those things, and get better understanding of those things by learning those lecture materials again (and again) after each class!


Software tools used in the course

- Java: Version 1.8.0_111 is used in the course.
For Windows 64x, you can downlod jdk-8u111-windows-x64.exe and double click it to install the version of Java.
For other operating systems, please visit the webpage.

- Text editor: You can use any text editor of your preference, but I recoomed you to use Emacs.
I use Meadow, an obsolete version of Emacs on Windows.
If you are willing to use Meadow on Windows, you can downlod Meadow.zip (note that the size is larger than 500MB) and unzip it.
If you are a Mac or Unix (such as Linux) user, Emacs must have been installed on your computer.

- UMLet: Version 14.1.1 is used. You can downlod umlet-standalone-14.1.1.zip and unzip it to install the version of UMLet.
For more info, please visit the website.

- Java Path Finder (JPF): v8.0 (rev 31) is used in the course.
Please go to A way to install JPF on this pape to install the version of JPF.
For more info, please visit the website.

- Shell (or command prompt): I recommend you to use commands, such as javac and java, on a shell.
You can use any shell (or command prompt) of your preference.
If you use Emacs, you can launch and use a shell on Emacs.

Note: Please do not use any sophisticated software development platforms, such as Eclipse and NetBeans.



Lecture schedule

1.  Dec 06, 09:00-10:40: Outline  lectureNote1  diagrams1
    Overview of software design methodology
2.  Dec 06, 13:30-15:10: lectureNote2  programs2  diagrams2
    Basic concepts of object-oriented technology
3.  Dec 08, 10:50-12:30: lectureNote3  programs3  diagrams3
    Static modeling
4.  Dec 13, 09:00-10:40: lectureNote4  programs4  diagrams4
    Object-oriented programming language 1
5.  Dec 20, 13:30-15:10: lectureNote5  programs5  diagrams5
    Object-oriented programming language 2
6.  Dec 22, 10:50-12:30: lectureNote6  programs6  diagrams6
    Object-oriented programming language 3
7. Jan 05, 10:50-12:30: lectureNote7  programs7  diagrams7
    Information hiding and reuse
8.  Jan 10, 09:00-10:40: lectureNote8  programs8  diagrams8
    Dynamic modeling 1
9.  Jan 12, 10:50-12:30: lectureNote9  programs9  diagrams9
    Dynamic modeling 2
10. Jan 17, 09:00-10:40: lectureNote10
    Multithreaded programming
11. Jan 19, 10:50-12:30 Jan 17, 13:30-15:10: lectureNote11
    Software model checking
12. Jan 24, 09:00-10:40 Jan 19, 10:50-12:30: lectureNote12 programs12 diagrams12 
    Case Study 1
13. Jan 24, 10:50-12:30 Jan 24, 09:00-10:40: lectureNote13  programs13
    Case Study 2
14. Jan 31, 09:00-10:40 Jan 24, 13:30-15:10: lectureNote14
    Case Study 3
15. Feb 02, 10:50-12:30 Jan 31, 09:00-10:40:
    Examination Review 
16. Jan 31, 13:30-15:10:
    Examination



Assignments

For each assignment j (= 1, ..., 15),
- send what you are required to submit such as programs as email attachments to the lecturer by the designated deadline from your JAIST email account,
- write Assignment j of i219 in Subject of the email, and
- write your name and student identification number in the email in plain text.

Note that in each file submitted (.java, .jpf, .uxf, and .pdf files) you are supposed to write your name, your student identification number, and the time & date when the file was made. In .java & .jpf files you are supposed to write them as comments, in .uxf files you are supposed to write them in a note, and in .pdf files you are supposed to write them as usual. If you do not write them in each file submitted, your scores of assignments will be decreased.

1. Exercise 1 (score: 2)
Deadline of submission: Midnight of Dec 31, Saturday, 2016 (Strict)
2. Exercise 2 (score: 2)
Deadline of submission: Midnight of Dec 31, Saturday, 2016 (Strict)
3. Exercise 3 (score: 2)
Deadline of submission: Midnight of Dec 31, Saturday, 2016 (Strict)
4. Exercise 4 (score: 3)
Deadline of submission: Midnight of Dec 31, Saturday, 2016 (Strict)
5. Exercise 5 (score: 3)
Deadline of submission: Midnight of Dec 31, Saturday, 2016 (Strict)
6. Exercise 6 (score: 3)
Deadline of submission: Midnight of Dec 31, Saturday, 2016 (Strict)
7. Simple calculator (score: 5)
Deadline of submission: Midnight of Dec 31, Saturday, 2016 (Strict)
8. Exercise 7 (score: 2)
Deadline of submission: Midnight of Jan 23, Monday, 2017 (Strict)
9. Exercise 8 (score: 2)
Deadline of submission: Midnight of Jan 23, Monday, 2017 (Strict)
10. Exercise 9 (score: 2)
Deadline of submission: Midnight of Jan 23, Monday, 2017 (Strict)
11. Assignment calculator (score: 5)
Deadline of submission: Midnight of Jan 23, Monday, 2017 (Strict)
12. Exercise 10 (score: 3)
Deadline of submission: Midnight of Jan 23, Monday, 2017 (Strict)
13. Exercise 11 (score: 6)
Deadline of submission: Midnight of Jan 23, Monday, 2017 (Strict)
14. Dining philosopher problem (score: 10)
Deadline of submission: Midnight of Feb 06, Monday, 2017 (Strict)
15. Mini programming language processor (score: 10)
Deadline of submission: Midnight of Feb 06, Monday, 2017 (Strict)

Note that if the programs, diagrams, etc. submitted by different participants are surprisingly similar (which usually rarely happens), then the scores of those participants may be drastically decreased!


Useful links

- API specification for the JavaTM Platform, Standard Edition 7
- The JavaTM Tutorials
- OMG UML


A way to install JPF

- Windows 7
i. Let JPFDIR be a directory (or folder) on which JPF is installed. For example, C: may be used as JPFDIR. 

Let us just suppose that JPFDIR is C:. You may use another directory such as your home directory. PrintUserHome.java lets you know your home directory.

ii. Download .jpf.zip and unzip it to make the directory (folder) .jpf in which you can find the following file:
site.properties
Edit the file such that C:/Users/ogata/projects in the file is changed to C:/projects (namely, JPFDIR followed by /projects), and save the file. Note that you should use "/" instead of "\" in the file. Move the directory .jpf to C: (namely, JPFDIR). Now, there exists the directory .jpf on C: (namely, JPFDIR).

iii. Download projects.zip and unzip it to make the directory projects. Move the directory projects to C: (namely, JPFDIR). Now, there exist the directories .jpf & projects on C: (namely, JPFDIR).

iv. Add C:\projects\jpf-core\bin (namely, JPFDIR followed by \projects\jpf-core\bin) to Path (environment variable).

v. Add a new environment variable JAVA_HOME with C:\Program Files\Java\jdk1.8.0_111 as its value.
Note that C:\Program Files\Java\jdk1.8.0_111 is the directory in which jdk has been installed on your computer.

vii. Download UnsafeInc.java and UnsafeInc.jpf, and do the following to check if JPF has been successfully installed:
% javac UnsafeInc.java
% jpf UnsafeInc.jpf

- Other OSs such as Mac and Linux
.jpf.zip and projects.zip are independent from any specific machines, and then JPF may be installed likewise.


Assignment 1: Exercise 1

1. Draw the sequence diagram, the class diagram and the two object
diagrams with UMLet. Four .uxf files are made.

2. Write your explanation on those diagrams. You can consult lecture note 3.
The report will be used to judge how well you understand the programs. So, if no explanation is given, your score for this assignment will be zero. The report should be made as one .pdf file.

3. Make one zip file containing four .uxf files and one .pdf file, and then send it to the lecturer as an email attachment by the deadline.


Assignment 2: Exercise 2

1. CompleteMake the two classes BlueClass and BlueClassUndo. The two .java files are completedmade. You are supposed to compile with javac the two .java files together with the other given programs and conduct testing the two classes by launching with java the two files Test(.class) and TestUndo(.class).

2. Draw with UMLet the three class diagrams used in lecture note 2
such that the first one consists of class BlueClass and class
BlueClassUndo, the second one consists of interface ExpParseTree, class NumParseTree and class AddParseTree, and the third one consists of interface ParseTree, abstract class StmParseTree and class AddParseTree, and the third one consists of interface ParseTree, abstract class StmParseTree and interface ExpParseTree. Three .uxf files are made.

3. Write your explanation on those diagrams. You can consult lecture notes 3, 4, 5 & 6.
The report will be used to judge how well you understand the programs. So, if no explanation is given, your score for this assignment will be zero. The report should be made as one .pdf file.

4. Make one zip file containing two .java files, three .uxf files and one .pdf file, and then send it to the lecturer as an email attachment by the deadline.


Assignment 3: Exercise 3

1. Draw all diagrams used in lecture note 3. For each .png file given, you are supposed to make one .uxf file with UMLet.

2. Write your explanation on those diagrams.
The report will be used to judge how well you understand the programs. So, if no explanation is given, your score for this assignment will be zero. The report should be made as one .pdf file.

3. Make one zip file containing those .uxf files and one .pdf file, and then send it to the lecturer as an email attachment by the deadline.


Assignment 4: Exercise 4

1. Make the following one interface, two abstract classes, and six classes that are explained in the 4th lecture note:

Interfaces:

PointInterface

Abstract classes:

AbstractPoint
AbstractPointPolarCoordinates

Classes:

Point
RandomWalking
PointIn3D
PointPolarCoordinatesRadian
PointException
DistanceBetweenTwoPoints

Each of them is supposed to be written in one file whose name should obey the name convention. There are some occurrences of ... that are not explicitly explained, but since all class files are given and you can launch with java the class files whose names start with Test and whose name is DistanceBetweenTwoPoints, you can know what you should replace those occurrences of ... with. Nine .java files are made. You are supposed to compile with javac your programs together with the given programs and conduct testing the programs by launching with java the generated class files whose names start with Test and whose name is DistanceBetweenTwoPoints.

2. Write your explanation on those programs as a report.
The report will be used to judge how well you understand the programs. So, if no explanation is given, your score for this assignment will be zero. The report should be made as one .pdf file.

3. Make one zip file containing the nine .java files and one .pdf file, and then send it to the lecturer as an email attachment by the deadline.


Assignment 5: Exercise 5

1. Write a report in which you are supposed to explain in detail all examples of method dispatch used in lecture note 5. For messages have parameters, you are also supposed to explain how to decide the method signature of the method invoked. The report should be made as one .pdf file.

2. Send the .pdf file to the lecturer as an email attachment by the deadline.


Assignment 6: Exercise 6

1. Make the following .java files in which the interfaces and classes whose names are the same as those file names are supposed to be written:

BSLeaf.java
BSNlTree.java
BSTree.java
BinarySearchTree.java
GList.java
GNil.java
GNnList.java
Nat.java
NzNat.java
TBSLeaf.java
TBSNlTree.java
TBSTree.java
TentativeBinarySearchTree.java 
Zero.java

You are supposed to compile with javac your programs together with the given programs and conduct testing the programs by launching with java the generated class files whose names start with Test.

2. Write your explanation on those programs as a report.
The report will be used to judge how well you understand the programs. So, if no explanation is given, your score for this assignment will be zero. The report should be made as one .pdf file.

3. Make one zip file containing those .java files and one .pdf file, and then send it to the lecturer as an email attachment by the deadline.


Assignment 7: simple calculator

Programs provided

1. Write the four missing classes in Java.
Looking at the programs provided, you can four three classes missing. Each of the three classes should be written in one file whose name should obey the naming convention. You do not need to modify any programs provided at all!Four .java files are made.

2. Write a class diagram of the simple calculator with UMLet.
The class diagram should include all classes that explicitly appear in the source programs except for the classes System, Integer and String, and each class except for classes provided by the Java libraries should have all of its attributes and methods except for the method toString(). Among classes provided by the Java libraries are InputStreamReader and ArrayList (and each of its instantiation), and it suffices to write class names for them. Classes that do not explicitly appear in the source programs such as the class Object do not have to be included in the class diagram. You do not have to write constructors in classes and do not need to write all dependencies among classes. Dependencies can be elided if they are clear. One .uxf file is made.

3. Write your explanation on the programs and class diagram you have written as a report.
The report will be used to judge how well you understand the programs and class diagram you submit. So, if no explanation is given, your score for Assignment 1 will be zero. The report should be made as one .pdf file.

4. Make one zip file containing four .java files, one .uxf file and one .pdf file, and then send it to the lecturer as an email attachment by the deadline.


Assignment 8: Exercise 7

1. Draw with UMLet the class diagram on the page (whose title is Map (2) (1)) of lecture note 7. One .uxf file is made.

2. Write in Java the interfaces and classes appearing on the class diagram. You are supposed to compile with javac the those .java files together with the other given programs and conduct testing your programs by launching with java the two files TestMap1(.class) and TestMap2(.class).

3. Let us consider the two objects. One is referred by the variable map just after executing map.put("x",6); on the page (whose title is Reuse) of lecture note 7, and the other is (by replacing BSTMap with ListMap) referred by the same variable at the same position. Draw the two object diagrams corresponding to the two objects. Two .uxf files are made.

4. Write your explanation on those diagrams and programs as a report. The report should be made as one .pdf file.

5. Make one zip file containing those .java files, those .uxf files and one .pdf file, and then send it to the lecturer as an email attachment by the deadline.


Assignment 9: Exercise 8

1. Draw with UMLet the state diagram on the page (whose title is State Diagram (4)) of lecture note 8, the three sequence diagrams used in the lecture note, and the class diagram used in the lecture note. Five .uxf files are made.

2. Write in Java all classes appearing in the class diagram except for those provided by Java libraries. You are supposed to compile with javac the those .java files (together with the other given programs if necessary) and conduct testing your programs by launching the application with Java.

3. Write your explanation on those diagrams and programs as a report. The report should be made as one .pdf file.

4. Make one zip file containing those .java files, those .uxf files and one .pdf file, and then send it to the lecturer as an email attachment by the deadline.


Assignment 10: Exercise 9

1. Draw with UMLet the state diagram and the class diagram of the simple calculator, and the class diagram, the object diagram and the sequence diagram of the parse tree, all of which appear in lecture note 9. Five .uxf files are made.

2. Write in Java the following classes:

SimpleCalculator
VirtualMachine
ExpParseTree
NumParseTree
AddParseTree
MulParseTree
QuoParseTree
SubParseTree

You are supposed to compile with javac the those .java files (together with the other given programs if necessary) and conduct testing your programs by launching the application with Java.

3. Write your explanation on those diagrams and programs as a report. The report should be made as one .pdf file.

4. Make one zip file containing those .java files, those .uxf files and one .pdf file, and then send it to the lecturer as an email attachment by the deadline.


Assignment 11: assignment calculator

Programs & diagrams provided

1. Write the five missing classes in Java.
One missing class is VirtualMachine whose class diagram and state machine diagram are given. Five .java files are made.

2. Write three diagrams in UML.
i. A state machine diagram of (an object of) class AssignCalculator.
ii. An object diagram of the parse tree that is made by parsing the following program:

x := -2;
x := -2*x;
x := -2*x;

iii. A sequence diagram that starts with sending message genCode() to the parse tree.
Three .uxf files are made.

3. Write your explanation on the programs and diagrams you have written as a report. One .pdf file is made.

4. Make one zip file containing five .java files, three .uxf files and one .pdf file, and then send it to the lecturer as an email attachment by the deadline.


Assignment 12: Exercise 10

1. Write all programs used in the lecture note including those that partially appear. You are supposed to compile with javac the those .java files and conduct testing each application (each .java file in which static void main(...) method is defined) by launching the application with Java.

2. Write your explanation on each program. You are especially supposed to explain each flaws of a program if the program has any flaws and include in your report some evidence, such as (part of) the result produced by each application, showing that you have conducted testing each application.

3. Make one zip file containing those .java files and one .pdf file, and then send it to the lecturer as an email attachment by the deadline.


Assignment 13: Exercise 11

1. Write all programs used in the lecture note including those that partially appear. You are supposed to compile with javac the those .java files and conduct testing each application (each .java file in which static void main(...) method is defined) by launching the application with Java.

2. Model check with JPF each application, which requires you to prepare a .jpf file for each application.

3. Write your explanation on each program. You are supposed to include in your report the result produced by JPF for each application and to explain the result if JPF detects any flaws.

4. Make one zip file containing those .java files, those .jpf files and one .pdf file, and then send it to the lecturer as an email attachment by the deadline.


Assignment 14: dining philosopher problem

1. Write a program that is different from any programs used in the course and may lead to deadlock, confirm that the program causes deadlock with JPF, and explains the execution path (trace) that is produced by JPF and leads to deadlock. You are also supposed to explain the program.

2. Confirm that the dining philosopher problem causes deadlock if all philosophers are allowed to enter the dining room at the same time (namely that DiningRoom(n-1) is changed to DiningRoom(n) in class DiningPhilosopherProblem) with JPF, where the number of philosophers is 3 and the number of dinners each philosopher has is 1, and explains the execution path (trace) that is produced by JPF and leads to deadlock.

3. Come up with a different solution to the dining philosopher problem than what is described in the course, and explains your solution. You do not need to come up with a really new solution but can consult books, papers, etc. If you have consulted books, websites, papers, etc., however, you need to enumerate all such books, websites, papers, etc.

4. Implement your solution in Java, and explain your programs.

5. Model check that your solution does not lead to deadlock with JPF. You are supposed to check two cases: (1) the number of philosophers is 3 and the number of dinners each philosopher has is 1, and (2) the number of philosophers is 5 and the number of dinners each philosopher has is 1. You are also supposed to include the two results produced by JPF in your report.

6. Write all explanations (descriptions) in one file named report3.pdf (in pdf), put all .java & .jpf files related to 1. into a directory (folder) named Deadlock, put all .java & .jpf files related to 2. into a directory named DPPDeadlock, and put all .java & .jpf files related to 4. & 5. into a directory named NewSolutionToDPP; put report3.pdf, Deadlock, DPPDeadlock and NewSolutionToDPP into a directory whose name is your name followed by your student identification number (for example, if your name is Sentan & your student identification number is 123450, then the directory name is Sentan123450); zip the directory to make one zip file (for example, Sentan123450.zip) and send it to the lecturer by the deadline.5


Assignment 15: mini programming language processor

1. There are five missing classes. One missing class is VirtualMachine. Write the five missing classes in Java. Five .java files are made.

2. Complete the class IfParseTree. One .java file is made.

3. Complete the class WhileParseTree. One .java file is made.

4. Write your explanation on the programs you have written as a report. One .pdf file is made.

5. Make one zip file containing seven .java files and one .pdf file, and then send it to the lecturer as an email attachment by the deadline.