CSC/ECE 517 Fall 2009/wiki1b team1: Difference between revisions

From Expertiza_Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
 
(57 intermediate revisions by 2 users not shown)
Line 2: Line 2:


'''
'''
== Resources for Rails ==
== Resources for Rails (other than IDEs) ==
'''
'''


Line 8: Line 8:
that can either replace or supplement IDEs.
that can either replace or supplement IDEs.


Resources for Rails other than IDEs


Rails API - http://api.rubyonrails.org/


This site documents Rails files, classes and methods that can be used to build a Rails application.
'''Resources for Rails other than IDEs
'''
 
 
'''''Rails API''''' - http://api.rubyonrails.org/
 
This site documents Rails files, classes and methods that can be used to build a Rails application. This page also spends some time describing the debugging aspect of Rails, as well as providing a breakdown of the individual components and layout of a Rails application.
 


Rails Forum - http://railsforum.com/
'''''Rails Forum''''' - http://railsforum.com/


A discussion forum covering all aspects of Rails for beginners and experts including planning,  
A discussion forum covering all aspects of Rails for beginners and experts including planning,  
programming, extensions and production.
programming, extensions and production. There are extensive sections on plugin and gem development as well as some interesting AJAX discussions. The most active piece is the Rails programming board.
 
 
'''''Introducing Ruby on Rails'''''


Introducing Ruby on Rails Part 1 http://www.softwaredeveloper.com/features/intro-to-ruby-on-rails-042507/
Part 1 http://www.softwaredeveloper.com/features/intro-to-ruby-on-rails-042507/


                          Part 2 http://www.softwaredeveloper.com/features/intro-to-ruby-on-rails-part-two-043007/
Part 2 http://www.softwaredeveloper.com/features/intro-to-ruby-on-rails-part-two-043007/


An excellent introduction to Rails for novices
An excellent introduction to Rails for novices


Installers


Windows: InstantRails - http://instantrails.rubyforge.org/wiki/wiki.pl
'''''Installers'''
''
Windows: InstantRails - http://instantrails.rubyforge.org/wiki/wiki.pl


An all in one, single click installer for Windows that includes a Rails server.
An all in one, single click installer for Windows that includes a Rails server.
Line 33: Line 43:
Mac: Locomotive - http://locomotive.raaum.org/
Mac: Locomotive - http://locomotive.raaum.org/


http://www.workingwithrails.com/


A Database of Rails projects, programmers and websites
'''''Rails Projects''''' - http://www.workingwithrails.com/
 
A Database of Rails projects, programmers and websites. This is a full blown Rails community that is a one stop shop for all things Rails. It includes forums, examples of websites that utilize Rails, project currently in development and a wealth of sample code. One interesting piece is the Hackfest where people can contribute to Ruby on Rails.
 
 
'''''Rails plugins''''' - http://agilewebdevelopment.com/
 
A collection of Rails open source plugins, searchable by category or keyword. There are currently 1400+ plugins available here and features a rating system for the best plugins as rated by users.
 
 
'''''Sample Rails''''' - http://snippets.dzone.com/tag/rails
 
A collection of Rails code snippets. Snippets are loaded with tags to make them easily searchable. ActiveRecord is the most utilized.
 


Rails plugins: http://agilewebdevelopment.com/
'''''Agile Rails book''''' - http://www.amazon.com/gp/product/097669400X/002-0481267-8083260?v=glance&n=283155


A collection of Rails open source plugins, searchable by category or keyword.
An excellent resource for learning how to apply Agile programming concepts to Rails. This book covers everything from high level Rails architecture to installing a sample application to security and advanced topics. Considerable time is spent analyzing the Rails framework.


Sample Rails - http://snippets.dzone.com/tag/rails


A collection of Rails code snippets
'''''Rails cheatsheet''''' - http://www.blainekendall.com/uploads/RubyOnRails-Cheatsheet-BlaineKendall.pdf


Agile Rails book - http://www.amazon.com/gp/product/097669400X/002-0481267-8083260?v=glance&n=283155
One user's list of best practices, gotchas and quirks of developing with Rails. The cheatsheet covers mappings, ruby commands, database manipulation and a bulk amount of work on testing and Ruby language.


An excellent resource for learning how to apply Agile programming concepts to Rails


Rails cheatsheet - http://www.blainekendall.com/uploads/RubyOnRails-Cheatsheet-BlaineKendall.pdf
'''''Rails best practices''''' - http://www.therailsway.com/


One user's list of best practices, gotchas and quirks of developing with Rails
An official best practices list for programming in Rails. Among the topics of interest are delayed jobs and controller inheritance.


Rails best practices - http://www.therailsway.com/


An official best practices list for programming in Rails
'''''Advanced Rails''''' - http://webonrails.com/


Advanced Rails - http://webonrails.com/
A resource for the advanced Rails programmer. A Ruby programmer's view of what tasks are interesting as an educational style blog.


A resource for the advanced Rails programmer


Rails Blog - http://weblog.rubyonrails.org/
'''''Rails Blog''''' - http://weblog.rubyonrails.org/


An online community of updates about current happenings with the Rails platform
An online community of updates about current happenings with the Rails platform. Included is documentation on Rails programmer conferences.


Rails Guides - http://guides.rubyonrails.org/


An all in one resource for learning Rails including Howtos, security and contributing to the Rails community
'''''Rails Guides''''' - http://guides.rubyonrails.org/


Authoring Rails plugins - http://nubyonrails.com/articles/2006/05/04/the-complete-guide-to-rails-plugins-part-i
An all in one resource for learning Rails including Howtos, security and contributing to the Rails community. The guides are broken down by Model, View and Controller and includes an advanced user section.


A complete guide to authoring your own Rails plugins
 
'''''Rails for the Beginner''''' - http://nubyonrails.com/
 
A complete resource repository for new users of Rails. Links to a number of articles, as well as free software, are available. There is even a link to a Rails podcast.






'''
'''
== Tools for Rails (other than IDEs) ==
 
== '''Tools for Rails (other than IDEs)''' ==
'''
'''


Test Unit
'''Test Unit'''
The Rails stack uses Test::Unit, known as the default Ruby unit testing framework shipping with Ruby.  There are various plugins and extension that could be used with Rails built-in Test::Unit to extend its functionality for support of TDD and BDD testing practices.
The Rails stack uses Test::Unit, known as the default Ruby unit testing framework shipping with Ruby.  There are various plugins and extension that could be used with Rails built-in Test::Unit to extend its functionality for support of TDD and BDD testing practices.


http://wiki.rubyonrails.org/addons/testing
[http://wiki.rubyonrails.org/addons/testing]
The link provides additional information in the form of supporting resources, whitepapers, examples, and plug-in documentation
The link provides additional information in the form of supporting resources, whitepapers, examples, and plug-in documentation


Example
'''Example'''
- http://wiki.rubyonrails.org/testing/test-unitrequire 'test/unit'
[http://wiki.rubyonrails.org/testing/test-unitrequire]


class CalculatorTest < Test::Unit::TestCase  
Image:class CalculatorTest < Test::Unit::TestCase  
   def test_add_two_numbers_for_the_sum  
   def test_add_two_numbers_for_the_sum  
     calculator = Calculator.new  
     calculator = Calculator.new  
     assert_equal 4, calculator.sum(2, 2)
     assert_equal 4, calculator.sum(2, 2)
   end  
   end  
end
end
 
 
//****************************************************************


TDD: Test Driven Development 
== TDD: Test Driven Development ==
 
Test Driven Development is a combination of refactoring and test first development, a form of development where the test is  
Test Driven Development is a combination of refactoring and test first development, a form of development where the test is  


Line 105: Line 124:
requirements.  There are a few testing frameworks that are used to implement the TDD programming technique.   
requirements.  There are a few testing frameworks that are used to implement the TDD programming technique.   


http://ruby.about.com/b/2009/01/28/test-driven-development-with-rails.htm
[http://ruby.about.com/b/2009/01/28/test-driven-development-with-rails.htm]
This link provides a comprehensive overview of test driven development practices and available resources for implementation.
This link provides a comprehensive overview of test driven development practices and available resources for implementation.




RSpec
'''RSpec'''
RSpec is a testing framework for Behavior Driven Development, complete with its own expectations, matchers and mocking and  
RSpec is a testing framework for Behavior Driven Development, complete with its own expectations, matchers and mocking and  


stubbing facilities. It goes along hand in hand with Cucumber, though it plays nicely with many other testing frameworks as well.
stubbing facilities. It goes along hand in hand with Cucumber, though it plays nicely with many other testing frameworks as well.


Model Examples
''Example:''
These are the equivalent of unit tests in Rails’ built in testing. Ironically
 
(for the traditional TDD’er) these are the only specs that we feel should actually interact
The following code will fail during execution.  ''Expresses some basic desired behavior''[http://rspec.info/]
with the database. Learn more ….
 
<nowiki>#</nowiki> bowling_spec.rb
require ‘bowling’
  describe Bowling do
  it "should score 0 for gutter game" do
  bowling = Bowling.new
  20.times { bowling.hit(0) }
  bowling.score.should == 0
  end
end


Controller Examples
These align somewhat with functional tests in rails, except
that they do not actually render views (though you can force rendering of views
if you prefer). Instead of setting expectations about what goes on a page, you
set expectations about what templates get rendered. Learn more….


View Examples
The following code pass execution. ''Just enough code to make it pass.''[http://rspec.info/]
This is the other half of Rails’ functional testing. View specs allow
you to set up assigns (thanks to ZenTest). Learn more ….


Helper Examples
<nowiki>#</nowiki> bowling.rb
let you specify directly methods that live in your helpers. Learn more ….
class Bowling
  def hit(pins)
  end
  def score
    0
  end
end




http://www.ibm.com/developerworks/web/library/wa-rspec/
[http://www.ibm.com/developerworks/web/library/wa-rspec/]
The link provides a brief overview of RSpec with a comprehensive series of examples and a conceptual view of Rpecs step by step  
The link provides a brief overview of RSpec with a comprehensive series of examples and a conceptual view of Rpecs step by step  


Line 139: Line 166:




Cucumber
'''Cucumber'''
Cucumber is used with TDD and BDD within other testing frameworks such as RSpec by letting software development teams describe how  
Cucumber is used with TDD and BDD within other testing frameworks such as RSpec by letting software development teams describe how  


Line 146: Line 173:
documentation, automated tests and development-aid - all rolled into one format.
documentation, automated tests and development-aid - all rolled into one format.


http://cukes.info/
 
''Cucumber Example:''
Feature: Log in and out
  As an administrator
  I want to restrict access to certain portions of my site
  In order to prevent users from changing the content
  Scenario: Logging in
    Given I am not logged in as an administrator
    When I go to the administrative page
    And I fill in the fields
      | Username | admin  |
      | Password | secret |
    And I press "Log in"
    Then I should be on the administrative page
    And I should see "Log out"
  Scenario: Logging out
    ...
 
[http://cukes.info/]
The link provides a detail decription, definition, and examples of Cucumber implementation best practices and supported  
The link provides a detail decription, definition, and examples of Cucumber implementation best practices and supported  


frameworks.
frameworks.


Cucumber Example:
''Another Cucumber Example:''
Scenario: See all vendors
Scenario: See all vendors
     Given I am logged in as a user in the administrator role
     Given I am logged in as a user in the administrator role
Line 159: Line 204:




Shoulda  
'''Shoulda'''
An extension to Test::Unit with additional helpers, macros, and assertions.
An extension to Test::Unit with additional helpers, macros, and assertions.
   
   
http://www.thoughtbot.com/projects/shoulda
[http://www.thoughtbot.com/projects/shoulda]
The link provides a more conclusive definition of Shoulda along with installation facts and working examples of the Shoulda  
The link provides a more conclusive definition of Shoulda along with installation facts and working examples of the Shoulda  


testing framework within Ruby's built in Test::Unit
testing framework within Ruby's built in Test::Unit


//****************************************************************


BDD: Behavior Driven Development (http://eggsonbread.com/2009/07/22/behavior-driven-development-in-a-nutshell/)
''Shoulda Example with Test::Unit''[http://robots.thoughtbot.com/post/159805987/speculating-with-shoulda]
 
class UserTest < ActiveRecord::TestCase
  should_belong_to :account
  should_have_many :posts
  should_validate_presence_of :email
  should_allow_values_for :email, "test@example.com"
  should_not_allow_values_for :email, "test"
end
 
== BDD: Behavior Driven Development ==
[http://eggsonbread.com/2009/07/22/behavior-driven-development-in-a-nutshell/]
Behavior driven development was born from the concepts behind the implementation of TDD.  It brings together strands from  
Behavior driven development was born from the concepts behind the implementation of TDD.  It brings together strands from  


Line 176: Line 231:
approaches to software development more evident.  Most test driven development testing frameworks such as RSpec and Cucumber also support behavior driven development testing.  
approaches to software development more evident.  Most test driven development testing frameworks such as RSpec and Cucumber also support behavior driven development testing.  


http://behaviour-driven.org/
[http://behaviour-driven.org/]
The link supports BDDs definition with additional links to more viable behavior driven development resources.
The link supports BDDs definition with additional links to more viable behavior driven development resources.




//****************************************************************


Other Testing Resources
----
Watir
 
Watir is an open-source library for automating web browsers. It allows you to write tests that are easy to read and maintain. It


is simple and flexible.
'''Other Test Tool Resources'''


http://wtr.rubyforge.org/
''Watir:'' is an open-source library for automating web browsers. It allows you to write tests that are easy to read and maintain. It


is simple and flexible. 
[http://wtr.rubyforge.org/]
The link provides an overview of Watir with installation specifications, examples, and supported platforms


NullDB - http://avdi.org/projects/nulldb/
''NullDB:'' [http://avdi.org/projects/nulldb/]
a way to speed up testing by avoiding database use.
a way to speed up testing by avoiding database use.


Bleakhouse: memory leak detection
''Bleakhouse:'' memory leak detection
[http://www.rubyinside.com/bleakhouse-tool-to-find-memory-leaks-in-your-rails-applications-470.html]
The link gives additional information on Bleakhouse profiling for memory leaks
 
''ruby-debug:''
Other than the extensive use of breakpoints Rails provides little to streamline the debugging process. Ruby-debug provides Rails with a plug-in extending the functionality of Rails built in debugger.
 
[http://rubyforge.org/softwaremap/trove_list.php?form_cat=47]
The link provides twenty additional debug resources available for RoR
 
== '''Conclusion''' ==
 
Rails is a very comprehensive development environment for Ruby with numerous extensions, plugins, and other resources outside of IDEs to strengthen the functionality of the open source web application framework.


ruby-debug
== References ==
Other than the extensive use of breakpoints, ruby-debug provides Rails with a plug-in extending the functionality of Rails built in debugger.


http://rubyforge.org/softwaremap/trove_list.php?form_cat=47
''All sources used to create this wiki are linked in the above text.''
the link provides twenty debug resources
//****************************************************************

Latest revision as of 01:10, 29 September 2009

CSC/ECE 517 Fall 2009

Resources for Rails (other than IDEs)

IDEs are a valuable resource for Rails development, however there are many other resources and tools that can either replace or supplement IDEs.


Resources for Rails other than IDEs


Rails API - http://api.rubyonrails.org/

This site documents Rails files, classes and methods that can be used to build a Rails application. This page also spends some time describing the debugging aspect of Rails, as well as providing a breakdown of the individual components and layout of a Rails application.


Rails Forum - http://railsforum.com/

A discussion forum covering all aspects of Rails for beginners and experts including planning, programming, extensions and production. There are extensive sections on plugin and gem development as well as some interesting AJAX discussions. The most active piece is the Rails programming board.


Introducing Ruby on Rails

Part 1 http://www.softwaredeveloper.com/features/intro-to-ruby-on-rails-042507/

Part 2 http://www.softwaredeveloper.com/features/intro-to-ruby-on-rails-part-two-043007/

An excellent introduction to Rails for novices


Installers

Windows: InstantRails - http://instantrails.rubyforge.org/wiki/wiki.pl

An all in one, single click installer for Windows that includes a Rails server.

Mac: Locomotive - http://locomotive.raaum.org/


Rails Projects - http://www.workingwithrails.com/

A Database of Rails projects, programmers and websites. This is a full blown Rails community that is a one stop shop for all things Rails. It includes forums, examples of websites that utilize Rails, project currently in development and a wealth of sample code. One interesting piece is the Hackfest where people can contribute to Ruby on Rails.


Rails plugins - http://agilewebdevelopment.com/

A collection of Rails open source plugins, searchable by category or keyword. There are currently 1400+ plugins available here and features a rating system for the best plugins as rated by users.


Sample Rails - http://snippets.dzone.com/tag/rails

A collection of Rails code snippets. Snippets are loaded with tags to make them easily searchable. ActiveRecord is the most utilized.


Agile Rails book - http://www.amazon.com/gp/product/097669400X/002-0481267-8083260?v=glance&n=283155

An excellent resource for learning how to apply Agile programming concepts to Rails. This book covers everything from high level Rails architecture to installing a sample application to security and advanced topics. Considerable time is spent analyzing the Rails framework.


Rails cheatsheet - http://www.blainekendall.com/uploads/RubyOnRails-Cheatsheet-BlaineKendall.pdf

One user's list of best practices, gotchas and quirks of developing with Rails. The cheatsheet covers mappings, ruby commands, database manipulation and a bulk amount of work on testing and Ruby language.


Rails best practices - http://www.therailsway.com/

An official best practices list for programming in Rails. Among the topics of interest are delayed jobs and controller inheritance.


Advanced Rails - http://webonrails.com/

A resource for the advanced Rails programmer. A Ruby programmer's view of what tasks are interesting as an educational style blog.


Rails Blog - http://weblog.rubyonrails.org/

An online community of updates about current happenings with the Rails platform. Included is documentation on Rails programmer conferences.


Rails Guides - http://guides.rubyonrails.org/

An all in one resource for learning Rails including Howtos, security and contributing to the Rails community. The guides are broken down by Model, View and Controller and includes an advanced user section.


Rails for the Beginner - http://nubyonrails.com/

A complete resource repository for new users of Rails. Links to a number of articles, as well as free software, are available. There is even a link to a Rails podcast.


Tools for Rails (other than IDEs)

Test Unit The Rails stack uses Test::Unit, known as the default Ruby unit testing framework shipping with Ruby. There are various plugins and extension that could be used with Rails built-in Test::Unit to extend its functionality for support of TDD and BDD testing practices.

[1] The link provides additional information in the form of supporting resources, whitepapers, examples, and plug-in documentation

Example [2]

Image:class CalculatorTest < Test::Unit::TestCase 
 def test_add_two_numbers_for_the_sum 
   calculator = Calculator.new 
   assert_equal 4, calculator.sum(2, 2)
 end 
end

TDD: Test Driven Development

Test Driven Development is a combination of refactoring and test first development, a form of development where the test is

written prior to completed production code. The goal of TDD is the specification of requirements and not the validation of

requirements. There are a few testing frameworks that are used to implement the TDD programming technique.

[3] This link provides a comprehensive overview of test driven development practices and available resources for implementation.


RSpec RSpec is a testing framework for Behavior Driven Development, complete with its own expectations, matchers and mocking and

stubbing facilities. It goes along hand in hand with Cucumber, though it plays nicely with many other testing frameworks as well.

Example:

The following code will fail during execution. Expresses some basic desired behavior[4]

# bowling_spec.rb
require ‘bowling’
 describe Bowling do
  it "should score 0 for gutter game" do
  bowling = Bowling.new
  20.times { bowling.hit(0) }
  bowling.score.should == 0
 end
end


The following code pass execution. Just enough code to make it pass.[5]

# bowling.rb
class Bowling
  def hit(pins)
  end
  def score
    0
  end
end


[6] The link provides a brief overview of RSpec with a comprehensive series of examples and a conceptual view of Rpecs step by step

implementation process


Cucumber Cucumber is used with TDD and BDD within other testing frameworks such as RSpec by letting software development teams describe how

software should behave in plain text. The text is written in a business-readable domain-specific language and serves as

documentation, automated tests and development-aid - all rolled into one format.


Cucumber Example:

Feature: Log in and out
 As an administrator
 I want to restrict access to certain portions of my site
 In order to prevent users from changing the content
 Scenario: Logging in
   Given I am not logged in as an administrator
   When I go to the administrative page
   And I fill in the fields
     | Username | admin  |
     | Password | secret |
   And I press "Log in"
   Then I should be on the administrative page
   And I should see "Log out"
 Scenario: Logging out
   ...

[7] The link provides a detail decription, definition, and examples of Cucumber implementation best practices and supported

frameworks.

Another Cucumber Example: Scenario: See all vendors

   Given I am logged in as a user in the administrator role
   And There are 3 vendors
   When I go to the manage vendors page
   Then I should see the first 3 vendor names


Shoulda An extension to Test::Unit with additional helpers, macros, and assertions.

[8] The link provides a more conclusive definition of Shoulda along with installation facts and working examples of the Shoulda

testing framework within Ruby's built in Test::Unit


Shoulda Example with Test::Unit[9]

class UserTest < ActiveRecord::TestCase
 should_belong_to :account
 should_have_many :posts
 should_validate_presence_of :email
 should_allow_values_for :email, "test@example.com"
 should_not_allow_values_for :email, "test"
end

BDD: Behavior Driven Development

[10] Behavior driven development was born from the concepts behind the implementation of TDD. It brings together strands from

TestDrivenDevelopment and DomainDrivenDesign into an integrated whole, making the relationship between these two powerful

approaches to software development more evident. Most test driven development testing frameworks such as RSpec and Cucumber also support behavior driven development testing.

[11] The link supports BDDs definition with additional links to more viable behavior driven development resources.




Other Test Tool Resources

Watir: is an open-source library for automating web browsers. It allows you to write tests that are easy to read and maintain. It

is simple and flexible. [12] The link provides an overview of Watir with installation specifications, examples, and supported platforms

NullDB: [13] a way to speed up testing by avoiding database use.

Bleakhouse: memory leak detection [14] The link gives additional information on Bleakhouse profiling for memory leaks

ruby-debug: Other than the extensive use of breakpoints Rails provides little to streamline the debugging process. Ruby-debug provides Rails with a plug-in extending the functionality of Rails built in debugger.

[15] The link provides twenty additional debug resources available for RoR

Conclusion

Rails is a very comprehensive development environment for Ruby with numerous extensions, plugins, and other resources outside of IDEs to strengthen the functionality of the open source web application framework.

References

All sources used to create this wiki are linked in the above text.