CSC/ECE 517 Spring 2023 -E2326 Refactor questionnaires controller.rb: Difference between revisions

From Expertiza_Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 5: Line 5:


In Expertiza, Questionnaire is the superclass for all kinds of questionnaires and rubrics—rubrics for evaluating submissions and teammate contributions, and taking quizzes and surveys.  All of these are subclasses of Questionnaire.  questionnaires_controller.rb is charged with creating, displaying, and managing Questionnaires.  Because it is used so widely, malfunctions could cause bugs in many parts of the system; hence it is especially important that the code be clear.
In Expertiza, Questionnaire is the superclass for all kinds of questionnaires and rubrics—rubrics for evaluating submissions and teammate contributions, and taking quizzes and surveys.  All of these are subclasses of Questionnaire.  questionnaires_controller.rb is charged with creating, displaying, and managing Questionnaires.  Because it is used so widely, malfunctions could cause bugs in many parts of the system; hence it is especially important that the code be clear.
In recent years, questionnaires_controller.rb has been refactored repeatedly.  It is a lot clearer than it used to be.  But rough edges still remain.
In recent years, questionnaires_controller.rb has been refactored repeatedly.  It is a lot clearer than it used to be.  But rough edges still remain.
Please look at the comments I made on your code.  I think it can be simplified considerably.
Is it really necessary to use so many instance variables?  Would temporary variables suffice?
question.rb contains a large number of constants.  It is not clear what they are used for.
question.rb contains a large number of constants.  It is not clear what they are used for.
I have also made several comments about how the code could be made clearer.
There is a questionnaires_controller, but no questions_controller.  The questionnaires_controller creates Question objects.  This is not elegant, because a controller should only create objects of one type, the type of objects it controls.
There is a questionnaires_controller, but no questions_controller.  The questionnaires_controller creates Question objects.  This is not elegant, because a controller should only create objects of one type, the type of objects it controls.


Line 15: Line 13:
== Problem Statement ==
== Problem Statement ==


Problem statement


=== Summary of Work Needed ===
=== Summary of Work Needed ===


== Problems and planned changes ==
== Problems and planned changes ==
problems and planned changes


=== Work Completed ===
=== Work Completed ===


== Solutions to Problems ==
== Solutions to Problems ==
 
solution1
solution2
== Testing ==
== Testing ==
 
test1
test2
== Important links ==
== Important links ==
Link to Github

Revision as of 19:48, 8 April 2023

PROJECT OVERVIEW

Background

In Expertiza, Questionnaire is the superclass for all kinds of questionnaires and rubrics—rubrics for evaluating submissions and teammate contributions, and taking quizzes and surveys. All of these are subclasses of Questionnaire. questionnaires_controller.rb is charged with creating, displaying, and managing Questionnaires. Because it is used so widely, malfunctions could cause bugs in many parts of the system; hence it is especially important that the code be clear.

In recent years, questionnaires_controller.rb has been refactored repeatedly. It is a lot clearer than it used to be. But rough edges still remain. question.rb contains a large number of constants. It is not clear what they are used for. There is a questionnaires_controller, but no questions_controller. The questionnaires_controller creates Question objects. This is not elegant, because a controller should only create objects of one type, the type of objects it controls.


Problem Statement

Problem statement

Summary of Work Needed

Problems and planned changes

problems and planned changes

Work Completed

Solutions to Problems

solution1
solution2

Testing

test1
test2

Important links

Link to Github