Develop appropriate models of software systems

Assignment Help Software Engineering
Reference no: EM132361816

Assignment - Refactoring

Overview

The aim of this assignment is to provide students with the opportunity to apply knowledge and skills related to the improvement in the design of code. They do this by documenting, refactoring and testing an existing application provided with the assignment.

Learning Outcomes Assessed

The following course learning outcomes are assessed by completing this assessment:

• S1. Apply software engineering principles to design and implement software applications.

• S2. Operate CASE software to develop appropriate models of software systems.

• S3. Develop comprehensive unit test suites.

• A1. Write integrated reports, using appropriate models, providing detailed analysis of given textual scenarios.

• A2. Implement software applications, using appropriate software engineering techniques, from a given textual scenario.

Assessment Details

Background

Refactoring
Refactoring is said to be "the process of changing a software system in such a way that it does not alter the external behavior of the code yet improves its internal structure. It is a disciplined way to clean up code that minimizes the chances of introducing bugs". (Fowler, 2000, p. xvi). However it is not just a process for cleaning up code. Your lecture slides point out that whilst refactoring does not cure all ills and can find bugs, it can also improve the design of software, make it easier to understand and help you program faster.

The concept of ‘smells' has been introduced to help identify where refactoring should occur. Smells (problems) can be identified and classified in a number of ways including at the code level such as the ones identified by Beck and Fowler (Fowler, 2000) or at a higher level such as those identified by Suryanarayana and others (2015). They associate smells with the notion of technical debt - the debt that accrues when non-optimal or incorrect decisions are made either knowingly or unknowingly. From their perspective, smells can be classified into architectural, design or implementation types and any of these can either be structural or behavioural in nature. In any case, the refactoring that is performed may be in a general sense to follow good practices or more specifically to follow other modelled solutions such as design patterns. As you are just starting your journey, you are expected in this assignment to follow the refactoring practices outlined in Fowler (2000). You need to examine some code and identify the smells catalogued by him and choose appropriate refactoring/s from his suggestions for the smell and implement them. You should also follow good practices including appropriate variable naming, code indentation and commenting.

Clinic Management System

You have been provided with access to a GitHub repository with some code in it.

The code provided is part of a larger system, the Clinic Management System that is under development. The system is built with the purpose of managing a veterinary practice that may have multiple clinics. At this stage, the classes provided to you are for the class: Veterinarian, Animal and Clinic. There is a simple driver class that is used mainly for demonstrating these 3 provided classes. The larger system is menu driven and will enable an employee at the clinic to allocate animals who register to a particular veterinarian. After the allocations, the animals' owners will be able to make an appointment with their allocated veterinarian using an online web portal.

At the current stage of development, a junior software developer has been working on the classes Animal,

Veterinarian and Clinic. However, at a recent code review meeting, a more experienced software engineer has made the comments provided below. It is your job to read the comments and help the junior software developer to identify some bad smells and indicate where refactoring might be performed to improve the code. After identifying the potential changes, you should demonstrate the refactoring of the code so that the design is improved. At this stage, you do not need to add functionality to these classes. The aim now is to improve the design. Rewrite the code according to each refactoring and commit it to your individual GitHub repository.

Comments made by the experienced software engineer:

"Hmm, I think there are some things that need reviewing in these classes. I feel there are some bad smells in the design. I suggest you examine the code to identify any obvious smells and then perform some refactoring to improve the design. Smells are not the only thing to focus upon. You should also follow good coding conventions including for example appropriate and meaningful variable naming. Ultimately, you need to think about how you can refactor your code to improve it. The goal is to perform some refactoring and improve on the code without changing the functionality it provides. You might think about the purpose of each class and what methods belong in each. It might help to create a UML class diagram in order to have a high level view of these classes.

As you are reviewing the code, I wonder if the following issues might be considered:

1. There are quite a few situations where code is duplicated and/or very similar code appears;

2. What is the purpose of the Clinic.java class? I am wondering if there should be some methods on the clinic to manage the attributes associated with a clinic such as the veterinarians and the animals. This class is confusing, what is it responsible for? There is a long method which seems to be doing a lot. I feel that there is unnecessary coupling between the Clinic and the Animal class.

3. Is the Animal object really responsible for allocation of a Veterinarian? Perhaps that allocation is done elsewhere and then a message sent to the Animal to inform it who has been allocated?

4. Have a look at refactoring collections. I always think that is a good idea. In fact, encapsulation of both fields and collections are basic good design decisions in my opinion.

5. One last thing, switch statements indicate a bad smell in the code, but there are similarities with use of selection statements and type codes. I think there could be a similar smell ‘Type codes used with selection'. There are clearly two animal types - InsuredAnimals and UninsuredAnimals. Each of these are associated with different behaviours in terms of allocations of veterinarians amongst other things."

Assessable Tasks/Requirements

The application code is badly in need of refactoring. Many examples of the "code smells" discussed in Fowler's (2000) book should be evident.

You are to complete the steps outlined below and submit a report and associated code solution. You need to use a number of software tools in this assignment. Access and documentation links to these tools are included in your Moodle shell.

1. Step 1 - Access the code

a) Complete the following to steps to setup your GitHub repository and download your starting code:

a. Enter the GitHub classroom

b. If you haven't used GitHub before you will need to create an account using the link on the sign- in screen. Create a GitHub account by following the instructions in the handout (Registering for and using a GitHub repository and the GitHub Classroom) available in the Study Resources section of your Moodle shell.

c. Follow the separate handout (Using Eclipse IDE to interface with GitHub repository v2) available in the Study Resources section of your Moodle shell. Start at page 7 to page 11 to download and import the provided starter code from the GitHub classroom and load it into a new local repository in Eclipse.

d. Now you have imported the starter code into a project repository in Eclipse.

b) Run the system. You will find that it has created a file called "MyOutput.txt" in the working directory. If you wish to use a different folder you will need to update the output file in MainDriverClass.java. The output of the program will be displayed on the console and written on the output file.

2. Step 2 - Begin a report document

Open up a new document in Word (or equivalent), start jotting down any code smells you identify in the code in point form (you might want to cut and paste the code into Word to illustrate the problems). This will form a report that you will need to include in your assignment submission.

3. Step 3 - Create a class diagram of the initial code

Create a class diagram of the given code in Enterprise Architecture (EA). For help with this you can read the

document Using Enterprise Architect in the Study Resources section of your Moodle shell. This class diagram should be included in your final submission. The image of the diagram should be in your report as well.

4. Step 4 - Start refactoring and testing your changes

a) At the start of each work session, pull the most recent version of code from your remote repository into your local repository before you start work.

b) Begin refactoring in Eclipse.

c) If you have what you think is a smell, note it down in your document if you have not already done so.

d) Identify the refactoring/s you will use and update your code.

e) Each time you think you have completed a refactoring, run the program and then test if the program output is the same as the output before refactoring. You can rename the output file so that you can check them. You can write a simple Java program to check if two output files are the same or not so that you do not have to manually inspect them. If the two outputs files (before and after refactoring) are different, it is because the output has been changed. Refactoring should not change the output so you will need to look at the code you have already written before you move on.

f) When you have completed each refactoring, commit and push your new code from your local Eclipse repository to save it in your own online GitHub repository. It may be necessary to add files to the index before committing.

g) Update your report document with what you have done for the refactoring.

5. Step 5 - When you have finished refactoring

If you haven't updated your UML class diagram as you've refactored, create a second class diagram in EA of the final refactored code. This should be included in your final submission. You can drag and drop the pdf of your UML and the EA project file into your repository using a web browser. An image of your diagram should be in your report as well.

Reference no: EM132361816

Questions Cloud

What is the probability it goes undetected : Suppose the copy they are proofing contains a hyphenation error. What is the probability it goes undetected.
What is logic bomb-what are three broad mechanisms : What is a "logic bomb"? What are three broad mechanisms that malware can use to propagate? What mechanisms can a virus use to conceal itself?
Fundamental design principles : Explain how each fundamental design principle is integral to process improvement within the logistics and distribution industry.
Forensics with python : The script will open a file containing a blacklist of words and it will report whether the .mbox file includes any of the blacklisted words
Develop appropriate models of software systems : Write integrated reports, using appropriate models, providing detailed analysis of given textual scenarios - Implement software applications, using appropriate
Discuss the team dynamics for highly effective : Discuss the team dynamics for a highly effective or ineffective team of which you were a member. Can you explain why the team performed so well or so poorly?
Information on windows system : Discuss how an IPS/IDS can protect user information on a Windows system or any computing device that is connect to a network
Evaluate benefits of using cloud-based-integrated software : Evaluate the benefits of using cloud-based and integrated software solutions to complete business projects, and provide two or three examples.
Computing device that is connect to network : Discuss how an IPS/IDS can protect user information on a Windows system or any computing device that is connect to a network

Reviews

Write a Review

Software Engineering Questions & Answers

  Research report on software design

Write a Research Report on software design and answer diffrent type of questions related to design. Report contain diffrent basic questions related to software design.

  A case study in c to java conversion and extensibility

A Case Study in C to Java Conversion and Extensibility

  Create a structural model

Structural modeling is a different view of the same system that you analyzed from a functional perspective. This model shows how data is organized within the system.

  Write an report on a significant software security

Write an report on a significant software security

  Development of a small software system

Analysis, design and development of a small software system.

  Systems analysis and design requirements

Systems Analysis and Design requirements

  Create a complete limited entry decision table

Create a complete limited entry decision table

  Explain flow boundaries map

Explain flow boundaries map the dfd into a software architecture using transform mapping.

  Frame diagrams

Prepare a frame diagram for the software systems.

  Identified systems and elements of the sap system

Identify computing devices, which could be used to support Your Improved Process

  Design a wireframe prototype

Design a wireframe prototype to meet the needs of the personas and requirements.

  Explain the characteristics of visual studio 2005

Explain the characteristics of Visual Studio 2005.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd