联系方式

  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-23:00
  • 微信:codinghelp

您当前位置:首页 >> Python编程Python编程

日期:2020-04-01 10:20

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

2. After the TimBot configurations are read, P plant configurations are read. <NEW>

3. A plant configuration consists of a single line containing one string and four integers: <NEW>

? 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 <CURRENT>

2. Each district can have additional plants. There can be many additional plants. <NEW>

3. There are to be two (2) types of plants (for now)

? Spresso plants <CURRENT>

? 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 <NEW>

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

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

6. The amount of growth remaining is decremented at the end of the harvest phase <CURRENT>

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

8. During the harvest phase, all plants that are harvestable are harvested. <NEW>

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.


版权所有:留学生编程辅导网 2020 All Rights Reserved 联系方式:QQ:99515681 微信:codinghelp 电子信箱:99515681@qq.com
免责声明:本站部分内容从网络整理而来,只供参考!如有版权问题可联系本站删除。 站长地图

python代写
微信客服:codinghelp