CSC/ECE 517 Spring 2023 - E2316. Reimplement sign up sheet controller.rb

From Expertiza_Wiki
Revision as of 22:39, 21 March 2023 by Tprabhu2 (talk | contribs) (Initial draft)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Expertiza Overview

Project Overview

The signup_sheet_controller in expertiza is responsible for managing the signup sheet for an assignment. The controller includes functions to add, edit, and delete topics for the assignment, as well as perform team and deadline management functions. One important feature of the signup sheet is the ability for teams to sign up for topics. The controller includes methods to handle this functionality, including checking if there are available slots for a particular topic, adding the team to the waitlist if there are no available slots, and updating the signup sheet accordingly. In addition to signing up for topics, teams also have the ability to drop a topic. If a team drops a topic and there are teams on the waitlist for that topic, the first team on the waitlist (based on the creation date) will be automatically signed up for the topic. The controller includes methods to populate the objects needed for the signup sheet for a particular assignment. This could include retrieving information about the assignment, the topics, and the teams that have signed up for each topic. Most importantly, only instructors can create, update and delete the topics.

Our task is to reimplement these major functionalities for signing up topics and teams in Rails API which will then be consumed by a React based frontend. The current business logic in the controller is complex and involves multiple things in a single function which contradicts Single-Responsibility principle. In this project, in the first phase, we decided to work on simplifying the logic and extracting only the required functionalities which are being currently used extensively.

Design Decisions

Split the signup_sheet controller into signup_teams controller and signup_topics controller

Splitting a monolithic controller into multiple controllers can help to isolate specific areas of functionality. This can make the codebase easier to navigate and modify in the future. Smaller controllers can often lead to better performance, especially in cases where the original monolithic controller is handling too much traffic or too many requests at once. Splitting the controller into smaller, more focused controllers can help to distribute traffic more evenly and improve overall application performance. By breaking down a monolithic controller into smaller controllers, we can create more focused unit tests that can help to catch bugs and improve overall code quality. When multiple developers are working on a project, it can be easier to collaborate when the codebase is split into smaller, more focused controllers.


Move business logic from controller to Model

The Model-View-Controller (MVC) design pattern separates the application into three main components: models, views, and controllers. The controller's job is to handle user input and interaction, while the model's job is to represent the data and perform operations on it. By moving the business logic to the models, we can achieve a better separation of concerns and keep the controller's responsibility limited to handling user input. Moving the business logic to the models can also improve the scalability of the application. By separating the business logic from the controller, we can avoid having a monolithic controller that performs many different operations (which was the case for earlier expertiza implementation). This can help to improve performance and make the application more scalable.


Delete irrelevant/redundant methods from the controller

Controllers are responsible for handling incoming requests and managing the flow of data between the model and the view. If a controller has methods that are not being used or are redundant, it can make the codebase harder to navigate and more difficult to maintain. Deleting unused or redundant methods from a controller can help to simplify the codebase and reduce the risk of errors. It can also make it easier for other developers to understand the code and make changes to it in the future.


Testing

Signup_sheet controller Create Read Update Delete

Signup_topics controller Create Read Update Delete


Future Work