CSC/ECE 517 Fall 2023 - E2374. Reimplement the Question hierarchy

From Expertiza_Wiki
Jump to navigation Jump to search

This wiki page is for the description of changes made under E2367 OSS assignment for Fall 2023, CSC/ECE 517

Expertiza

Expertiza is an open-source project built using Ruby on Rails. It provides a platform for instructors and students to manage, submit, and evaluate assignments and projects. Instructors can create, edit, and grade assignments, while students can collaborate in teams, submit their work, and review peers' submissions.

Problem statement

The current implementation of the question hierarchy within Expertiza contains unclear variable, method names and incomplete functionality at certain places. Additionally, many methods produce complex and lengthy HTML strings, making the codebase difficult to maintain. Objective: The project aims to enhance the question hierarchy component to improve code readability, comprehensibility, and maintainability.

Question Hierarchy

The hierarchy implemented by the previous team was unclear. The UML diagram given by them in the documentation did not resonate with the implementation. We have modified it accordingly. Expertiza's question hierarchy organizes rubric items, quiz questions, and survey questions using the following structure:

  • Questions
    • ScoredQuestion
      • Scale
      • Criterion
    • UnscoredQuestion
      • Dropdown
    • QuizQuestion
      • MultipleChoiceCheckbox
      • MultipleChoiceRadio
    • TextResponse
      • TextArea
      • TextField
    • UploadFile

Files Modified

Several files required migration from the previous repository to ensure the functionality of the models. During this process, we found it necessary to deactivate a substantial portion of the code. Numerous file interdependencies were discovered, particularly concerning questionnaires and questions. We made diligent efforts to streamline these interdependencies, aligning them with the objectives of our project. The following is a list of files that were modified or added as a part of the reimplementation:

criterion.rb
dropdown.rb
scale.rb
schema.rb
criterion_spec.rd
scale_spec.rb
dropdown_spec.tb
text_area_spec.rb
text_field.rb
upload_file.rb
text_response.rb
scored_question.rb
unscored_question.rb
questionnaire.rb
question.rb
quiz_question.rb
quiz_question_choice.rb
multiple_choice_checkbox.rb
multiple_choice_radio.rb
_form.html.erb
_form_fields.html.erb
_edit.html.erb
_view_question_text.html.erb
_edit_multi_checkbox.html.erb
_edit_multi_radio.html.erb
upload_file_spec.rb
text_field_spec.rb
multiple_choice_radio_spec.rb
multiple_choice_checkbox_spec.rb

Reimplementation

As part of our reimplementation project, we performed several actions. We created migrations, added old code files, and included partials in these old code files to avoid joining HTML strings together. We noticed that the Question hierarchy often used HTML string joining to create views. We've also added several "views" files to make use of partials to reduce repetitive code and make it easier to manage in the future while implementing the rest of the Rails application. This helps keep the code neat and simplifies maintenance for future tasks.

Reimplemented Repository[1]

Testing plan

In our testing strategy, we rigorously examined the reimplementation by focusing on key aspects of the code. Our test suite was designed to validate the modified models in question hierarchy, ensuring their functionality. We also verify that essential methods are correctly defined within the model class to ensure that core functionality is present. These methods are essential for the model's proper operation and should be validated for their existence.

We scrutinized the model's functionality in generating HTML strings for various parameters, assessed the correctness of the underlying methods, and verified their ability to produce HTML code for different scenarios. Furthermore, we assessed the handling of various question types, and the generation of HTML representations for completed and unanswered questions. These tests, coupled with general model validations, form a robust testing framework that guarantees the reimplementation's integrity and adherence to the project's goals.

Additionally, testing the rendering of HTML or partial templates, wherever applicable, are incorporated to confirm the correct generation of views. This step ensures that the model can produce the expected output for presentation. A comprehensive testing plan involves a combination of method definition checks, logic validation, and HTML rendering tests to ensure the model's integrity and functionality. The plan also includes testing the business logic within the model, such as validation methods. This includes validating the correctness ensuring that the model behaves as expected under different conditions. Our RSpec-driven approach ensures that the code behaves as expected and enhances its maintainability and readability while reducing complexities associated with the previous implementation.

Next steps

  • Partial Removal: We plan to streamline the code further by removing unnecessary partials. After a careful analysis, we realized that each question type has its distinct functionality, making partials redundant in this particular enhancement. Removing them will simplify the codebase and improve maintainability.
  • JSON Object Return: As a step towards enhancing data handling, we intend to return variables in the form of JSON objects. This transition will facilitate data interchange and enhance compatibility with modern web applications, promoting efficient communication and data representation.
  • Continued Testing: Given the critical role of testing in this project, our focus will remain on developing comprehensive test cases for the code changes. Ongoing testing ensures the reliability and robustness of the reimplementation, addressing potential issues and maintaining the code's integrity.

Team

  • Mentors
    • Prof. Edward F. Gehringer
    • Muhammad Ali Qureshi
  • Members
    • Ishika Gandhi
    • Rishi Dange
    • Skanda Shastry

References

  • Expertiza[2]
  • Previous team repository[3]
  • Active Record Migrations[4]
  • Migrating changes made on model[5]
  • Layouts and Rendering in Rails[6]
  • RSpec Testing[7]

Links

  • Project Board[8]
  • Github repo[9]
  • Link to initial pull request[10]