<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.expertiza.ncsu.edu/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Eblumpki2</id>
	<title>Expertiza_Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.expertiza.ncsu.edu/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Eblumpki2"/>
	<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=Special:Contributions/Eblumpki2"/>
	<updated>2026-05-21T16:05:19Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.41.0</generator>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2013/OSS_E605A&amp;diff=73895</id>
		<title>CSC/ECE 517 Spring 2013/OSS E605A</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2013/OSS_E605A&amp;diff=73895"/>
		<updated>2013-03-18T19:45:15Z</updated>

		<summary type="html">&lt;p&gt;Eblumpki2: Added references&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Expertiza Questionnaire Refactoring=&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=Introduction=&lt;br /&gt;
&lt;br /&gt;
This project involved refactoring the questionnaire portion of Expertiza. This part of the Expertiza project deals with the creation and management of questionnaires that are used during project review and feedback. It also allows for the creation of advice on what each score in a question should represent (a 5 being excellent, 3 being average, etc.). The majority of the refactoring took place in the file questionnaire_controller.rb, as it contains the CRUD functionality for questionnaires. Some refactoring also took place on the questionnaire.rb model, along with various different kinds of questionnaires that were represented as subclasses of questionnaire.rb.&lt;br /&gt;
&lt;br /&gt;
=List of Changes=&lt;br /&gt;
&lt;br /&gt;
Following is a list of the changes made during refactoring, along with the design principles and patterns that were upheld by making these changes.&lt;br /&gt;
&lt;br /&gt;
==Pulled up get_weighted_score==&lt;br /&gt;
&lt;br /&gt;
Each of the questionnaire subclasses had a get_weighted_score method that tallied up the points for a completed questionnaire. These methods were all identical, so we pulled the method up to the questionnaire superclass (questionnaire.rb). The following subclasses had the method and were refactored accordingly:&lt;br /&gt;
&lt;br /&gt;
* author_feedback_questionnaire.rb&lt;br /&gt;
* metareview_questionnaire.rb&lt;br /&gt;
* review_questionnaire.rb&lt;br /&gt;
* teammate_review_questionnaire.rb&lt;br /&gt;
* questionnaire.rb (superclass that the method was moved to)&lt;br /&gt;
&lt;br /&gt;
The main design principle that influenced this refactor was DRY. As the same functionality was used in multiple places, moving it to the superclass made the code easier to understand by showing that all of the subclasses were able to use the function in the same way.&lt;br /&gt;
&lt;br /&gt;
==Renamed create_questionnaire and save_questionnaire==&lt;br /&gt;
&lt;br /&gt;
The questionnaire_controller (questionnaire_controller.rb) contained CRUD functionality for several types of objects. Naturally, one of these objects was a questionnaire. For clarity, its methods had been named create_questionnaire and save_questionnaire. However, proper Ruby design emphasizes convention over configuration. Since the methods were in the questionnaire controller, the convention is to name them create and save, as the fact that they affect a questionnaire is implied. Therefore create_questionnaire (on line 156) was changed to create and save_questionnaire (on line 214) was changed to save.&lt;br /&gt;
&lt;br /&gt;
==Pulled methods from edit==&lt;br /&gt;
&lt;br /&gt;
The edit method in questionnaire_controller.rb did not need to be renamed, but it had another problem; the method was too long. Keeping methods short (around 25 lines or less) is another design principle that increases the readability of code. Therefore, we looked for chunks of the method that would make sense if pulled out as a separate method. Part of the edit method involved exporting and importing questionnaires. These chunks of code were well contained, with clear start and stop points, so we pulled them into separate methods. This resulted in creating an export method from lines 102-108 of the old edit method, and an import method from lines 110-125 of the old method. By doing this, the edit method was shortened to an acceptable length.&lt;br /&gt;
&lt;br /&gt;
==Created advice_controller==&lt;br /&gt;
&lt;br /&gt;
As mentioned above, the questionnaire controller contained some CRUD methods that dealt with another type of object besides questionnaires. This was the advice object, which is used to type notes regarding what score should be given on a question. Again, this violated the Ruby principle of convention over configuration, since these advice methods were in the questionnaire controller. Therefore, a new advice controller (advice_controller.rb) was created, and the edit_advice and save_advice methods were moved from the questionnaire controller to it.&lt;br /&gt;
&lt;br /&gt;
==Removed delete_question_type==&lt;br /&gt;
&lt;br /&gt;
The questionnaire_controller had a delete_question_type method that was only used when destroying the questions of a questionnaire. As it only consisted of two lines, and was only used in one place, we felt that having it in a separate method caused a minor, but unnecessary, case of the Ping-Pong effect. Since the code of the method was rather self-explanatory (simply finding the question type of the question to be deleted and destroying it), moving the functionality back into the delete_questions method and removing the delete_question_type method reduced the complexity of the code without affecting its readability or DRYness.&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
&lt;br /&gt;
* [https://www.youtube.com/watch?v=XZzKb_PM07A Project Screencast]&lt;br /&gt;
* [https://github.com/expertiza/expertiza Main Expertiza Repository]&lt;br /&gt;
* [https://github.com/mlhall3/expertiza Refactored Expertiza Fork]&lt;/div&gt;</summary>
		<author><name>Eblumpki2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2013/OSS_E605A&amp;diff=73894</id>
		<title>CSC/ECE 517 Spring 2013/OSS E605A</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2013/OSS_E605A&amp;diff=73894"/>
		<updated>2013-03-18T19:40:23Z</updated>

		<summary type="html">&lt;p&gt;Eblumpki2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Expertiza Questionnaire Refactoring=&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=Introduction=&lt;br /&gt;
&lt;br /&gt;
This project involved refactoring the questionnaire portion of Expertiza. This part of the Expertiza project deals with the creation and management of questionnaires that are used during project review and feedback. It also allows for the creation of advice on what each score in a question should represent (a 5 being excellent, 3 being average, etc.). The majority of the refactoring took place in the file questionnaire_controller.rb, as it contains the CRUD functionality for questionnaires. Some refactoring also took place on the questionnaire.rb model, along with various different kinds of questionnaires that were represented as subclasses of questionnaire.rb.&lt;br /&gt;
&lt;br /&gt;
=List of Changes=&lt;br /&gt;
&lt;br /&gt;
Following is a list of the changes made during refactoring, along with the design principles and patterns that were upheld by making these changes.&lt;br /&gt;
&lt;br /&gt;
==Pulled up get_weighted_score==&lt;br /&gt;
&lt;br /&gt;
Each of the questionnaire subclasses had a get_weighted_score method that tallied up the points for a completed questionnaire. These methods were all identical, so we pulled the method up to the questionnaire superclass (questionnaire.rb). The following subclasses had the method and were refactored accordingly:&lt;br /&gt;
&lt;br /&gt;
* author_feedback_questionnaire.rb&lt;br /&gt;
* metareview_questionnaire.rb&lt;br /&gt;
* review_questionnaire.rb&lt;br /&gt;
* teammate_review_questionnaire.rb&lt;br /&gt;
* questionnaire.rb (superclass that the method was moved to)&lt;br /&gt;
&lt;br /&gt;
The main design principle that influenced this refactor was DRY. As the same functionality was used in multiple places, moving it to the superclass made the code easier to understand by showing that all of the subclasses were able to use the function in the same way.&lt;br /&gt;
&lt;br /&gt;
==Renamed create_questionnaire and save_questionnaire==&lt;br /&gt;
&lt;br /&gt;
The questionnaire_controller (questionnaire_controller.rb) contained CRUD functionality for several types of objects. Naturally, one of these objects was a questionnaire. For clarity, its methods had been named create_questionnaire and save_questionnaire. However, proper Ruby design emphasizes convention over configuration. Since the methods were in the questionnaire controller, the convention is to name them create and save, as the fact that they affect a questionnaire is implied. Therefore create_questionnaire (on line 156) was changed to create and save_questionnaire (on line 214) was changed to save.&lt;br /&gt;
&lt;br /&gt;
==Pulled methods from edit==&lt;br /&gt;
&lt;br /&gt;
The edit method in questionnaire_controller.rb did not need to be renamed, but it had another problem; the method was too long. Keeping methods short (around 25 lines or less) is another design principle that increases the readability of code. Therefore, we looked for chunks of the method that would make sense if pulled out as a separate method. Part of the edit method involved exporting and importing questionnaires. These chunks of code were well contained, with clear start and stop points, so we pulled them into separate methods. This resulted in creating an export method from lines 102-108 of the old edit method, and an import method from lines 110-125 of the old method. By doing this, the edit method was shortened to an acceptable length.&lt;br /&gt;
&lt;br /&gt;
==Created advice_controller==&lt;br /&gt;
&lt;br /&gt;
As mentioned above, the questionnaire controller contained some CRUD methods that dealt with another type of object besides questionnaires. This was the advice object, which is used to type notes regarding what score should be given on a question. Again, this violated the Ruby principle of convention over configuration, since these advice methods were in the questionnaire controller. Therefore, a new advice controller (advice_controller.rb) was created, and the edit_advice and save_advice methods were moved from the questionnaire controller to it.&lt;br /&gt;
&lt;br /&gt;
==Removed delete_question_type==&lt;br /&gt;
&lt;br /&gt;
The questionnaire_controller had a delete_question_type method that was only used when destroying the questions of a questionnaire. As it only consisted of two lines, and was only used in one place, we felt that having it in a separate method caused a minor, but unnecessary, case of the Ping-Pong effect. Since the code of the method was rather self-explanatory (simply finding the question type of the question to be deleted and destroying it), moving the functionality back into the delete_questions method and removing the delete_question_type method reduced the complexity of the code without affecting its readability or DRYness.&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
&lt;br /&gt;
* [http://www.youtube.com/embed/XZzKb_PM07A Project Screencast]&lt;/div&gt;</summary>
		<author><name>Eblumpki2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2013/OSS_E605A&amp;diff=73893</id>
		<title>CSC/ECE 517 Spring 2013/OSS E605A</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2013/OSS_E605A&amp;diff=73893"/>
		<updated>2013-03-18T19:40:07Z</updated>

		<summary type="html">&lt;p&gt;Eblumpki2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Expertiza Questionnaire Refactoring=&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=Introduction=&lt;br /&gt;
&lt;br /&gt;
This project involved refactoring the questionnaire portion of Expertiza. This part of the Expertiza project deals with the creation and management of questionnaires that are used during project review and feedback. It also allows for the creation of advice on what each score in a question should represent (a 5 being excellent, 3 being average, etc.). The majority of the refactoring took place in the file questionnaire_controller.rb, as it contains the CRUD functionality for questionnaires. Some refactoring also took place on the questionnaire.rb model, along with various different kinds of questionnaires that were represented as subclasses of questionnaire.rb.&lt;br /&gt;
&lt;br /&gt;
=List of Changes=&lt;br /&gt;
&lt;br /&gt;
Following is a list of the changes made during refactoring, along with the design principles and patterns that were upheld by making these changes.&lt;br /&gt;
&lt;br /&gt;
==Pulled up get_weighted_score==&lt;br /&gt;
&lt;br /&gt;
Each of the questionnaire subclasses had a get_weighted_score method that tallied up the points for a completed questionnaire. These methods were all identical, so we pulled the method up to the questionnaire superclass (questionnaire.rb). The following subclasses had the method and were refactored accordingly:&lt;br /&gt;
&lt;br /&gt;
* author_feedback_questionnaire.rb&lt;br /&gt;
* metareview_questionnaire.rb&lt;br /&gt;
* review_questionnaire.rb&lt;br /&gt;
* teammate_review_questionnaire.rb&lt;br /&gt;
* questionnaire.rb (superclass that the method was moved to)&lt;br /&gt;
&lt;br /&gt;
The main design principle that influenced this refactor was DRY. As the same functionality was used in multiple places, moving it to the superclass made the code easier to understand by showing that all of the subclasses were able to use the function in the same way.&lt;br /&gt;
&lt;br /&gt;
==Renamed create_questionnaire and save_questionnaire==&lt;br /&gt;
&lt;br /&gt;
The questionnaire_controller (questionnaire_controller.rb) contained CRUD functionality for several types of objects. Naturally, one of these objects was a questionnaire. For clarity, its methods had been named create_questionnaire and save_questionnaire. However, proper Ruby design emphasizes convention over configuration. Since the methods were in the questionnaire controller, the convention is to name them create and save, as the fact that they affect a questionnaire is implied. Therefore create_questionnaire (on line 156) was changed to create and save_questionnaire (on line 214) was changed to save.&lt;br /&gt;
&lt;br /&gt;
==Pulled methods from edit==&lt;br /&gt;
&lt;br /&gt;
The edit method in questionnaire_controller.rb did not need to be renamed, but it had another problem; the method was too long. Keeping methods short (around 25 lines or less) is another design principle that increases the readability of code. Therefore, we looked for chunks of the method that would make sense if pulled out as a separate method. Part of the edit method involved exporting and importing questionnaires. These chunks of code were well contained, with clear start and stop points, so we pulled them into separate methods. This resulted in creating an export method from lines 102-108 of the old edit method, and an import method from lines 110-125 of the old method. By doing this, the edit method was shortened to an acceptable length.&lt;br /&gt;
&lt;br /&gt;
==Created advice_controller==&lt;br /&gt;
&lt;br /&gt;
As mentioned above, the questionnaire controller contained some CRUD methods that dealt with another type of object besides questionnaires. This was the advice object, which is used to type notes regarding what score should be given on a question. Again, this violated the Ruby principle of convention over configuration, since these advice methods were in the questionnaire controller. Therefore, a new advice controller (advice_controller.rb) was created, and the edit_advice and save_advice methods were moved from the questionnaire controller to it.&lt;br /&gt;
&lt;br /&gt;
==Removed delete_question_type==&lt;br /&gt;
&lt;br /&gt;
The questionnaire_controller had a delete_question_type method that was only used when destroying the questions of a questionnaire. As it only consisted of two lines, and was only used in one place, we felt that having it in a separate method caused a minor, but unnecessary, case of the Ping-Pong effect. Since the code of the method was rather self-explanatory (simply finding the question type of the question to be deleted and destroying it), moving the functionality back into the delete_questions method and removing the delete_question_type method reduced the complexity of the code without affecting its readability or DRYness.&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
&lt;br /&gt;
* [http://www.youtube.com/embed/XZzKb_PM07A | Project Screencast]&lt;/div&gt;</summary>
		<author><name>Eblumpki2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2013/OSS_E605A&amp;diff=73892</id>
		<title>CSC/ECE 517 Spring 2013/OSS E605A</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2013/OSS_E605A&amp;diff=73892"/>
		<updated>2013-03-18T19:39:50Z</updated>

		<summary type="html">&lt;p&gt;Eblumpki2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Expertiza Questionnaire Refactoring=&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=Introduction=&lt;br /&gt;
&lt;br /&gt;
This project involved refactoring the questionnaire portion of Expertiza. This part of the Expertiza project deals with the creation and management of questionnaires that are used during project review and feedback. It also allows for the creation of advice on what each score in a question should represent (a 5 being excellent, 3 being average, etc.). The majority of the refactoring took place in the file questionnaire_controller.rb, as it contains the CRUD functionality for questionnaires. Some refactoring also took place on the questionnaire.rb model, along with various different kinds of questionnaires that were represented as subclasses of questionnaire.rb.&lt;br /&gt;
&lt;br /&gt;
=List of Changes=&lt;br /&gt;
&lt;br /&gt;
Following is a list of the changes made during refactoring, along with the design principles and patterns that were upheld by making these changes.&lt;br /&gt;
&lt;br /&gt;
==Pulled up get_weighted_score==&lt;br /&gt;
&lt;br /&gt;
Each of the questionnaire subclasses had a get_weighted_score method that tallied up the points for a completed questionnaire. These methods were all identical, so we pulled the method up to the questionnaire superclass (questionnaire.rb). The following subclasses had the method and were refactored accordingly:&lt;br /&gt;
&lt;br /&gt;
* author_feedback_questionnaire.rb&lt;br /&gt;
* metareview_questionnaire.rb&lt;br /&gt;
* review_questionnaire.rb&lt;br /&gt;
* teammate_review_questionnaire.rb&lt;br /&gt;
* questionnaire.rb (superclass that the method was moved to)&lt;br /&gt;
&lt;br /&gt;
The main design principle that influenced this refactor was DRY. As the same functionality was used in multiple places, moving it to the superclass made the code easier to understand by showing that all of the subclasses were able to use the function in the same way.&lt;br /&gt;
&lt;br /&gt;
==Renamed create_questionnaire and save_questionnaire==&lt;br /&gt;
&lt;br /&gt;
The questionnaire_controller (questionnaire_controller.rb) contained CRUD functionality for several types of objects. Naturally, one of these objects was a questionnaire. For clarity, its methods had been named create_questionnaire and save_questionnaire. However, proper Ruby design emphasizes convention over configuration. Since the methods were in the questionnaire controller, the convention is to name them create and save, as the fact that they affect a questionnaire is implied. Therefore create_questionnaire (on line 156) was changed to create and save_questionnaire (on line 214) was changed to save.&lt;br /&gt;
&lt;br /&gt;
==Pulled methods from edit==&lt;br /&gt;
&lt;br /&gt;
The edit method in questionnaire_controller.rb did not need to be renamed, but it had another problem; the method was too long. Keeping methods short (around 25 lines or less) is another design principle that increases the readability of code. Therefore, we looked for chunks of the method that would make sense if pulled out as a separate method. Part of the edit method involved exporting and importing questionnaires. These chunks of code were well contained, with clear start and stop points, so we pulled them into separate methods. This resulted in creating an export method from lines 102-108 of the old edit method, and an import method from lines 110-125 of the old method. By doing this, the edit method was shortened to an acceptable length.&lt;br /&gt;
&lt;br /&gt;
==Created advice_controller==&lt;br /&gt;
&lt;br /&gt;
As mentioned above, the questionnaire controller contained some CRUD methods that dealt with another type of object besides questionnaires. This was the advice object, which is used to type notes regarding what score should be given on a question. Again, this violated the Ruby principle of convention over configuration, since these advice methods were in the questionnaire controller. Therefore, a new advice controller (advice_controller.rb) was created, and the edit_advice and save_advice methods were moved from the questionnaire controller to it.&lt;br /&gt;
&lt;br /&gt;
==Removed delete_question_type==&lt;br /&gt;
&lt;br /&gt;
The questionnaire_controller had a delete_question_type method that was only used when destroying the questions of a questionnaire. As it only consisted of two lines, and was only used in one place, we felt that having it in a separate method caused a minor, but unnecessary, case of the Ping-Pong effect. Since the code of the method was rather self-explanatory (simply finding the question type of the question to be deleted and destroying it), moving the functionality back into the delete_questions method and removing the delete_question_type method reduced the complexity of the code without affecting its readability or DRYness.&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
&lt;br /&gt;
* [[http://www.youtube.com/embed/XZzKb_PM07A | Project Screencast]]&lt;/div&gt;</summary>
		<author><name>Eblumpki2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2013/OSS_E605A&amp;diff=73891</id>
		<title>CSC/ECE 517 Spring 2013/OSS E605A</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2013/OSS_E605A&amp;diff=73891"/>
		<updated>2013-03-18T19:35:47Z</updated>

		<summary type="html">&lt;p&gt;Eblumpki2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Expertiza Questionnaire Refactoring=&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=Introduction=&lt;br /&gt;
&lt;br /&gt;
This project involved refactoring the questionnaire portion of Expertiza. This part of the Expertiza project deals with the creation and management of questionnaires that are used during project review and feedback. It also allows for the creation of advice on what each score in a question should represent (a 5 being excellent, 3 being average, etc.). The majority of the refactoring took place in the file questionnaire_controller.rb, as it contains the CRUD functionality for questionnaires. Some refactoring also took place on the questionnaire.rb model, along with various different kinds of questionnaires that were represented as subclasses of questionnaire.rb.&lt;br /&gt;
&lt;br /&gt;
=List of Changes=&lt;br /&gt;
&lt;br /&gt;
Following is a list of the changes made during refactoring, along with the design principles and patterns that were upheld by making these changes.&lt;br /&gt;
&lt;br /&gt;
==Pulled up get_weighted_score==&lt;br /&gt;
&lt;br /&gt;
Each of the questionnaire subclasses had a get_weighted_score method that tallied up the points for a completed questionnaire. These methods were all identical, so we pulled the method up to the questionnaire superclass (questionnaire.rb). The following subclasses had the method and were refactored accordingly:&lt;br /&gt;
&lt;br /&gt;
* author_feedback_questionnaire.rb&lt;br /&gt;
* metareview_questionnaire.rb&lt;br /&gt;
* review_questionnaire.rb&lt;br /&gt;
* teammate_review_questionnaire.rb&lt;br /&gt;
* questionnaire.rb (superclass that the method was moved to)&lt;br /&gt;
&lt;br /&gt;
The main design principle that influenced this refactor was DRY. As the same functionality was used in multiple places, moving it to the superclass made the code easier to understand by showing that all of the subclasses were able to use the function in the same way.&lt;br /&gt;
&lt;br /&gt;
==Renamed create_questionnaire and save_questionnaire==&lt;br /&gt;
&lt;br /&gt;
The questionnaire_controller (questionnaire_controller.rb) contained CRUD functionality for several types of objects. Naturally, one of these objects was a questionnaire. For clarity, its methods had been named create_questionnaire and save_questionnaire. However, proper Ruby design emphasizes convention over configuration. Since the methods were in the questionnaire controller, the convention is to name them create and save, as the fact that they affect a questionnaire is implied. Therefore create_questionnaire (on line 156) was changed to create and save_questionnaire (on line 214) was changed to save.&lt;br /&gt;
&lt;br /&gt;
==Pulled methods from edit==&lt;br /&gt;
&lt;br /&gt;
The edit method in questionnaire_controller.rb did not need to be renamed, but it had another problem; the method was too long. Keeping methods short (around 25 lines or less) is another design principle that increases the readability of code. Therefore, we looked for chunks of the method that would make sense if pulled out as a separate method. Part of the edit method involved exporting and importing questionnaires. These chunks of code were well contained, with clear start and stop points, so we pulled them into separate methods. This resulted in creating an export method from lines 102-108 of the old edit method, and an import method from lines 110-125 of the old method. By doing this, the edit method was shortened to an acceptable length.&lt;br /&gt;
&lt;br /&gt;
==Created advice_controller==&lt;br /&gt;
&lt;br /&gt;
As mentioned above, the questionnaire controller contained some CRUD methods that dealt with another type of object besides questionnaires. This was the advice object, which is used to type notes regarding what score should be given on a question. Again, this violated the Ruby principle of convention over configuration, since these advice methods were in the questionnaire controller. Therefore, a new advice controller (advice_controller.rb) was created, and the edit_advice and save_advice methods were moved from the questionnaire controller to it.&lt;br /&gt;
&lt;br /&gt;
==Removed delete_question_type==&lt;br /&gt;
&lt;br /&gt;
The questionnaire_controller had a delete_question_type method that was only used when destroying the questions of a questionnaire. As it only consisted of two lines, and was only used in one place, we felt that having it in a separate method caused a minor, but unnecessary, case of the Ping-Pong effect. Since the code of the method was rather self-explanatory (simply finding the question type of the question to be deleted and destroying it), moving the functionality back into the delete_questions method and removing the delete_question_type method reduced the complexity of the code without affecting its readability or DRYness.&lt;br /&gt;
&lt;br /&gt;
=Screencast=&lt;br /&gt;
&lt;br /&gt;
&amp;lt;iframe width=&amp;quot;420&amp;quot; height=&amp;quot;315&amp;quot; src=&amp;quot;http://www.youtube.com/embed/XZzKb_PM07A&amp;quot; frameborder=&amp;quot;0&amp;quot; allowfullscreen&amp;gt;&amp;lt;/iframe&amp;gt;&lt;/div&gt;</summary>
		<author><name>Eblumpki2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2013/OSS_E605A&amp;diff=73890</id>
		<title>CSC/ECE 517 Spring 2013/OSS E605A</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2013/OSS_E605A&amp;diff=73890"/>
		<updated>2013-03-18T19:32:18Z</updated>

		<summary type="html">&lt;p&gt;Eblumpki2: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Expertiza Questionnaire Refactoring=&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=Introduction=&lt;br /&gt;
&lt;br /&gt;
This project involved refactoring the questionnaire portion of Expertiza. This part of the Expertiza project deals with the creation and management of questionnaires that are used during project review and feedback. It also allows for the creation of advice on what each score in a question should represent (a 5 being excellent, 3 being average, etc.). The majority of the refactoring took place in the file questionnaire_controller.rb, as it contains the CRUD functionality for questionnaires. Some refactoring also took place on the questionnaire.rb model, along with various different kinds of questionnaires that were represented as subclasses of questionnaire.rb.&lt;br /&gt;
&lt;br /&gt;
=List of Changes=&lt;br /&gt;
&lt;br /&gt;
Following is a list of the changes made during refactoring, along with the design principles and patterns that were upheld by making these changes.&lt;br /&gt;
&lt;br /&gt;
==Pulled up get_weighted_score==&lt;br /&gt;
&lt;br /&gt;
Each of the questionnaire subclasses had a get_weighted_score method that tallied up the points for a completed questionnaire. These methods were all identical, so we pulled the method up to the questionnaire superclass (questionnaire.rb). The following subclasses had the method and were refactored accordingly:&lt;br /&gt;
&lt;br /&gt;
* author_feedback_questionnaire.rb&lt;br /&gt;
* metareview_questionnaire.rb&lt;br /&gt;
* review_questionnaire.rb&lt;br /&gt;
* teammate_review_questionnaire.rb&lt;br /&gt;
* questionnaire.rb (superclass that the method was moved to)&lt;br /&gt;
&lt;br /&gt;
The main design principle that influenced this refactor was DRY. As the same functionality was used in multiple places, moving it to the superclass made the code easier to understand by showing that all of the subclasses were able to use the function in the same way.&lt;br /&gt;
&lt;br /&gt;
==Renamed create_questionnaire and save_questionnaire==&lt;br /&gt;
&lt;br /&gt;
The questionnaire_controller (questionnaire_controller.rb) contained CRUD functionality for several types of objects. Naturally, one of these objects was a questionnaire. For clarity, its methods had been named create_questionnaire and save_questionnaire. However, proper Ruby design emphasizes convention over configuration. Since the methods were in the questionnaire controller, the convention is to name them create and save, as the fact that they affect a questionnaire is implied. Therefore create_questionnaire (on line 156) was changed to create and save_questionnaire (on line 214) was changed to save.&lt;br /&gt;
&lt;br /&gt;
==Pulled methods from edit==&lt;br /&gt;
&lt;br /&gt;
The edit method in questionnaire_controller.rb did not need to be renamed, but it had another problem; the method was too long. Keeping methods short (around 25 lines or less) is another design principle that increases the readability of code. Therefore, we looked for chunks of the method that would make sense if pulled out as a separate method. Part of the edit method involved exporting and importing questionnaires. These chunks of code were well contained, with clear start and stop points, so we pulled them into separate methods. This resulted in creating an export method from lines 102-108 of the old edit method, and an import method from lines 110-125 of the old method. By doing this, the edit method was shortened to an acceptable length.&lt;br /&gt;
&lt;br /&gt;
==Created advice_controller==&lt;br /&gt;
&lt;br /&gt;
As mentioned above, the questionnaire controller contained some CRUD methods that dealt with another type of object besides questionnaires. This was the advice object, which is used to type notes regarding what score should be given on a question. Again, this violated the Ruby principle of convention over configuration, since these advice methods were in the questionnaire controller. Therefore, a new advice controller (advice_controller.rb) was created, and the edit_advice and save_advice methods were moved from the questionnaire controller to it.&lt;br /&gt;
&lt;br /&gt;
==Removed delete_question_type==&lt;br /&gt;
&lt;br /&gt;
The questionnaire_controller had a delete_question_type method that was only used when destroying the questions of a questionnaire. As it only consisted of two lines, and was only used in one place, we felt that having it in a separate method caused a minor, but unnecessary, case of the Ping-Pong effect. Since the code of the method was rather self-explanatory (simply finding the question type of the question to be deleted and destroying it), moving the functionality back into the delete_questions method and removing the delete_question_type method reduced the complexity of the code without affecting its readability or DRYness.&lt;br /&gt;
&lt;br /&gt;
=Screencast=&lt;br /&gt;
&lt;br /&gt;
{|youtube&amp;gt;XZzKb_PM07A&amp;lt;/youtube&amp;gt;}&lt;/div&gt;</summary>
		<author><name>Eblumpki2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2013/OSS_E605A&amp;diff=73889</id>
		<title>CSC/ECE 517 Spring 2013/OSS E605A</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2013/OSS_E605A&amp;diff=73889"/>
		<updated>2013-03-18T19:30:36Z</updated>

		<summary type="html">&lt;p&gt;Eblumpki2: Fixed embedded screencast (hopefully)&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Expertiza Questionnaire Refactoring=&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=Introduction=&lt;br /&gt;
&lt;br /&gt;
This project involved refactoring the questionnaire portion of Expertiza. This part of the Expertiza project deals with the creation and management of questionnaires that are used during project review and feedback. It also allows for the creation of advice on what each score in a question should represent (a 5 being excellent, 3 being average, etc.). The majority of the refactoring took place in the file questionnaire_controller.rb, as it contains the CRUD functionality for questionnaires. Some refactoring also took place on the questionnaire.rb model, along with various different kinds of questionnaires that were represented as subclasses of questionnaire.rb.&lt;br /&gt;
&lt;br /&gt;
=List of Changes=&lt;br /&gt;
&lt;br /&gt;
Following is a list of the changes made during refactoring, along with the design principles and patterns that were upheld by making these changes.&lt;br /&gt;
&lt;br /&gt;
==Pulled up get_weighted_score==&lt;br /&gt;
&lt;br /&gt;
Each of the questionnaire subclasses had a get_weighted_score method that tallied up the points for a completed questionnaire. These methods were all identical, so we pulled the method up to the questionnaire superclass (questionnaire.rb). The following subclasses had the method and were refactored accordingly:&lt;br /&gt;
&lt;br /&gt;
* author_feedback_questionnaire.rb&lt;br /&gt;
* metareview_questionnaire.rb&lt;br /&gt;
* review_questionnaire.rb&lt;br /&gt;
* teammate_review_questionnaire.rb&lt;br /&gt;
* questionnaire.rb (superclass that the method was moved to)&lt;br /&gt;
&lt;br /&gt;
The main design principle that influenced this refactor was DRY. As the same functionality was used in multiple places, moving it to the superclass made the code easier to understand by showing that all of the subclasses were able to use the function in the same way.&lt;br /&gt;
&lt;br /&gt;
==Renamed create_questionnaire and save_questionnaire==&lt;br /&gt;
&lt;br /&gt;
The questionnaire_controller (questionnaire_controller.rb) contained CRUD functionality for several types of objects. Naturally, one of these objects was a questionnaire. For clarity, its methods had been named create_questionnaire and save_questionnaire. However, proper Ruby design emphasizes convention over configuration. Since the methods were in the questionnaire controller, the convention is to name them create and save, as the fact that they affect a questionnaire is implied. Therefore create_questionnaire (on line 156) was changed to create and save_questionnaire (on line 214) was changed to save.&lt;br /&gt;
&lt;br /&gt;
==Pulled methods from edit==&lt;br /&gt;
&lt;br /&gt;
The edit method in questionnaire_controller.rb did not need to be renamed, but it had another problem; the method was too long. Keeping methods short (around 25 lines or less) is another design principle that increases the readability of code. Therefore, we looked for chunks of the method that would make sense if pulled out as a separate method. Part of the edit method involved exporting and importing questionnaires. These chunks of code were well contained, with clear start and stop points, so we pulled them into separate methods. This resulted in creating an export method from lines 102-108 of the old edit method, and an import method from lines 110-125 of the old method. By doing this, the edit method was shortened to an acceptable length.&lt;br /&gt;
&lt;br /&gt;
==Created advice_controller==&lt;br /&gt;
&lt;br /&gt;
As mentioned above, the questionnaire controller contained some CRUD methods that dealt with another type of object besides questionnaires. This was the advice object, which is used to type notes regarding what score should be given on a question. Again, this violated the Ruby principle of convention over configuration, since these advice methods were in the questionnaire controller. Therefore, a new advice controller (advice_controller.rb) was created, and the edit_advice and save_advice methods were moved from the questionnaire controller to it.&lt;br /&gt;
&lt;br /&gt;
==Removed delete_question_type==&lt;br /&gt;
&lt;br /&gt;
The questionnaire_controller had a delete_question_type method that was only used when destroying the questions of a questionnaire. As it only consisted of two lines, and was only used in one place, we felt that having it in a separate method caused a minor, but unnecessary, case of the Ping-Pong effect. Since the code of the method was rather self-explanatory (simply finding the question type of the question to be deleted and destroying it), moving the functionality back into the delete_questions method and removing the delete_question_type method reduced the complexity of the code without affecting its readability or DRYness.&lt;br /&gt;
&lt;br /&gt;
=Screencast=&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;&amp;lt;youtube&amp;gt;XZzKb_PM07A&amp;lt;/youtube&amp;gt;&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;&lt;/div&gt;</summary>
		<author><name>Eblumpki2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2013/OSS_E605A&amp;diff=73888</id>
		<title>CSC/ECE 517 Spring 2013/OSS E605A</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2013/OSS_E605A&amp;diff=73888"/>
		<updated>2013-03-18T19:28:35Z</updated>

		<summary type="html">&lt;p&gt;Eblumpki2: Embedded screencast (hopefully)&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Expertiza Questionnaire Refactoring=&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=Introduction=&lt;br /&gt;
&lt;br /&gt;
This project involved refactoring the questionnaire portion of Expertiza. This part of the Expertiza project deals with the creation and management of questionnaires that are used during project review and feedback. It also allows for the creation of advice on what each score in a question should represent (a 5 being excellent, 3 being average, etc.). The majority of the refactoring took place in the file questionnaire_controller.rb, as it contains the CRUD functionality for questionnaires. Some refactoring also took place on the questionnaire.rb model, along with various different kinds of questionnaires that were represented as subclasses of questionnaire.rb.&lt;br /&gt;
&lt;br /&gt;
=List of Changes=&lt;br /&gt;
&lt;br /&gt;
Following is a list of the changes made during refactoring, along with the design principles and patterns that were upheld by making these changes.&lt;br /&gt;
&lt;br /&gt;
==Pulled up get_weighted_score==&lt;br /&gt;
&lt;br /&gt;
Each of the questionnaire subclasses had a get_weighted_score method that tallied up the points for a completed questionnaire. These methods were all identical, so we pulled the method up to the questionnaire superclass (questionnaire.rb). The following subclasses had the method and were refactored accordingly:&lt;br /&gt;
&lt;br /&gt;
* author_feedback_questionnaire.rb&lt;br /&gt;
* metareview_questionnaire.rb&lt;br /&gt;
* review_questionnaire.rb&lt;br /&gt;
* teammate_review_questionnaire.rb&lt;br /&gt;
* questionnaire.rb (superclass that the method was moved to)&lt;br /&gt;
&lt;br /&gt;
The main design principle that influenced this refactor was DRY. As the same functionality was used in multiple places, moving it to the superclass made the code easier to understand by showing that all of the subclasses were able to use the function in the same way.&lt;br /&gt;
&lt;br /&gt;
==Renamed create_questionnaire and save_questionnaire==&lt;br /&gt;
&lt;br /&gt;
The questionnaire_controller (questionnaire_controller.rb) contained CRUD functionality for several types of objects. Naturally, one of these objects was a questionnaire. For clarity, its methods had been named create_questionnaire and save_questionnaire. However, proper Ruby design emphasizes convention over configuration. Since the methods were in the questionnaire controller, the convention is to name them create and save, as the fact that they affect a questionnaire is implied. Therefore create_questionnaire (on line 156) was changed to create and save_questionnaire (on line 214) was changed to save.&lt;br /&gt;
&lt;br /&gt;
==Pulled methods from edit==&lt;br /&gt;
&lt;br /&gt;
The edit method in questionnaire_controller.rb did not need to be renamed, but it had another problem; the method was too long. Keeping methods short (around 25 lines or less) is another design principle that increases the readability of code. Therefore, we looked for chunks of the method that would make sense if pulled out as a separate method. Part of the edit method involved exporting and importing questionnaires. These chunks of code were well contained, with clear start and stop points, so we pulled them into separate methods. This resulted in creating an export method from lines 102-108 of the old edit method, and an import method from lines 110-125 of the old method. By doing this, the edit method was shortened to an acceptable length.&lt;br /&gt;
&lt;br /&gt;
==Created advice_controller==&lt;br /&gt;
&lt;br /&gt;
As mentioned above, the questionnaire controller contained some CRUD methods that dealt with another type of object besides questionnaires. This was the advice object, which is used to type notes regarding what score should be given on a question. Again, this violated the Ruby principle of convention over configuration, since these advice methods were in the questionnaire controller. Therefore, a new advice controller (advice_controller.rb) was created, and the edit_advice and save_advice methods were moved from the questionnaire controller to it.&lt;br /&gt;
&lt;br /&gt;
==Removed delete_question_type==&lt;br /&gt;
&lt;br /&gt;
The questionnaire_controller had a delete_question_type method that was only used when destroying the questions of a questionnaire. As it only consisted of two lines, and was only used in one place, we felt that having it in a separate method caused a minor, but unnecessary, case of the Ping-Pong effect. Since the code of the method was rather self-explanatory (simply finding the question type of the question to be deleted and destroying it), moving the functionality back into the delete_questions method and removing the delete_question_type method reduced the complexity of the code without affecting its readability or DRYness.&lt;br /&gt;
&lt;br /&gt;
=Screencast=&lt;br /&gt;
&lt;br /&gt;
&amp;lt;youtube&amp;gt;XZzKb_PM07A&amp;lt;/youtube&amp;gt;&lt;/div&gt;</summary>
		<author><name>Eblumpki2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2013/OSS_E605A&amp;diff=73887</id>
		<title>CSC/ECE 517 Spring 2013/OSS E605A</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2013/OSS_E605A&amp;diff=73887"/>
		<updated>2013-03-18T19:24:33Z</updated>

		<summary type="html">&lt;p&gt;Eblumpki2: Created the page.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Expertiza Questionnaire Refactoring=&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=Introduction=&lt;br /&gt;
&lt;br /&gt;
This project involved refactoring the questionnaire portion of Expertiza. This part of the Expertiza project deals with the creation and management of questionnaires that are used during project review and feedback. It also allows for the creation of advice on what each score in a question should represent (a 5 being excellent, 3 being average, etc.). The majority of the refactoring took place in the file questionnaire_controller.rb, as it contains the CRUD functionality for questionnaires. Some refactoring also took place on the questionnaire.rb model, along with various different kinds of questionnaires that were represented as subclasses of questionnaire.rb.&lt;br /&gt;
&lt;br /&gt;
=List of Changes=&lt;br /&gt;
&lt;br /&gt;
Following is a list of the changes made during refactoring, along with the design principles and patterns that were upheld by making these changes.&lt;br /&gt;
&lt;br /&gt;
==Pulled up get_weighted_score==&lt;br /&gt;
&lt;br /&gt;
Each of the questionnaire subclasses had a get_weighted_score method that tallied up the points for a completed questionnaire. These methods were all identical, so we pulled the method up to the questionnaire superclass (questionnaire.rb). The following subclasses had the method and were refactored accordingly:&lt;br /&gt;
&lt;br /&gt;
* author_feedback_questionnaire.rb&lt;br /&gt;
* metareview_questionnaire.rb&lt;br /&gt;
* review_questionnaire.rb&lt;br /&gt;
* teammate_review_questionnaire.rb&lt;br /&gt;
* questionnaire.rb (superclass that the method was moved to)&lt;br /&gt;
&lt;br /&gt;
The main design principle that influenced this refactor was DRY. As the same functionality was used in multiple places, moving it to the superclass made the code easier to understand by showing that all of the subclasses were able to use the function in the same way.&lt;br /&gt;
&lt;br /&gt;
==Renamed create_questionnaire and save_questionnaire==&lt;br /&gt;
&lt;br /&gt;
The questionnaire_controller (questionnaire_controller.rb) contained CRUD functionality for several types of objects. Naturally, one of these objects was a questionnaire. For clarity, its methods had been named create_questionnaire and save_questionnaire. However, proper Ruby design emphasizes convention over configuration. Since the methods were in the questionnaire controller, the convention is to name them create and save, as the fact that they affect a questionnaire is implied. Therefore create_questionnaire (on line 156) was changed to create and save_questionnaire (on line 214) was changed to save.&lt;br /&gt;
&lt;br /&gt;
==Pulled methods from edit==&lt;br /&gt;
&lt;br /&gt;
The edit method in questionnaire_controller.rb did not need to be renamed, but it had another problem; the method was too long. Keeping methods short (around 25 lines or less) is another design principle that increases the readability of code. Therefore, we looked for chunks of the method that would make sense if pulled out as a separate method. Part of the edit method involved exporting and importing questionnaires. These chunks of code were well contained, with clear start and stop points, so we pulled them into separate methods. This resulted in creating an export method from lines 102-108 of the old edit method, and an import method from lines 110-125 of the old method. By doing this, the edit method was shortened to an acceptable length.&lt;br /&gt;
&lt;br /&gt;
==Created advice_controller==&lt;br /&gt;
&lt;br /&gt;
As mentioned above, the questionnaire controller contained some CRUD methods that dealt with another type of object besides questionnaires. This was the advice object, which is used to type notes regarding what score should be given on a question. Again, this violated the Ruby principle of convention over configuration, since these advice methods were in the questionnaire controller. Therefore, a new advice controller (advice_controller.rb) was created, and the edit_advice and save_advice methods were moved from the questionnaire controller to it.&lt;br /&gt;
&lt;br /&gt;
==Removed delete_question_type==&lt;br /&gt;
&lt;br /&gt;
The questionnaire_controller had a delete_question_type method that was only used when destroying the questions of a questionnaire. As it only consisted of two lines, and was only used in one place, we felt that having it in a separate method caused a minor, but unnecessary, case of the Ping-Pong effect. Since the code of the method was rather self-explanatory (simply finding the question type of the question to be deleted and destroying it), moving the functionality back into the delete_questions method and removing the delete_question_type method reduced the complexity of the code without affecting its readability or DRYness.&lt;br /&gt;
&lt;br /&gt;
=Screencast=&lt;/div&gt;</summary>
		<author><name>Eblumpki2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2013/ch1_1d_zk&amp;diff=73047</id>
		<title>CSC/ECE 517 Spring 2013/ch1 1d zk</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2013/ch1_1d_zk&amp;diff=73047"/>
		<updated>2013-02-16T02:58:06Z</updated>

		<summary type="html">&lt;p&gt;Eblumpki2: Added information requested in feedback.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Object-relational Mapping for Ruby=&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=Introduction=&lt;br /&gt;
&lt;br /&gt;
[http://en.wikipedia.org/wiki/Object-relational_mapping Object-relational mapping (ORM)] provides developers with a set of tools that ease management of the relationships between objects and relational databases, thus allowing applications to be easily extended to add data persistence.  For Ruby, several object-relational mapping options are available. This wiki concentrates more on the comparison of ORMs and provides a high level overview of the top Ruby ORMs: ActiveRecord ,Sequel and DataMapper.  It also includes a minor discussion on alternative frameworks that can be used either in place of or along with ORMs. These include the persistence framework iBATIS (more specifically the Ruby version RBatis), and the stack framework Merb.&lt;br /&gt;
&lt;br /&gt;
=Overview=&lt;br /&gt;
&lt;br /&gt;
Object-relational Mapping (ORM) frameworks unburden the designer of the complex translation between database and object space. &lt;br /&gt;
&lt;br /&gt;
Typical ORM features:&lt;br /&gt;
* Automatic mapping from classes to database tables&lt;br /&gt;
** Class instance variables to database columns&lt;br /&gt;
** Class instances to table rows&lt;br /&gt;
* Aggregation and association relationships between mapped classes are managed&lt;br /&gt;
** Example, :has_many, :belongs_to associations in ActiveRecord&lt;br /&gt;
** Inheritance cases are mapped to tables&lt;br /&gt;
* Validation of data prior to table storage&lt;br /&gt;
* Class extensions to enable search, as well as creation, read, update, and deletion (CRUD) of instances/records&lt;br /&gt;
* Usually abstracts the database from program space in such a way that alternate database types can be easily chosen (SQLite, Oracle, etc)&lt;br /&gt;
&lt;br /&gt;
The diagram below depicts a simple mapping of an object to a database table….&lt;br /&gt;
&lt;br /&gt;
[[Image:3j_ks_pic1.jpg]]&lt;br /&gt;
&lt;br /&gt;
ORMs are crucial to almost any application that needs to access a database, as they provide the connection from the model of the program to the database itself. By enabling database rows to be used as objects, the program can more easily access and use the information in a way that is internally consistent and easy to understand. The ORM gives the programmer to manipulate data with the programming language, instead of having to manipulate each attribute as its data type as obtained by the database management system.&lt;br /&gt;
&lt;br /&gt;
When applied to Ruby, implementations of ORM often leverage the language’s [http://en.wikipedia.org/wiki/Metaprogramming metaprogramming] strengths to create intuitive application-specific methods and otherwise extend classes to support database functionality. With the addition of Rails, the ORM becomes much more important, as it is necessary to have an ORM to connect the models of the MVC (model-view-controller) stack used by Ruby on Rails with the application's database. Since the models are Ruby objects, the ORM allows modifications to the database to be done through changes to these models, independent of the type of database used.&lt;br /&gt;
&lt;br /&gt;
With the release of Rails 3.0, the platform became ORM independent. With this change, it is much easier to use the ORM most preferred by the programmer, rather than being corralled into using one particular one. To allow this, the ORM needed to be extracted from the model and the database, to be a pure mediator between the two. Then any ORM can be used as long as it can successfully understand the model and the database used.&lt;br /&gt;
&lt;br /&gt;
=ActiveRecord=&lt;br /&gt;
&lt;br /&gt;
[http://ar.rubyonrails.org/ ActiveRecord], originally created by David Heinemeier and released in 2003, became the de-facto ORM for Ruby since it was integrated in the widely-used Rails framework, however alternate ORMs for Ruby have been developed and Rails 3.x is ORM independent. ActiveRecord is an implementation of the active record design pattern, where a table is wrapped into a class and this class implements accessor methods for each column in the table.&lt;br /&gt;
&lt;br /&gt;
To create a table, ActiveRecord makes use of a migration class rather than including table definition in the actual class being modeled.  As an example, the following code creates a table ‘’users’’ to store a collection of class ‘’User’’ objects:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class CreateUsers &amp;lt; ActiveRecord::Migration&lt;br /&gt;
  def self.up&lt;br /&gt;
    create_table :users do |t|&lt;br /&gt;
      t.string :name&lt;br /&gt;
      t.string :email&lt;br /&gt;
      t.string :age&lt;br /&gt;
	  t.references :cheer&lt;br /&gt;
	  t.references :post&lt;br /&gt;
&lt;br /&gt;
      t.timestamps     # add creation and modification timestamps&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def self.down        # undo the table creation&lt;br /&gt;
    drop_table :users&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note in the preceeding example, that the ActiveRecord’s migration scheme provides a means for backing out changes via the ‘’self.down’’ method.  In addition, a table key ‘’id’’ is added to the new table without an explicit definition and record creation and modification timestamps are included via the ‘’timestamps’’ method provided by ActiveRecord.  &lt;br /&gt;
&lt;br /&gt;
ActiveRecord manages associations between table elements and provides the means to define such associations in the model definition.  For example, the ‘’User’’ class shown below defines a ‘’has_many’’ (one-to-many) association with both the cheers and posts tables. These associations are represented in the migration class with the references operator.  Also note ActiveRecord’s integrated support for validation of table information when attempting an update.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class User &amp;lt; ActiveRecord::Base&lt;br /&gt;
  has_many :cheers&lt;br /&gt;
  has_many :posts&lt;br /&gt;
  &lt;br /&gt;
  validates_presence_of :name&lt;br /&gt;
  validates_presence_of :age&lt;br /&gt;
  validates_uniqueness_of :name&lt;br /&gt;
  validates_length_of :name, :within =&amp;gt; 3..20&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To access the data in the table one calls the class function related to that column. For example, to find the user who's name is Bob, one would use @user = User.find_by_name('Bob'). Then one could find Bob's e-mail by using @user.email. Users can be searched for by any attribute in this way, as find methods are created for every combination of attributes.&lt;br /&gt;
While ActiveRecord provides the flexibility to create more sophisticated table relationships to represent class hierarchy, its base scheme is a single table inheritance, which trades some storage efficiency for simplicity in the database design. The following figure illustrates this concept of simplicity over efficiency.  &lt;br /&gt;
&lt;br /&gt;
[[Image:3j_ks_pic2.jpg]]&lt;br /&gt;
&lt;br /&gt;
'''Pros''' -&lt;br /&gt;
* Integrated with popular Rails development framework&lt;br /&gt;
* Dynamically created database search methods (eg: User.find_by_address) ease db queries and make queries database syntax independent&lt;br /&gt;
* DB creation/management using the migrate scheme provides a means for backing out unwanted table changes&lt;br /&gt;
'''Cons''' -&lt;br /&gt;
* DB creation/management is decoupled from the model, requiring a separate utility (rake/migrate) that must be kept in sync with application&lt;br /&gt;
&lt;br /&gt;
=Sequel=&lt;br /&gt;
&lt;br /&gt;
[http://sequel.rubyforge.org Sequel] was originally developed by Sharon Rosner and the first release was in March 2007. It is based on the active record pattern. Sequel and Active Record share a lot of common features , for example association and inheritance. But Sequel handles these features in a much more flexible manner. Currently Sequel is at version 3.44.0. Initially Sequel had three core modules - sequel, sequel_core and sequel_model. Starting from version 1.4 , sequel and sequel_model were merged. Sequel handles validations using a validation plug-in and helpers.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class CreateUser &amp;lt; Sequel::Migration&lt;br /&gt;
  def up&lt;br /&gt;
    create_table(:user) {&lt;br /&gt;
      primary_key :id&lt;br /&gt;
      String :name&lt;br /&gt;
      String :age&lt;br /&gt;
      String :email}&lt;br /&gt;
  end&lt;br /&gt;
  def down&lt;br /&gt;
    drop_table(:user)&lt;br /&gt;
  end&lt;br /&gt;
end # CreateUser.apply(DB, :up)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Sequel supports associations and validations similar to Active Record. The following example shows how validations and associations can be enforced in the User table that has been created above. It enforces one to many relationships between the user table and the cheers and posts tables. It also validates for the presence , uniqueness and the length of the attribute '''name'''.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class User &amp;lt; Sequel::Model&lt;br /&gt;
  one_to_many :cheers&lt;br /&gt;
  one_to_many :posts&lt;br /&gt;
  &lt;br /&gt;
  validates_presence [:name, :age]&lt;br /&gt;
  validates_unique(:name)&lt;br /&gt;
  validates_length_range 3..20, :name&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To access the data in Sequel, one can use where clauses. For instance, to find Bob again one would use DB[:items].where(Sequel.like(:name, 'Bob'). While the ability to use SQL-like where clauses is quite flexible, it is not quite as pure an object-oriented approach as Active Record's dynamically created find methods.&lt;br /&gt;
&lt;br /&gt;
Some of the key features of sequel are,&lt;br /&gt;
* Connection Pooling&lt;br /&gt;
* Thread Safety&lt;br /&gt;
* [http://wiki.rubyonrails.org/howtos/db-relationships/eager-loading Eager Loading] / Lazy Loading&lt;br /&gt;
* Model Caching&lt;br /&gt;
&lt;br /&gt;
=DataMapper=&lt;br /&gt;
&lt;br /&gt;
[http://datamapper.org/ DataMapper] is an open source ORM for Ruby originally developed by Sam Smoot and first released in 2007. DataMapper provides a very flexible mapping API which allows creation of adapters to a wide variety of datastores beyond traditional SQL-based relational databases – DataMapper adapters have been created to non-standard sources such as the Salesforce API and even Google Video.&lt;br /&gt;
&lt;br /&gt;
Unlike ActiveRecord and Sequel, DataMapper does not rely on a migration scheme to create and manage DB tables.  Instead, DataMapper allows table definition as part of the model class definition which keeps the model definition contained to a single file, thus minimizing the effort required to keep the database and model definitions in sync.  When required, DataMapper can also support a migration methodology similar to other ORMs.&lt;br /&gt;
 &lt;br /&gt;
Example of table definition in the model:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class User&lt;br /&gt;
  include DataMapper::Resource&lt;br /&gt;
&lt;br /&gt;
  property :id,         Serial    # key&lt;br /&gt;
  property :name,       String, :required =&amp;gt; true, :unique =&amp;gt; true     &lt;br /&gt;
  property :age,        String, :required =&amp;gt; true, :length =&amp;gt; 3..20 &lt;br /&gt;
  property :email,      String &lt;br /&gt;
  &lt;br /&gt;
  has n, :posts          # one to many association&lt;br /&gt;
  has n, :cheers          # one to many association&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Notice that in the example above , &amp;quot;:required = true&amp;quot; is an example for Auto Validation. Unlike ActiveRecord and Sequel, DataMapper supports auto validations , i.e. these in turn call the validation helpers to enforce basic validations such as length, uniqueness, format, presence etc.&lt;br /&gt;
&lt;br /&gt;
Some of the key features of DataMapper are:&lt;br /&gt;
* API supports a wide variety of databases, including non SQL types&lt;br /&gt;
* Thread Safety&lt;br /&gt;
* [http://wiki.rubyonrails.org/howtos/db-relationships/eager-loading Eager Loading] of child associations&lt;br /&gt;
* Lazy loading&lt;br /&gt;
* Works with or without a migration file.&lt;br /&gt;
&lt;br /&gt;
=iBATIS=&lt;br /&gt;
&lt;br /&gt;
[http://ibatis.apache.org/ iBATIS] was a persistence framework which allowed easy access of the database from a Rails application without being a full ORM. It was created by the Apache Foundation in 2002, and is available for several platforms, including Ruby (the Ruby release is known as RBatis).&lt;br /&gt;
On 6/16/2010, after releasing iBATIS 3.0, the project team moved from Apache to Google Code, changed the project's name to MyBatis, and stopped supporting Ruby.&lt;br /&gt;
&lt;br /&gt;
RBatis is more lightweight than the other ORMs discussed so far. It provides a wrapper for SQL commands in Ruby, enabling one to call SQL with Ruby methods.&lt;br /&gt;
&lt;br /&gt;
For instance, this code creates methods to find a user by ID and name.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Class User &amp;lt; RBatis::Base&lt;br /&gt;
&lt;br /&gt;
  statement :select_one, :find do |id|&lt;br /&gt;
	[&amp;quot;SELECT * FROM users WHERE id = ?&amp;quot;, id]&lt;br /&gt;
  end&lt;br /&gt;
  &lt;br /&gt;
  statement :select_one, :find_by_name do |name|&lt;br /&gt;
    [&amp;quot;SELECT * FROM users WHERE name = ?&amp;quot;, name]&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These methods can now be used as class methods.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
User.find(1)&lt;br /&gt;
User.find_by_name('Bob')&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Pros''' -&lt;br /&gt;
* Enables direct use of SQL functionality within Ruby.&lt;br /&gt;
* Is a thinner ORM than the others discussed.&lt;br /&gt;
* Allows the programmer to create his or her own custom find methods.&lt;br /&gt;
'''Cons''' -&lt;br /&gt;
* No longer supported&lt;br /&gt;
* Database needs to be created/managed separately.&lt;br /&gt;
* Standard find methods are not automatically created.&lt;br /&gt;
&lt;br /&gt;
=Merb=&lt;br /&gt;
 &lt;br /&gt;
 [http://www.merbivore.com/index.html Merb] was a model-view-controller framework created by Ezra Zygmuntowicz and released on November 7, 2008. It was a full-stack system like Rails, but only consisted of the core needed to create an application, leaving additional functionality to be installed by extra gems.&lt;br /&gt;
 Merb is at 1.1, and will not have a v2.0 as it was absorbed into Rails 3.0 in 2008.&lt;br /&gt;
 &lt;br /&gt;
 Merb itself provides only the controller of an MVC model, but this core is easily extended to create a full-stack application environment. In this sense, Merb itself is not an ORM, but it can easily accomodate any of the other ORMs described. &lt;br /&gt;
&lt;br /&gt;
=Comparison of ORM Features=&lt;br /&gt;
&lt;br /&gt;
{|cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
!style=&amp;quot;width:10%&amp;quot;|Features &lt;br /&gt;
!style=&amp;quot;width:30%&amp;quot;|ActiveRecord&lt;br /&gt;
!style=&amp;quot;width:30%&amp;quot;|Sequel&lt;br /&gt;
!style=&amp;quot;width:30%&amp;quot;|DataMapper&lt;br /&gt;
|-&lt;br /&gt;
! &amp;lt;p align=&amp;quot;left&amp;quot;&amp;gt; Databases &amp;lt;/p&amp;gt;&lt;br /&gt;
| MySQL, PostgreSQL, SQLite, Oracle, SQLServer, and DB2&lt;br /&gt;
| ADO, DataObjects, DB2, DBI, Firebird, Informix, JDBC, MySQL, ODBC, OpenBase, Oracle, PostgreSQL and SQLite3&lt;br /&gt;
| SQLite, MySQL, PostgreSQL, Oracle, MongoDB, SimpleDB, many others, including CouchDB, Apache Solr, Google Data API&lt;br /&gt;
|-&lt;br /&gt;
! &amp;lt;p align=&amp;quot;left&amp;quot;&amp;gt; Migrations &amp;lt;/p&amp;gt;&lt;br /&gt;
| Yes&lt;br /&gt;
| Yes&lt;br /&gt;
| Yes, but optional&lt;br /&gt;
|-&lt;br /&gt;
! &amp;lt;p align=&amp;quot;left&amp;quot;&amp;gt; EagerLoading &amp;lt;/p&amp;gt;&lt;br /&gt;
| Supported by scanning the SQL fragments&lt;br /&gt;
| Supported using eager (preloading) and eager_graph (joins) &lt;br /&gt;
| Strategic Eager Loading and by using :summary&lt;br /&gt;
|-&lt;br /&gt;
! &amp;lt;p align=&amp;quot;left&amp;quot;&amp;gt; Flexible Overriding &amp;lt;/p&amp;gt;&lt;br /&gt;
| No. Overriding is done using alias methods.&lt;br /&gt;
| Using methods and by calling 'super'&lt;br /&gt;
| Using methods&lt;br /&gt;
|-&lt;br /&gt;
! &amp;lt;p align=&amp;quot;left&amp;quot;&amp;gt; Dynamic Finders &amp;lt;/p&amp;gt;&lt;br /&gt;
| Yes. Uses 'Method Missing'&lt;br /&gt;
| No. Alternative is to use &amp;lt;Model&amp;gt;.FindOrCreate(:name=&amp;gt;&amp;quot;John&amp;quot;)&lt;br /&gt;
| Yes. Using the dm_ar_finders plugin&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Further Reading=&lt;br /&gt;
To get more information on ORM and the different type of ORM's available for Ruby , please look into the [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2010/ch3_3j_KS Object-relational mapping Fall 2010] and [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2010/ch3_3f_ac Fall 2010 detailed ORM explanation] wiki pages.&lt;br /&gt;
&lt;br /&gt;
=Future Work=&lt;br /&gt;
More work can be done in the area of comparison between the different ORMs available for Ruby, especially a more detailed feature-by-feature comparison that includes performance differences between the ORMs.&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Object-relational_mapping Wikipedia, Object-relational mapping (ORM)]&lt;br /&gt;
# [http://ar.rubyonrails.org/  ActiveRecord]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Active_record_pattern Wikipedia Active record pattern]&lt;br /&gt;
# [http://sequel.rubyforge.org/ Sequel]&lt;br /&gt;
# [http://jeremyevans-pres.heroku.com/mwrc2009_presentation.html  Sequel Presentation - By Jeremy Evans]&lt;br /&gt;
# [http://merbist.com/2008/09/29/write-your-own-custom-datamapper-adapter/  Merbist blog on custom DM adapters - By Matt Aimonetti]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Datamapper DataMapper]&lt;br /&gt;
# [http://pg-server.csc.ncsu.edu/mediawiki/index.php/CSC/ECE_517_Fall_2007/wiki2_2_22 Object-Relational Mapping Fall 2007]&lt;br /&gt;
# [http://ormbattle.net/ ORMBattle.Net]&lt;br /&gt;
# [http://wiki.rubyonrails.org/howtos/db-relationships/eager-loading Eager-loading description on Rails Wiki]&lt;br /&gt;
# [http://ibatis.apache.org/ iBATIS]&lt;br /&gt;
# [http://ibatis.apache.org/docs/ruby/ RBatis - iBATIS for Ruby and Ruby on Rails]&lt;br /&gt;
# [http://www.merbivore.com/index.html Merb]&lt;/div&gt;</summary>
		<author><name>Eblumpki2</name></author>
	</entry>
	<entry>
		<id>https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2013/ch1_1d_zk&amp;diff=72573</id>
		<title>CSC/ECE 517 Spring 2013/ch1 1d zk</title>
		<link rel="alternate" type="text/html" href="https://wiki.expertiza.ncsu.edu/index.php?title=CSC/ECE_517_Spring_2013/ch1_1d_zk&amp;diff=72573"/>
		<updated>2013-02-11T20:11:14Z</updated>

		<summary type="html">&lt;p&gt;Eblumpki2: Created page.&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Object-relational Mapping for Ruby=&lt;br /&gt;
&lt;br /&gt;
__TOC__&lt;br /&gt;
&lt;br /&gt;
=Introduction=&lt;br /&gt;
&lt;br /&gt;
[http://en.wikipedia.org/wiki/Object-relational_mapping Object-relational mapping (ORM)] provides developers with a set of tools that ease management of the relationships between objects and relational databases, thus allowing applications to be easily extended to add data persistence.  For Ruby, several object-relational mapping options are available. This wiki concentrates more on the comparison of ORMs and provides a high level overview of the top Ruby ORMs: ActiveRecord ,Sequel and DataMapper.  Other products related to Ruby ORM were excluded from this comparison if their scope was limited to a subset of ORM functionality or if support for the product has waned in recent years (eg RBatis, the port of Apache iBatis ORM to Ruby).&lt;br /&gt;
&lt;br /&gt;
=Overview=&lt;br /&gt;
&lt;br /&gt;
Object-relational Mapping (ORM) frameworks unburden the designer of the complex translation between database and object space. &lt;br /&gt;
&lt;br /&gt;
Typical ORM features:&lt;br /&gt;
* Automatic mapping from classes to database tables&lt;br /&gt;
** Class instance variables to database columns&lt;br /&gt;
** Class instances to table rows&lt;br /&gt;
* Aggregation and association relationships between mapped classes are managed&lt;br /&gt;
** Example, :has_many, :belongs_to associations in ActiveRecord&lt;br /&gt;
** Inheritance cases are mapped to tables&lt;br /&gt;
* Validation of data prior to table storage&lt;br /&gt;
* Class extensions to enable search, as well as creation, read, update, and deletion (CRUD) of instances/records&lt;br /&gt;
* Usually abstracts the database from program space in such a way that alternate database types can be easily chosen (SQLite, Oracle, etc)&lt;br /&gt;
&lt;br /&gt;
The diagram below depicts a simple mapping of an object to a database table….&lt;br /&gt;
&lt;br /&gt;
[[Image:3j_ks_pic1.jpg]]&lt;br /&gt;
&lt;br /&gt;
When applied to Ruby, implementations of ORM often leverage the language’s [http://en.wikipedia.org/wiki/Metaprogramming metaprogramming] strengths to create intuitive application-specific methods and otherwise extend classes to support database functionality.&lt;br /&gt;
&lt;br /&gt;
With the release of Rails 3.0, the platform became ORM independent. With this change, it is much easier to use the ORM most preferred by the programmer, rather than being corralled into using one particular one. To allow this, the ORM needed to be extracted from the model and the database, to be a pure mediator between the two.&lt;br /&gt;
&lt;br /&gt;
=ActiveRecord=&lt;br /&gt;
&lt;br /&gt;
[http://ar.rubyonrails.org/ ActiveRecord], originally created by David Heinemeier and released in 2003, became the de-facto ORM for Ruby since it was integrated in the widely-used Rails framework, however alternate ORMs for Ruby have been developed and Rails 3.x is ORM independent. ActiveRecord is an implementation of the active record design pattern, where a table is wrapped into a class and this class implements accessor methods for each column in the table.&lt;br /&gt;
&lt;br /&gt;
To create a table, ActiveRecord makes use of a migration class rather than including table definition in the actual class being modeled.  As an example, the following code creates a table ‘’users’’ to store a collection of class ‘’User’’ objects:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class CreateUsers &amp;lt; ActiveRecord::Migration&lt;br /&gt;
  def self.up&lt;br /&gt;
    create_table :users do |t|&lt;br /&gt;
      t.string :name&lt;br /&gt;
      t.string :email&lt;br /&gt;
      t.string :age&lt;br /&gt;
	  t.references :cheer&lt;br /&gt;
	  t.references :post&lt;br /&gt;
&lt;br /&gt;
      t.timestamps     # add creation and modification timestamps&lt;br /&gt;
    end&lt;br /&gt;
  end&lt;br /&gt;
&lt;br /&gt;
  def self.down        # undo the table creation&lt;br /&gt;
    drop_table :users&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Note in the preceeding example, that the ActiveRecord’s migration scheme provides a means for backing out changes via the ‘’self.down’’ method.  In addition, a table key ‘’id’’ is added to the new table without an explicit definition and record creation and modification timestamps are included via the ‘’timestamps’’ method provided by ActiveRecord.  &lt;br /&gt;
&lt;br /&gt;
ActiveRecord manages associations between table elements and provides the means to define such associations in the model definition.  For example, the ‘’User’’ class shown below defines a ‘’to_many’’ association with both the cheers and posts tables. These associations are represented in the migration class with the references operator.  Also note ActiveRecord’s integrated support for validation of table information when attempting an update.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class User &amp;lt; ActiveRecord::Base&lt;br /&gt;
  has_many :cheers&lt;br /&gt;
  has_many :posts&lt;br /&gt;
  &lt;br /&gt;
  validates_presence_of :name&lt;br /&gt;
  validates_presence_of :age&lt;br /&gt;
  validates_uniqueness_of :name&lt;br /&gt;
  validates_length_of :name, :within =&amp;gt; 3..20&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To access the data in the table one calls the class function related to that column. For example, to find the user who's name is Bob, one would use @user = User.find_by_name('Bob'). Then one could find Bob's e-mail by using @user.email.&lt;br /&gt;
While ActiveRecord provides the flexibility to create more sophisticated table relationships to represent class hierarchy, its base scheme is a single table inheritance, which trades some storage efficiency for simplicity in the database design. The following figure illustrates this concept of simplicity over efficiency.  &lt;br /&gt;
&lt;br /&gt;
[[Image:3j_ks_pic2.jpg]]&lt;br /&gt;
&lt;br /&gt;
'''Pros''' -&lt;br /&gt;
* Integrated with popular Rails development framework&lt;br /&gt;
* Dynamically created database search methods (eg: User.find_by_address) ease db queries and make queries database syntax independent&lt;br /&gt;
* DB creation/management using the migrate scheme provides a means for backing out unwanted table changes&lt;br /&gt;
'''Cons''' -&lt;br /&gt;
* DB creation/management is decoupled from the model, requiring a separate utility (rake/migrate) that must be kept in sync with application&lt;br /&gt;
&lt;br /&gt;
=Sequel=&lt;br /&gt;
&lt;br /&gt;
[http://sequel.rubyforge.org Sequel] was originally developed by Sharon Rosner and the first release was in March 2007. It is based on the active record pattern. Sequel and Active Record share a lot of common features , for example association and inheritance. But Sequel handles these features in a much more flexible manner. Currently Sequel is at version 3.44.0. Initially Sequel had three core modules - sequel, sequel_core and sequel_model. Starting from version 1.4 , sequel and sequel_model were merged. Sequel handles validations using a validation plug-in and helpers.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class CreateUser &amp;lt; Sequel::Migration&lt;br /&gt;
  def up&lt;br /&gt;
    create_table(:user) {&lt;br /&gt;
      primary_key :id&lt;br /&gt;
      String :name&lt;br /&gt;
      String :age&lt;br /&gt;
      String :email}&lt;br /&gt;
  end&lt;br /&gt;
  def down&lt;br /&gt;
    drop_table(:user)&lt;br /&gt;
  end&lt;br /&gt;
end # CreateUser.apply(DB, :up)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Sequel supports associations and validations similar to Active Record. The following example shows how validations and associations can be enforced in the User table that has been created above. It enforces one to many relationships between the user table and the cheers and posts tables. It also validates for the presence , uniqueness and the length of the attribute '''name'''.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class User &amp;lt; Sequel::Model&lt;br /&gt;
  one_to_many :cheers&lt;br /&gt;
  one_to_many :posts&lt;br /&gt;
  &lt;br /&gt;
  validates_presence [:name, :age]&lt;br /&gt;
  validates_unique(:name)&lt;br /&gt;
  validates_length_range 3..20, :name&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To access the data in Sequel, one can use where clauses. For instance, to find Bob again one would use DB[:items].where(Sequel.like(:name, 'Bob').&lt;br /&gt;
&lt;br /&gt;
Some of the key features of sequel are,&lt;br /&gt;
* Connection Pooling&lt;br /&gt;
* Thread Safety&lt;br /&gt;
* [http://wiki.rubyonrails.org/howtos/db-relationships/eager-loading Eager Loading] / Lazy Loading&lt;br /&gt;
* Model Caching&lt;br /&gt;
&lt;br /&gt;
=DataMapper=&lt;br /&gt;
&lt;br /&gt;
[http://datamapper.org/ DataMapper] is an open source ORM for Ruby originally developed by Sam Smoot and first released in 2007. DataMapper provides a very flexible mapping API which allows creation of adapters to a wide variety of datastores beyond traditional SQL-based relational databases – DataMapper adapters have been created to non-standard sources such as the Salesforce API and even Google Video.&lt;br /&gt;
&lt;br /&gt;
Unlike ActiveRecord and Sequel, DataMapper does not rely on a migration scheme to create and manage DB tables.  Instead, DataMapper allows table definition as part of the model class definition which keeps the model definition contained to a single file, thus minimizing the effort required to keep the database and model definitions in sync.  When required, DataMapper can also support a migration methodology similar to other ORMs.&lt;br /&gt;
 &lt;br /&gt;
Example of table definition in the model:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
class User&lt;br /&gt;
  include DataMapper::Resource&lt;br /&gt;
&lt;br /&gt;
  property :id,         Serial    # key&lt;br /&gt;
  property :name,       String, :required =&amp;gt; true, :unique =&amp;gt; true     &lt;br /&gt;
  property :age,        String, :required =&amp;gt; true, :length =&amp;gt; 3..20 &lt;br /&gt;
  property :email,      String &lt;br /&gt;
  &lt;br /&gt;
  has n, :posts          # one to many association&lt;br /&gt;
  has n, :cheers          # one to many association&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Notice that in the example above , &amp;quot;:required = true&amp;quot; is an example for Auto Validation. Unlike ActiveRecord and Sequel, DataMapper supports auto validations , i.e. these in turn call the validation helpers to enforce basic validations such as length, uniqueness, format, presence etc.&lt;br /&gt;
&lt;br /&gt;
Some of the key features of DataMapper are:&lt;br /&gt;
* API supports a wide variety of databases, including non SQL types&lt;br /&gt;
* Thread Safety&lt;br /&gt;
* [http://wiki.rubyonrails.org/howtos/db-relationships/eager-loading Eager Loading] of child associations&lt;br /&gt;
* Lazy loading&lt;br /&gt;
&lt;br /&gt;
=iBATIS=&lt;br /&gt;
&lt;br /&gt;
[http://ibatis.apache.org/ iBATIS] was a persistence framework which allowed easy access of the database from a Rails application without being a full ORM. It was created by the Apache Foundation in 2002, and is available for several platforms, including Ruby (the Ruby release is known as RBatis).&lt;br /&gt;
On 6/16/2010, after releasing iBATIS 3.0, the project team moved from Apache to Google Code, changed the project's name to MyBatis, and stopped supporting Ruby.&lt;br /&gt;
&lt;br /&gt;
iBATIS is more lightweight than the other ORMs discussed so far. It provides a wrapper for SQL commands in Ruby, enabling one to call SQL with Ruby methods.&lt;br /&gt;
&lt;br /&gt;
For instance, this code creates methods to find a user by ID and name.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
Class User &amp;lt; RBatis::Base&lt;br /&gt;
&lt;br /&gt;
  statement :select_one, :find do |id|&lt;br /&gt;
	[&amp;quot;SELECT * FROM users WHERE id = ?&amp;quot;, id]&lt;br /&gt;
  end&lt;br /&gt;
  &lt;br /&gt;
  statement :select_one, :find_by_name do |name|&lt;br /&gt;
    [&amp;quot;SELECT * FROM users WHERE name = ?&amp;quot;, name]&lt;br /&gt;
  end&lt;br /&gt;
end&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These methods can now be used as class methods.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
User.find(1)&lt;br /&gt;
User.find_by_name('Bob')&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
'''Pros''' -&lt;br /&gt;
* Enables direct use of SQL functionality within Ruby.&lt;br /&gt;
* Is a thinner ORM than the others discussed.&lt;br /&gt;
'''Cons''' -&lt;br /&gt;
* No longer supported&lt;br /&gt;
* Database needs to be created/managed separately.&lt;br /&gt;
&lt;br /&gt;
=Merb=&lt;br /&gt;
 &lt;br /&gt;
 [http://www.merbivore.com/index.html Merb] was a model-view-controller framework created by Ezra Zygmuntowicz and released on November 7, 2008. It was a full-stack system like Rails, but only consisted of the core needed to create an application, leaving additional functionality to be installed by extra gems.&lt;br /&gt;
 Merb is at 1.1, and will not have a v2.0 as it was absorbed into Rails 3.0 in 2008.&lt;br /&gt;
 &lt;br /&gt;
 Merb itself provides only the controller of an MVC model, but this core is easily extended to create a full-stack application environment. In this sense, Merb itself is not an ORM, but it can easily accomodate any of the other ORMs described. &lt;br /&gt;
&lt;br /&gt;
=Comparison of ORM Features=&lt;br /&gt;
&lt;br /&gt;
{|cellspacing=&amp;quot;0&amp;quot; border=&amp;quot;1&amp;quot;&lt;br /&gt;
!style=&amp;quot;width:10%&amp;quot;|Features &lt;br /&gt;
!style=&amp;quot;width:30%&amp;quot;|ActiveRecord&lt;br /&gt;
!style=&amp;quot;width:30%&amp;quot;|Sequel&lt;br /&gt;
!style=&amp;quot;width:30%&amp;quot;|DataMapper&lt;br /&gt;
|-&lt;br /&gt;
! &amp;lt;p align=&amp;quot;left&amp;quot;&amp;gt; Databases &amp;lt;/p&amp;gt;&lt;br /&gt;
| MySQL, PostgreSQL, SQLite, Oracle, SQLServer, and DB2&lt;br /&gt;
| ADO, DataObjects, DB2, DBI, Firebird, Informix, JDBC, MySQL, ODBC, OpenBase, Oracle, PostgreSQL and SQLite3&lt;br /&gt;
| SQLite, MySQL, PostgreSQL, Oracle, MongoDB, SimpleDB, many others, including CouchDB, Apache Solr, Google Data API&lt;br /&gt;
|-&lt;br /&gt;
! &amp;lt;p align=&amp;quot;left&amp;quot;&amp;gt; Migrations &amp;lt;/p&amp;gt;&lt;br /&gt;
| Yes&lt;br /&gt;
| Yes&lt;br /&gt;
| Yes, but optional&lt;br /&gt;
|-&lt;br /&gt;
! &amp;lt;p align=&amp;quot;left&amp;quot;&amp;gt; EagerLoading &amp;lt;/p&amp;gt;&lt;br /&gt;
| Supported by scanning the SQL fragments&lt;br /&gt;
| Supported using eager (preloading) and eager_graph (joins) &lt;br /&gt;
| Strategic Eager Loading and by using :summary&lt;br /&gt;
|-&lt;br /&gt;
! &amp;lt;p align=&amp;quot;left&amp;quot;&amp;gt; Flexible Overriding &amp;lt;/p&amp;gt;&lt;br /&gt;
| No. Overriding is done using alias methods.&lt;br /&gt;
| Using methods and by calling 'super'&lt;br /&gt;
| Using methods&lt;br /&gt;
|-&lt;br /&gt;
! &amp;lt;p align=&amp;quot;left&amp;quot;&amp;gt; Dynamic Finders &amp;lt;/p&amp;gt;&lt;br /&gt;
| Yes. Uses 'Method Missing'&lt;br /&gt;
| No. Alternative is to use &amp;lt;Model&amp;gt;.FindOrCreate(:name=&amp;gt;&amp;quot;John&amp;quot;)&lt;br /&gt;
| Yes. Using the dm_ar_finders plugin&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=Further Reading=&lt;br /&gt;
To get more information on ORM and the different type of ORM's available for Ruby , please look into the [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2010/ch3_3j_KS Object-relational mapping Fall 2010] and [http://wiki.expertiza.ncsu.edu/index.php/CSC/ECE_517_Fall_2010/ch3_3f_ac Fall 2010 detailed ORM explanation] wiki pages.&lt;br /&gt;
&lt;br /&gt;
=Future Work=&lt;br /&gt;
More work can be done in the area of comparison between the different ORMs available for Ruby, especially a more detailed feature-by-feature comparison that includes performance differences between the ORMs.&lt;br /&gt;
&lt;br /&gt;
=References=&lt;br /&gt;
&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Object-relational_mapping Wikipedia, Object-relational mapping (ORM)]&lt;br /&gt;
# [http://ar.rubyonrails.org/  ActiveRecord]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Active_record_pattern Wikipedia Active record pattern]&lt;br /&gt;
# [http://sequel.rubyforge.org/ Sequel]&lt;br /&gt;
# [http://jeremyevans-pres.heroku.com/mwrc2009_presentation.html  Sequel Presentation - By Jeremy Evans]&lt;br /&gt;
# [http://merbist.com/2008/09/29/write-your-own-custom-datamapper-adapter/  Merbist blog on custom DM adapters - By Matt Aimonetti]&lt;br /&gt;
# [http://en.wikipedia.org/wiki/Datamapper DataMapper]&lt;br /&gt;
# [http://pg-server.csc.ncsu.edu/mediawiki/index.php/CSC/ECE_517_Fall_2007/wiki2_2_22 Object-Relational Mapping Fall 2007]&lt;br /&gt;
# [http://ormbattle.net/ ORMBattle.Net]&lt;br /&gt;
# [http://wiki.rubyonrails.org/howtos/db-relationships/eager-loading Eager-loading description on Rails Wiki]&lt;br /&gt;
# [http://ibatis.apache.org/ iBATIS]&lt;br /&gt;
# [http://ibatis.apache.org/docs/ruby/ RBatis - iBATIS for Ruby and Ruby on Rails]&lt;br /&gt;
# [http://www.merbivore.com/index.html Merb]&lt;/div&gt;</summary>
		<author><name>Eblumpki2</name></author>
	</entry>
</feed>