首页 > > 详细

CSCI 2134讲解、辅导Python,Java,c/c++程序语言、讲解data 讲解数据库SQL|讲解Database

CSCI 2134 Assignment 4
Due date: 11:59pm, Monday, April 6, 2020, submitted via Git
Objectives
Extend an existing code-base and perform some basic class-level refactoring in the process.
Preparation:
Clone the Assignment 4 repository
https://git.cs.dal.ca/courses/2020-winter/csci-2134/assignment-4/.git
where is your CSID.
Problem Statement
Take an existing code-base, add required features, test it, and refactor it as necessary.
Background
The TimBots simulator is moving on to version 2. Your boss wants you to add some new features
to the simulator that have been requested by the customer. She has hired you to extend the
code. She also mentioned that the original designer of the code did not do a great job and wondered
if there was any way to improve the code. She will provide you with (i) the code-base, (ii)
the existing requirements, and (iii) the specification of the additions to be made.
Your job is to (i) create a design for the additions, (ii) implement the additions, (iii) create unit
tests for the additions, and (iv) identify opportunities for class-implementation and class-interface
refactoring, and (v) do some refactoring where appropriate. May the source be with you!
Task
1. Review the specification (Timbots.pdf) in the docs directory. You will absolutely need
to understand it and the code you are extending.
2. Review the extension specification at the end of this document, which describes all the extensions
to be done.
3. Design and implement the extensions using the best-practices we discussed in class.
4. Provide a readable, professional looking UML diagram of the updated design. This should be
a PDF file called design.pdf in the docs directory.
5. For each new class that you implement, you must provide unit tests in the form of Junit5
tests. You should design your classes and modify existing classes to facilitate the testing.
6. In a file in the docs directory called refactoring.txt list all the class-implementation
and class-interface refactoring that you will do and refactoring that you would recommend.
7. Perform any class-implementation and class-interface refactoring that you promised to do.
8. Bonus: Research the Factory pattern that is used to instantiate classes derived from the same
superclass. E.g., all the bots are subtypes of TimBot. Implement the Factory pattern to fix the
creation of bots in TimSim. Be sure to update the UML diagram and provide unit tests.
9. Commit and push back everything to the remote repository.
Grading
The following grading scheme will be used:
Task 4/4 3/4 2/4 1/4 0/4
Design
(10%)
Design is cohesive,
meets all requirements,
and follows
SOLID principles
Design meets all requirements
and
mostly follows
SOLID principles
Design meets
most of the requirements.
Design meets
few of the of requirements.
No design
submitted.
Implementation
(25%)
All requirements
are implemented
Most of the requirements
are implemented
Some of the requirements
are
implemented
Few of the requirements
are
implemented
No implementation
Testing
(25%)
Each new class has
a set of unit tests
associated with it.
All requirements
are tested. If implementation
is incomplete,
the test is still
present.
Most of the new
classes have an associated
set of unit
tests. Most requirements
are
tested.
Some of the
new classes
have an associated
set of unit
tests. Some requirements
are
tested.
Few of the new
classes have an
associated set
of unit tests.
Few requirements
are
tested.
No testing
Refactoring
Description
(10%)
At least 4 class level
refactoring suggestions
that follow
SOLID principles
and make sense.
At least 3 class level
refactoring suggestions
that follow
SOLID principles
and make sense.
At least 2 class
level refactoring
suggestions that
follow SOLID
principles and
make sense.
At least 1 class
level refactoring
suggestions that
follow SOLID
principles and
make sense.
No refactoring
suggestions.
Refactoring
Implementation
(10%)
At least 2 class-level
refactoring suggestions
are implemented
correctly.
2 class-level refactoring
suggestions
are implemented,
with 1 being done
correctly.
1 class-level refactoring
suggestion
is implemented
correctly.
1 class-level refactoring
suggestion
is implemented.
No refactoring
suggestions
implemented.
Code Clarity
(10%)
Code looks professional
and follows
style guidelines
Code looks good
and mostly follows
style guidelines
Code occasionally
follows style
guidelines
Code does not
follow style
guidelines
Code is illegible
or not
provided
Document
Clarity
(10%)
Documents look
professional, include
all information,
and easy to
read
Documents look ok.
May be hard to
read or missing
some information.
Documents are
sloppy, inconsistent,
and has
missing information
Documents are
very sloppy with
significant missing
information
Documents
are illegible
or not provided.
Bonus
[10%]
Factory pattern implemented
and
tested.
Factory pattern implemented
Factory pattern
partially implemented
Factory pattern
attempted.
No attempt
Submission
All extensions and files should be committed and pushed back to the remote Git repository.
Hints
1. You can get a large number of marks without writing any code.
2. Do the design first and look at refactoring as you design.
3. The extensions are intended to require minimal code.
4. Testing is as important as implementation
Specification of Required Extensions
Background
Our customer has requested that additional plant types, beyond “Spresso” be available in the
simulator. Currently, TimBots can only harvest Spresso for energy, but in a more realistic simulation
other types of plants may be used. You will need to
• Extend the simulator to support different types of plants
• Extend the simulator to support a mix of different plants in each district
• Add the “Mericano” plant to the simulation.
Specification: Changes to Program Input
1. The first line of the input will contain an additional integer at the end, denoting the number
of plant specifications to read. I.e., instead of the first line containing six integers, there will
now be seven: “R C J G N T P”
• R: number of rows in the grid representing planet DohNat
• C: number of columns in the grid representing planet DohNat
• J: number of jolts that Spresso harvest yields
• G: number of rounds needed for Spresso to grow after harvest
• N: maximum number of rounds to run the simulation for
• T: number of TimBot configurations to follow.
• P: number of plant configurations
2. After the TimBot configurations are read, P plant configurations are read.
3. A plant configuration consists of a single line containing one string and four integers:
• N: string denoting name of plant. E.g., mericano, spresso.
• X: the x coordinate of the district containing the plant, where 0 ≤ X < C
• Y: the y coordinate of the district containing the plant, where 0 ≤ Y < R
• E: number of Jolts the plant harvest yields.
• G: number of rounds needed for the plant to grow
Specification: Functional Changes
1. Each district contains Spresso plants with the energy and growth properties specified on the
first line of the input
2. Each district can have additional plants. There can be many additional plants.
3. There are to be two (2) types of plants (for now)
• Spresso plants
• Are initially ready for harvest (initial time remaining till harvest is 0)
• Yield a specified number of jolts when harvested
• Take a specified number of rounds to grow before they can be harvested again
• Mericano plants
• Are not initially ready for harvest (initial time remaining till harvest is growth time)
• Yield a specified number of jolts when harvested
• Take a specified number of rounds to grown before they can be harvested
• Once they are harvested, will never grow back
4. Each district has the Spresso plant specified by the first line of the input.
5. When the plant configurations are read in in the input stage, the plants are added to the
specified districts with the specified jolt yield and growth length.
6. The amount of growth remaining is decremented at the end of the harvest phase
7. When a TimBot performs senseDistrict(), the spressoSensed number reported for
each district is the minimum amount of growth remaining (in rounds) over all the plants in
the district. E.g., if there is one Spresso plant that will be ready in 5 rounds, one Spresso plant
that will be ready in 8 rounds, and one Mericano plant that will be ready in 2 rounds, then
the number of rounds before harvest is possible in the district is 2.
8. During the harvest phase, all plants that are harvestable are harvested.
9. All other specifications are inherited from the existing specification document in docs.
Specification: Nonfunctional Changes
1. The design should follow the SOLID principles
2. The customer has informed us that more types of plants will be added in the near future, so
the design should reflect this.

联系我们
  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-21:00
  • 微信:codinghelp
热点标签

联系我们 - QQ: 99515681 微信:codinghelp
程序辅导网!