Ruby Class 1

801 views
716 views

Published on

The slides from the first Ruby Class

Published in: Technology, Education
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
801
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
11
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Ruby Class 1

  1. 1. RubyClass<br />
  2. 2. The Ruby Language<br />Originally by Yukihiro "Matz" Matsumoto<br />“Ruby is designed for programmer productivity and fun, following the principles of good user interface design. He stresses that systems design needs to emphasize human, rather than computer, needs.”<br />http://en.wikipedia.org/wiki/Ruby_(programming_language)#History<br />Ruby 1.0 was released in 1996. <br />
  3. 3. The Ruby Language<br />Dynamically typed<br />Interpreted<br />Can be modified at runtime<br />Object oriented<br />Blocks & lambdas<br />Nice support for Regular Expressions <br />
  4. 4. Ruby Implementations<br />Ruby 1.8.x (MRI)<br />Ruby 1.9.x (YARV)<br />Rubinius<br />JRuby<br />MacRuby, HotCocoa<br />IronRuby for .NET<br />
  5. 5. What you will learn<br />Ruby<br />Language concepts & tools<br />Language syntax<br />Some standard library classes & gems<br />Common patterns<br />
  6. 6. Book<br />The Well-Grounded RubyistCovering Ruby 1.9David A. Black<br />
  7. 7. How you will learn<br />Exploration: experiment, play<br />Test-Driven Development (TDD)<br />Initially as a learning methodology<br />Later as a development methodology<br />Ask questions<br />Learn to find your own answers<br />Read<br />Plus whatever works best for you<br />
  8. 8. Class Structure<br />Talk<br />Live Coding Demonstrations<br />In-class coding<br />Coding at home (or in social groups)<br />Google Group<br />
  9. 9. Other Resources<br />SF Ruby Meetup<br />RailsBridge<br />See Last page of hand-out for more<br />
  10. 10.
  11. 11. Ruby Language Overview<br />Dynamically typed<br />Interpreted<br />Can be modified at runtime<br />Object oriented<br />Blocks & lambdas<br />Nice support for Regular Expressions <br />
  12. 12. Lets get started<br />IRB: InteractiveRuBy<br />>> 4<br />>> 4 + 4<br />
  13. 13. Everything is an object<br />“test”.upcase<br />“test”.class<br />“test”.methods<br />
  14. 14. Everything evaluates to something<br />2 + 2<br />(2+2).zero?<br />
  15. 15. Methods are Messages<br />thing.do(4)<br />thing.do 4<br />thing.send “do”, 4<br />
  16. 16. Operators are Methods<br />thing.do 4<br />thing.do(4)<br />thing.send “do”, 4<br />1 + 2<br />1.+(2)<br />1.send "+", 2<br />
  17. 17. Write your first Ruby class<br />
  18. 18. Test-First Learning<br />Similar methodology to TDDwith a different purpose and workflow<br />Teacher writes the test<br />Student implements the code<br />
  19. 19. Test-Driven Development<br />Design<br />Focus / Project Management<br />Documentation / Collaboration<br />Creation of Tests<br />
  20. 20. Moving to TDD<br />Build tests before refactoring or upgrading<br />Test-drive bug fixes<br />Write tests for anything you worry about<br />Continuous Integration is essential<br />Remove unused (untested) code<br />
  21. 21. RED – GREEN – REFACTOR<br />Write the test<br />Watch it fail<br />Make it pass<br />Make the code good, make sure it still passes<br />
  22. 22. Unit Test Frameworks<br />Test::Unit<br />Shoulda<br />Rspec<br />http://github.com/ultrasaurus/test-framework-comparison<br />
  23. 23. Integration Test Frameworks<br />Cucumber<br />Webrat<br />Selenium<br />And more…<br />
  24. 24. Rspec<br />Describe the feature<br />Verify expectation<br />
  25. 25. Demonstration<br />

×