Christian Sheridan 14745cc85c completed lab 6 年之前
src completed lab 6 年之前
.gitignore convert to intellij 6 年之前
pom.xml convert to intellij 6 年之前
readme.md Update 'readme.md' 6 年之前

readme.md

Clean Code

Objective:

  • To learn to read code and write test for the Inventory class
  • To refactor (aka clean up) the code in the Inventory class to make it more maintainable and readable

Purpose:

  • To understand why writing readable code matter

Instructions:

  1. Fork this Repository
    • fork this repository to your personal github account
    • clone your forked repository to your local machine.
    • clean up the code in the Inventory class
    • commit your changes
    • submit a pull request which compares Zipcoder master to your master.
  2. DO NOT CHANGE THE ITEM CLASS

See test coverage

  1. Right click on the java folder in the test directory
  2. Select Run all with test coverage
  3. Note a window pop up which display which line is covered

Part 1 - Add tests

Add test and make sure the line of code coverage is 100%.

DO NOT alter the Item class or Items property.

Part 2 - Refactor the code

Note how hard it is to read this code. Your task is to refactor the code to make it more readable. First create a new branch called refactor.

Part 3 - Add a new item

We have recently signed a supplier of conjured items. This requires an update to our system. First create a new branch called new-item. Add a conjured item.

  • "Conjured" items degrade in Quality twice as fast as normal items

Feel free to make any changes to the UpdateQuality method and add any new code as long as everything still works correctly.

This originated from Bobby Johnson's Blog.