CSC/ECE 517 Fall 2014/oss E1465 oak: Difference between revisions
No edit summary |
|||
Line 20: | Line 20: | ||
* Use of routing helpers instead of hardcoded URLs | * Use of routing helpers instead of hardcoded URLs | ||
* Replace find_by with where to follow Rails 4.0 conventions | * Replace find_by with where to follow Rails 4.0 conventions | ||
==Modification to Existing Code== | |||
=== Modifications to users_controller.rb === | |||
=== Modifications to index.html.erb === | |||
==References== | ==References== | ||
<references/><br> | <references/><br> |
Revision as of 01:55, 25 October 2014
Expertiza - Refactoring UsersController
Introduction
Expertiza<ref name="expertiza>Expertiza http://wikis.lib.ncsu.edu/index.php/Expertiza</ref> is a web application available to both students and professors. The Expertiza project is a system to create reusable learning objects through peer review. Expertiza supports team projects, and the submission of almost any document type, including URLs and wiki pages. Students can keep a track of their assignments, teammates and can conduct peer reviews on diverse topics and projects. It is an open source project developed on Ruby on Rails platform. More information on Expertiza can be found here. The source code can be forked and cloned for making modifications.
As a part of the coursework of Object Oriented Design and Development, we were expected to refactor the funtionality of some modules of Expertiza. This wiki provides an insight into our contributions to the Open Source Software project Expertiza with main focus of Refactoring the Users Controller.
Project Description
The Users Controller deals with managing activities peripheral to the User registered with Expertiza. Users are mapped to different roles like super-admin, admin, instructor, teaching assistant and student with each role having different access permissions. The Manage Users module can be accessed by roles other than the student. It provides users with the functionality to search other users based on keywords like username, email, etc. New user can be created and existing user information and role can be updated.
Classes : users_controller.rb
What it does : Manage Users i.e.search and list users, create new user, edit/update existing users, delete users.
What has to be changed :
- Modify methods to conform to RESTful style
- Refactor code such that it follows Ruby Conventions for Collection Objects like Arrays and Hashes
- Reducing the number of instance variables per action to one
- Code cleansing by removing commented out code, Using string interpolation instead of concatenation, Use of eql? instead of == and replacing :key =>'value' with key: 'value'
- Use of routing helpers instead of hardcoded URLs
- Replace find_by with where to follow Rails 4.0 conventions
Modification to Existing Code
Modifications to users_controller.rb
Modifications to index.html.erb
References
<references/>