/redistributing-responsibilities

TUOS COM3523/6523 Lecture - Redistributing Responsibilities

Primary LanguageJava

Redistributing Responsibilities | Managing Code Clones

This repository includes lab materials to support the Spring Semester of the COM3523/6523 module "Software Reengineering" at the University of Sheffield.

In this week, we explore "redistributing responsibilities" and "managing code clones".

Important Notes

Below we have a list of tasks you need to complete. Although the tasks are independent, you may find it useful to complete them in the order listed below.

Note that several instructions and hints are given in the code files. Please best use them and think carefully about the code before you start to write your own code.

By default, a CI/CD pipeline is set up to automatically check the following commands (i.e., the commands that must pass when you complete all the tasks below) when your commits are pushed to the main branch:

  • mvn test -Dtest=TestExtractMethods
  • mvn test -Dtest=TestDelegateMethods
  • mvn test -Dtest=TestBank#testBank_new
  • mvn test -Dtest=TestJaccardSimilarity
  • mvn test -Dtest=TestDotPlot

Part 0: Setup

This part is to set up your own repository and understand the code in the repository.

Step 1: Clone your repository

First, clone this repository to your local machine (e.g., the user drive in the University computer; u:/Teaching/COM3523/2022-23 in my case). Open Git Bash and enter the following commands:

cd u:/Teaching/COM3523/2022-23
git clone [YOUR_REPOSITORY_ADDRESS]

Step 2: Take a look at the code

Now, take a look at the code you just cloned. If you want, open the project in IntelliJ and browse the files in it. For those who wants to install IntelliJ 2022 on your shared drive (/U:), please refer to this guideline.

Part 1: Redistributing Responsibilities

This part is about redistributing responsibilities. Please see "Week 8 - lecture materials" on the Blackboard for more information.

(Task1) Extract methods

Please read instructions and complete ExtractMethods.java.

If you complete this, the following test case should pass:

mvn test -Dtest=TestExtractMethods

(Task2) Delegate methods

Please read instructions and complete DelegateMethods.java.

If you complete this, the following test case should pass:

mvn test -Dtest=TestDelegateMethods

(Task3) Deal with god classes

Please read instructions and complete Bank.java.

If you complete this, the following test case should pass:

mvn test -Dtest=TestBank#testBank_new

Part 2: Managing Code Clones

This part is about managing code clones. Please see "Week 9 - lecture materials" on the Blackboard for more information.

(Task4) Compute Jaccard similarity

Please read instructions and complete JaccardSimilarity.java.

If you complete this, the following test case should pass:

mvn test -Dtest=TestJaccardSimilarity

(Task5) Draw dot plots

Please read instructions and complete DotPlot.java.

If you complete this, the following test case should pass:

mvn test -Dtest=TestDotPlot

References