Question
Marquee Display (Recommended IDE DEV-C++) Through assignment 1 youve developed your first animated program in C. The sample solution is attached with this assignment to
Marquee Display (Recommended IDE DEV-C++)
Through assignment 1 youve developed your first animated program in C. The sample solution is attached with this assignment to show you how a novice programmer may have done it.
This sample solution is poorly written and have multiple places to improve. The goal of this assignment is to revise the sample code for improved maintainability and readability.
Refactoring Improving Code Maintainability without changing the functionalities of the program
Task 1 Function Encapsulation
The sample solution contains a ludicrous number of copy-and-paste code segments. Encapsulate them into functions and call them using some sort of repetition control structure.
Task 2 No Magic Number
Some parameters in the code are obviously constants that would affect the overall behavior of the program. Separate them out using proper pre-processor constant definition, so that you can easily find them and change them in bulk.
Task 3 Traceable Exit Point
The main program loop appears to be an infinite loop. Youd have to read hard to find where the exit condition is located. Do something so that the while loop deploys a very clear exit condition for ease of management.
Deliverables (Total 40 Marks)
- Task 1 (10 marks)
- Task 2 (10 marks)
- Task 3 (10 marks)
- Proper comments to explain the relevant refactoring approach and how they improve the code maintainability. (10 marks)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started