Assignment 5 – UML & Refactoring

Posted codingjava

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Assignment 5 – UML & Refactoring相关的知识,希望对你有一定的参考价值。


Assignment 5 – UML & Refactoring
CSCI3130 – Software Engineering – Fall 2019
Due date: November 29, 2019 at 23:59
For this assignment you will first answer some UML questions, and then you will perform
refactoring on some existing code.
Requirements and How to Submit
• Use the CSCI3130Assignments repo you created for assignment 3 and used for
assignment 4 to submit code for this assignment.
o Create a new directory at the base of the repo called A5
o Unzip the contents of A5.zip on Brightspace in the assignment 5 page into your
A5 directory
o Perform your refactoring programming in your repo and commit your changes
o Push your changes to your repo
o Do NOT commit .class or any other compiled files to your A5 subfolders, there
should be nothing but .java files in your A5 subfolders. Do not commit any files
you used for testing, any readme files, any environment or IDE files or anything
but .java files.
o In this assignment you are refactoring (improving the design of) existing code,
the code you modify already has unit tests written that pass. To receive full
marks on the assignment after you have modified the code the unit tests must
continue to pass.
o You may not modify the unit tests I have written. This
means do not alter the Main.java file in each folder in ANY
way.
o Your code must compile and run via the following commands executed in your
A5 subfolders (in each of the QuestionX folders):
§ javac *.java
§ java Main
o The results of java Main in each folder should be a single line of output: either
the word “PASS” or the word “FAIL”. If you have implemented your changes
properly the word will be PASS.
• Submit a PDF file with your answer to the UML questions and a link to your repo to
Brightspace
UML
Answer the following questions by drawing UML diagrams. To draw the diagrams, you have
several options:
• If you have a Windows based laptop, Dalhousie provides Microsoft Visio as part of our
Microsoft software available to all Dalhousie students. This is one of the best programs
for doing UML diagrams right now.
• If you don‘t have a Windows laptop or you can‘t figure out how to install Visio, you can
CSCI3130作业代写、Software Engineering作业代做
use Visual Paradigm online. This is what I use to make diagrams and it works fine. You
do need to create a free account to use it. You can access the tool here:
https://online.visual-paradigm.com
o If you choose this option screenshot your diagram when it is complete, the
export option will place watermarks all over the diagram that can sometimes
make it hard to read.
• Draw the diagrams on paper, and scan them in. Be warned with this option though that
we are marking everything about the diagrams (the boxes and arrows are the correct
shape, things are bold or bold italic when they are supposed to be, etc.). If you choose
to draw your own diagram by hand it must be legible, and the diagram must obey the
rules of UML as we‘ve taught them in this course.

Questions:
1. Draw a UML state diagram that depicts a simple system that stacks and unstacks a set of
Russian “Matryoshka” dolls. Matryoshka dolls are hollow wooden dolls that can be
separated in two parts, revealing a smaller doll inside, which can itself be separated, and
so on, until the smallest, solid doll is reached. The system has four states: ready (dolls
stacked), ready (dolls unstacked), stacking, and unstacking. Consider the following
details of the system operation:
a. The system will never stack or unstack dolls out of order; dolls are always placed
inside the next largest doll.
b. The system can transition between stacking and unstacking mid-sequence; that
is, it can switch to stacking again even before all dolls have been unstacked, and
vice versa.
2. Using UML class diagram notation, sketch out the classes that would implement what is
expressed in the sequence diagram shown below. Include the class relationships in your
diagram. For each class, identify the public interfaces required in order to implement
what is expressed in the sequence diagram. Do not provide any additional detail about
the classes beyond the class name, the relationships, and the interface methods visible
in this diagram (i.e., don’t define new methods, or list fields/instance variables).
Refactoring
I have written 3 sets of code that contain various code smells. Your job is to apply the correct
refactoring to resolve the code smell I have identified for you. This may involve modifying the
existing classes or interfaces or writing new classes and interfaces.
Use the handouts from class to determine the correct mapping of code smell to refactoring,
and then perform that refactoring on the code in each question folder.
Question 1:
• Smell: Duplicated Code
• The Question1.buildBookQuotehtml() has some badly duplicated code in it.
Question 2:
• Smell: Divergent Change
• The Person class has 2 reasons to change, and the reasons are not related.
Question 3:
• Smell: Long Parameter List
• The Person class private method isRobsAddress() takes too many parameters.
Marking Rubric:
UML questions: 50%, 25% per question
• Deviation from the UML specification described in the UML lecture will lose points
Refactoring questions: 50%
• All unit tests Rob wrote output the word “PASS”: 15% (5% per question)
• Proper use of refactorings: 30% (10% per question)
• Code readability / understandability: 5%
• Code does not compile = Automatic 0 on refactoring section.
• Modifying any of the Main.java files = Automatic 0 for that question.

因为专业,所以值得信赖。如有需要,请加QQ99515681  微信:codehelp

以上是关于Assignment 5 – UML & Refactoring的主要内容,如果未能解决你的问题,请参考以下文章

在 C++11 中“删除”复制 ctor/assignment

Rails - attr_accessible & mass assignment

一文读懂14种 UML 图业务建模&系统分析的设计方式(上)

C++ Super-FAQ 『Assignment Operators』

CS231N assignment 1 _ SVM 学习笔记 & 解析

设计模式概论与原则 & UML类图