CSC/ECE 517 Fall 2015/oss E1559 rrz: Difference between revisions

From Expertiza_Wiki
Jump to navigation Jump to search
No edit summary
Line 1: Line 1:
==== E1559: Refactoring JoinTeamRequestsController and InvitationController classes  ====
== E1559: Refactoring JoinTeamRequestsController and InvitationController classes  ==
This page gives a breif description on the expertiza based oss project that aimed at refactoring JoinTeamRequestController.rb and InvitationController.rb classes so that they follow the DRY principle and Ruby on Rails coding practices.
This page gives a breif description on the expertiza based oss project that aimed at refactoring JoinTeamRequestController.rb and InvitationController.rb classes so that they follow the DRY principle and Ruby on Rails coding practices.


==== Code Refactoring ====
== Code Refactoring ==
Code refactoring is process of changing the code to make it more maintainable, without changing the functionality of the code. Some of the reasons for performing refactoring are:
Code refactoring is process of changing the code to make it more maintainable, without changing the functionality of the code. Some of the reasons for performing refactoring are:
* To remove duplicate code.
* To make the code more maintainable.
*To divide functionality of the class


-> To remove duplicate code.
== Introduction to Expertiza  ==
Expertiza is a web application where students can submit and review learning objects like code, writings, etc. It gives scope for creation of reusable learning objects. Students submit assignments, which can than graded through peer reviews. The Expertiza project is supported by the National Science Foundation.


-> To make the code more maintainable.
== Problem Statement ==
==== Classes involved==== 
JoinTeamRequestsController.rb and InvitationController.rb


-> To divide functionality of the class
====What the controller does====
InvitationController.rb is used by a user to invite other users to join his/her team. It performs validation before creating a request. Now, invited user can accept or reject the request.
JoinTeamRequestsController.rb is used when user decides to join a team.


==== Introduction to Expertiza  ====
==== What's wrong with the code ====
Expertiza is a web application where students can submit and review learning objects like code, writings, etc. It gives scope for creation of reusable learning objects. Students submit assignments, which can than graded through peer reviews. The Expertiza project is supported by the National Science Foundation.
The InvitationController.rb is doing the required task but it is difficult to understand the code, hence it becomes difficult to maintain the code. And the functions in the accept and create method can be broken down into separate methods.
In JoinTeamRequestController.rb has duplicate code in various methods which can be removed by creating a seperate method for this common code.
 
==== What needs to be done ====
'''InvitationController.rb'''
*Rename to invitation_controller.rb, as is not in accordance with current naming convention.
*Add comments explaining what each method does, and comments on how important variables are used as currently there are no comments.
*Refactor create and accept methods.  Shorten and clarify them by adding private methods, as create and accept methods currently have a lot of code.

Revision as of 05:12, 31 October 2015

E1559: Refactoring JoinTeamRequestsController and InvitationController classes

This page gives a breif description on the expertiza based oss project that aimed at refactoring JoinTeamRequestController.rb and InvitationController.rb classes so that they follow the DRY principle and Ruby on Rails coding practices.

Code Refactoring

Code refactoring is process of changing the code to make it more maintainable, without changing the functionality of the code. Some of the reasons for performing refactoring are:

  • To remove duplicate code.
  • To make the code more maintainable.
  • To divide functionality of the class

Introduction to Expertiza

Expertiza is a web application where students can submit and review learning objects like code, writings, etc. It gives scope for creation of reusable learning objects. Students submit assignments, which can than graded through peer reviews. The Expertiza project is supported by the National Science Foundation.

Problem Statement

Classes involved

JoinTeamRequestsController.rb and InvitationController.rb

What the controller does

InvitationController.rb is used by a user to invite other users to join his/her team. It performs validation before creating a request. Now, invited user can accept or reject the request. JoinTeamRequestsController.rb is used when user decides to join a team.

What's wrong with the code

The InvitationController.rb is doing the required task but it is difficult to understand the code, hence it becomes difficult to maintain the code. And the functions in the accept and create method can be broken down into separate methods. In JoinTeamRequestController.rb has duplicate code in various methods which can be removed by creating a seperate method for this common code.

What needs to be done

InvitationController.rb

  • Rename to invitation_controller.rb, as is not in accordance with current naming convention.
  • Add comments explaining what each method does, and comments on how important variables are used as currently there are no comments.
  • Refactor create and accept methods. Shorten and clarify them by adding private methods, as create and accept methods currently have a lot of code.