i219 Software Design Methodology @ Ishikawa

Lecturer: OGATA, Kazuhiro (email: ogata at jaist dot ac dot jp)
Room: i1&2
Term: 2-2 (Dec 8, 2020 - Feb 3, 2021)
TAs: Canh Minh Do (canhdominh), Yato Phyo (yatiphyo) & Win Sin Khine Shwe (winshwesinkhine)

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


News

- Jan 20: Feb 2, 10:50-12:30 Review and Final Assignment Problem Disclosure (Submission Deadline: Midnight of Jan 3 (JST))
- Jan 20: The tutoria hour session of Jan 28 has been canceled.
- Jan 6: The submission deadline of Assignment 5 has been extended to Midnight of Jan 17, 2021 (JST).
- Dec 8: In addition to me, you can consult some of the three TAs on any contents of the course.
- Dec 8: When you submit your solution of each assignment, please write "Assignment j of i219 (Ishikawa)" in Subject  of the email, where j = 1, 2, ... (please do not write j as it is). Please include "(Ishikawa)" because I have the same course at Tokyo Satellite.
- Dec 2: Links to somewhere in this webpage may not work. Please scroll down manyally.
- Dec 2: Note that PLAGIARISM is strictly prohibited! If I happen to find programs submitted from different students are surprisingly similar, I may make their total scores of the course ZERO!
- Dec 2: You should consult
sample answers to tackle Exercise 5.
- Dec 2: Private attributes: please download
A.java & B.java and cpmpile them with javac. 
- Dec 2: Please write import java.util.*; in each .java file to be made before writing the class.

- Dec 2: 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.

- 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 page 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 8, 10:50-12:30: Outline  lectureNote1  diagrams1
    Overview of software design methodology
2.  Dec 10, 9:00-10:40:
lectureNote2  programs2  diagrams2
    Basic concepts of object-oriented technology
3.  Dec 10, 13:30-15:10:
lectureNote3  programs3  diagrams3
    Static modeling
4.  Dec 15, 10:50-12:30:
lectureNote4  programs4  diagrams4
    Object-oriented programming language 1
5.  Dec 17, 9:00-10:40:
lectureNote5  programs5  diagrams5
    Object-oriented programming language 2
    Dec 17, 13:30-15:10 (TH)

6.  Dec 22, 10:50-12:30: lectureNote6  programs6  diagrams6
    Object-oriented programming language 3
7.  Dec 24, 9:00-10:40:
lectureNote7  programs7  diagrams7
    Information hiding and reuse
8.  Jan 7, 9:00-10:40:
lectureNote8  programs8  diagrams8
    Dynamic modeling 1
9.  Jan 12, 10:50-12:30:
lectureNote9  programs9  diagrams9
    Dynamic modeling 2
10. Jan 14, 9:00-10:40:
lectureNote10
    Multithreaded programming
    Jan 14, 13:30-15:10 (TH)
11. Jan 19, 10:50-12:30:
lectureNote11
    Software model checking
12. Jan 21, 9:00-10:40:
lectureNote12 programs12 diagrams12 
    Case Study 1
    Jan 21, 13:30-15:10 (TH)
13. Jan 26, 10:50-12:30:
lectureNote13  programs13
    Case Study 2
14. Jan 28, 9:00-10:40: lectureNote14
    Case Study 3
    Jan 28, 13:30-15:10 (TH)
    Feb 2, 10:50-12:30 Review and Final Exam (or Final Assignment) (Tentative)
Problem Disclosure
    (Final Assignment Submission Deadline: Midnight of Feb 3)


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 (Ishikawa) 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. Although it is strongly prohibited to plagiarize any others solutions and let any others plagiarize yours, it is recommended to teach any technical contents of the course each other. If you discuss anything about assignments with any others, you are supposed to write who you did so in your report. 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 15, 2020 (JST)
2.
Exercise 2 (score: 2)
Deadline of submission: Midnight of Dec 22, 2020 (JST)
3.
Exercise 3 (score: 2)
Deadline of submission: Midnight of Dec 24, 2020 (JST)
4.
Exercise 4 (score: 3)
Deadline of submission: Midnight of Dec 28, 2020 (JST)
5.
Exercise 5 (score 8)
Deadline of submission: Midnight of Jan 7, 2021 (JST) extended to Midnight of Jan 17, 2021 (JST)

6. Exercise 6 (score: 3)
Deadline of submission: Midnight of Jan 7, 2021 (JST)
7.
Simple calculator (score: 5)
Deadline of submission: Midnight of Jan 7, 2021 (JST)
8.
Exercise 7 (score: 2)
Deadline of submission: Midnight of Jan 7, 2021 (JST)
9.
Exercise 8 (score: 2)
Deadline of submission: Midnight of Jan 14, 2021 (JST)
10.
Exercise 9 (score: 2)
Deadline of submission: Midnight of Jan 19, 2021 (JST)
11.
Assignment calculator (score: 5)
Deadline of submission: Midnight of Jan 24, 2021 (JST)
12.
Exercise 10 (score: 3)
Deadline of submission: Midnight of Jan 28, 2021 (JST)
13.
Exercise 11 (score: 5)
Deadline of submission: Midnight of Feb 7, 2021 (JST)
14. 
Dining philosopher problem (score: 8)
Deadline of submission: Midnight of Feb 7, 2021 (JST)
15. 
Mini programming language processor (score: 8)
Deadline of submission: Midnight of Feb 7, 2021 (JST)

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
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. Make the two classes BlueClass and BlueClassUndo. The two .java files are made. 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 four class diagrams used in lecture note 2
such that the first one consists of class BlueClass and class BlueClassUndo, the second one consists of class ArrayList<KeyValPair> and class BlueClass2, the third one consists of interface ExpParseTree, class NumParseTree and class AddParseTree, and the fourth one consists of interface ParseTree, abstract class StmParseTree and interface ExpParseTree. Four .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, four .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 with 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 classes missing. Each of the four 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 (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 (5)) 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.


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..