Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Lapidando ruby

1,454 views

Published on

Published in: News & Politics
  • DOWNLOAD THIS BOOKS INTO AVAILABLE FORMAT (2019 Update) ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { https://soo.gd/irt2 } ......................................................................................................................... Download Full EPUB Ebook here { https://soo.gd/irt2 } ......................................................................................................................... Download Full doc Ebook here { https://soo.gd/irt2 } ......................................................................................................................... Download PDF EBOOK here { https://soo.gd/irt2 } ......................................................................................................................... Download EPUB Ebook here { https://soo.gd/irt2 } ......................................................................................................................... Download doc Ebook here { https://soo.gd/irt2 } ......................................................................................................................... ......................................................................................................................... ................................................................................................................................... eBook is an electronic version of a traditional print book THIS can be read by using a personal computer or by using an eBook reader. (An eBook reader can be a software application for use on a computer such as Microsoft's free Reader application, or a book-sized computer THIS is used solely as a reading device such as Nuvomedia's Rocket eBook.) Users can purchase an eBook on diskette or CD, but the most popular method of getting an eBook is to purchase a downloadable file of the eBook (or other reading material) from a Web site (such as Barnes and Noble) to be read from the user's computer or reading device. Generally, an eBook can be downloaded in five minutes or less ......................................................................................................................... .............. Browse by Genre Available eBooks .............................................................................................................................. Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, ......................................................................................................................... ......................................................................................................................... .....BEST SELLER FOR EBOOK RECOMMEND............................................................. ......................................................................................................................... Blowout: Corrupted Democracy, Rogue State Russia, and the Richest, Most Destructive Industry on Earth,-- The Ride of a Lifetime: Lessons Learned from 15 Years as CEO of the Walt Disney Company,-- Call Sign Chaos: Learning to Lead,-- StrengthsFinder 2.0,-- Stillness Is the Key,-- She Said: Breaking the Sexual Harassment Story THIS Helped Ignite a Movement,-- Atomic Habits: An Easy & Proven Way to Build Good Habits & Break Bad Ones,-- Everything Is Figureoutable,-- What It Takes: Lessons in the Pursuit of Excellence,-- Rich Dad Poor Dad: What the Rich Teach Their Kids About Money THIS the Poor and Middle Class Do Not!,-- The Total Money Makeover: Classic Edition: A Proven Plan for Financial Fitness,-- Shut Up and Listen!: Hard Business Truths THIS Will Help You Succeed, ......................................................................................................................... .........................................................................................................................
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • DOWNLOAD THIS BOOKS INTO AVAILABLE FORMAT (Unlimited) ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { https://soo.gd/qURD } ......................................................................................................................... Download Full EPUB Ebook here { https://soo.gd/qURD } ......................................................................................................................... Download Full doc Ebook here { https://soo.gd/qURD } ......................................................................................................................... Download PDF EBOOK here { https://soo.gd/qURD } ......................................................................................................................... Download EPUB Ebook here { https://soo.gd/qURD } ......................................................................................................................... Download doc Ebook here { https://soo.gd/qURD } ......................................................................................................................... ......................................................................................................................... ................................................................................................................................... eBook is an electronic version of a traditional print book THIS can be read by using a personal computer or by using an eBook reader. (An eBook reader can be a software application for use on a computer such as Microsoft's free Reader application, or a book-sized computer THIS is used solely as a reading device such as Nuvomedia's Rocket eBook.) Users can purchase an eBook on diskette or CD, but the most popular method of getting an eBook is to purchase a downloadable file of the eBook (or other reading material) from a Web site (such as Barnes and Noble) to be read from the user's computer or reading device. Generally, an eBook can be downloaded in five minutes or less ......................................................................................................................... .............. Browse by Genre Available eBooks .............................................................................................................................. Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, ......................................................................................................................... ......................................................................................................................... .....BEST SELLER FOR EBOOK RECOMMEND............................................................. ......................................................................................................................... Blowout: Corrupted Democracy, Rogue State Russia, and the Richest, Most Destructive Industry on Earth,-- The Ride of a Lifetime: Lessons Learned from 15 Years as CEO of the Walt Disney Company,-- Call Sign Chaos: Learning to Lead,-- StrengthsFinder 2.0,-- Stillness Is the Key,-- She Said: Breaking the Sexual Harassment Story THIS Helped Ignite a Movement,-- Atomic Habits: An Easy & Proven Way to Build Good Habits & Break Bad Ones,-- Everything Is Figureoutable,-- What It Takes: Lessons in the Pursuit of Excellence,-- Rich Dad Poor Dad: What the Rich Teach Their Kids About Money THIS the Poor and Middle Class Do Not!,-- The Total Money Makeover: Classic Edition: A Proven Plan for Financial Fitness,-- Shut Up and Listen!: Hard Business Truths THIS Will Help You Succeed, ......................................................................................................................... .........................................................................................................................
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • DOWNLOAD THIS BOOKS INTO AVAILABLE FORMAT (2019 Update) ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { https://soo.gd/irt2 } ......................................................................................................................... Download Full EPUB Ebook here { https://soo.gd/irt2 } ......................................................................................................................... Download Full doc Ebook here { https://soo.gd/irt2 } ......................................................................................................................... Download PDF EBOOK here { https://soo.gd/irt2 } ......................................................................................................................... Download EPUB Ebook here { https://soo.gd/irt2 } ......................................................................................................................... Download doc Ebook here { https://soo.gd/irt2 } ......................................................................................................................... ......................................................................................................................... ................................................................................................................................... eBook is an electronic version of a traditional print book THIS can be read by using a personal computer or by using an eBook reader. (An eBook reader can be a software application for use on a computer such as Microsoft's free Reader application, or a book-sized computer THIS is used solely as a reading device such as Nuvomedia's Rocket eBook.) Users can purchase an eBook on diskette or CD, but the most popular method of getting an eBook is to purchase a downloadable file of the eBook (or other reading material) from a Web site (such as Barnes and Noble) to be read from the user's computer or reading device. Generally, an eBook can be downloaded in five minutes or less ......................................................................................................................... .............. Browse by Genre Available eBooks .............................................................................................................................. Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, ......................................................................................................................... ......................................................................................................................... .....BEST SELLER FOR EBOOK RECOMMEND............................................................. ......................................................................................................................... Blowout: Corrupted Democracy, Rogue State Russia, and the Richest, Most Destructive Industry on Earth,-- The Ride of a Lifetime: Lessons Learned from 15 Years as CEO of the Walt Disney Company,-- Call Sign Chaos: Learning to Lead,-- StrengthsFinder 2.0,-- Stillness Is the Key,-- She Said: Breaking the Sexual Harassment Story THIS Helped Ignite a Movement,-- Atomic Habits: An Easy & Proven Way to Build Good Habits & Break Bad Ones,-- Everything Is Figureoutable,-- What It Takes: Lessons in the Pursuit of Excellence,-- Rich Dad Poor Dad: What the Rich Teach Their Kids About Money THIS the Poor and Middle Class Do Not!,-- The Total Money Makeover: Classic Edition: A Proven Plan for Financial Fitness,-- Shut Up and Listen!: Hard Business Truths THIS Will Help You Succeed, ......................................................................................................................... .........................................................................................................................
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • DOWNLOAD THIS BOOKS INTO AVAILABLE FORMAT (2019 Update) ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { https://soo.gd/irt2 } ......................................................................................................................... Download Full EPUB Ebook here { https://soo.gd/irt2 } ......................................................................................................................... Download Full doc Ebook here { https://soo.gd/irt2 } ......................................................................................................................... Download PDF EBOOK here { https://soo.gd/irt2 } ......................................................................................................................... Download EPUB Ebook here { https://soo.gd/irt2 } ......................................................................................................................... Download doc Ebook here { https://soo.gd/irt2 } ......................................................................................................................... ......................................................................................................................... ................................................................................................................................... eBook is an electronic version of a traditional print book THIS can be read by using a personal computer or by using an eBook reader. (An eBook reader can be a software application for use on a computer such as Microsoft's free Reader application, or a book-sized computer THIS is used solely as a reading device such as Nuvomedia's Rocket eBook.) Users can purchase an eBook on diskette or CD, but the most popular method of getting an eBook is to purchase a downloadable file of the eBook (or other reading material) from a Web site (such as Barnes and Noble) to be read from the user's computer or reading device. Generally, an eBook can be downloaded in five minutes or less ......................................................................................................................... .............. Browse by Genre Available eBooks .............................................................................................................................. Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, ......................................................................................................................... ......................................................................................................................... .....BEST SELLER FOR EBOOK RECOMMEND............................................................. ......................................................................................................................... Blowout: Corrupted Democracy, Rogue State Russia, and the Richest, Most Destructive Industry on Earth,-- The Ride of a Lifetime: Lessons Learned from 15 Years as CEO of the Walt Disney Company,-- Call Sign Chaos: Learning to Lead,-- StrengthsFinder 2.0,-- Stillness Is the Key,-- She Said: Breaking the Sexual Harassment Story THIS Helped Ignite a Movement,-- Atomic Habits: An Easy & Proven Way to Build Good Habits & Break Bad Ones,-- Everything Is Figureoutable,-- What It Takes: Lessons in the Pursuit of Excellence,-- Rich Dad Poor Dad: What the Rich Teach Their Kids About Money THIS the Poor and Middle Class Do Not!,-- The Total Money Makeover: Classic Edition: A Proven Plan for Financial Fitness,-- Shut Up and Listen!: Hard Business Truths THIS Will Help You Succeed, ......................................................................................................................... .........................................................................................................................
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • DOWNLOAD THIS BOOKS INTO AVAILABLE FORMAT (Unlimited) ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { https://soo.gd/qURD } ......................................................................................................................... Download Full EPUB Ebook here { https://soo.gd/qURD } ......................................................................................................................... Download Full doc Ebook here { https://soo.gd/qURD } ......................................................................................................................... Download PDF EBOOK here { https://soo.gd/qURD } ......................................................................................................................... Download EPUB Ebook here { https://soo.gd/qURD } ......................................................................................................................... Download doc Ebook here { https://soo.gd/qURD } ......................................................................................................................... ......................................................................................................................... ................................................................................................................................... eBook is an electronic version of a traditional print book THIS can be read by using a personal computer or by using an eBook reader. (An eBook reader can be a software application for use on a computer such as Microsoft's free Reader application, or a book-sized computer THIS is used solely as a reading device such as Nuvomedia's Rocket eBook.) Users can purchase an eBook on diskette or CD, but the most popular method of getting an eBook is to purchase a downloadable file of the eBook (or other reading material) from a Web site (such as Barnes and Noble) to be read from the user's computer or reading device. Generally, an eBook can be downloaded in five minutes or less ......................................................................................................................... .............. Browse by Genre Available eBooks .............................................................................................................................. Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, ......................................................................................................................... ......................................................................................................................... .....BEST SELLER FOR EBOOK RECOMMEND............................................................. ......................................................................................................................... Blowout: Corrupted Democracy, Rogue State Russia, and the Richest, Most Destructive Industry on Earth,-- The Ride of a Lifetime: Lessons Learned from 15 Years as CEO of the Walt Disney Company,-- Call Sign Chaos: Learning to Lead,-- StrengthsFinder 2.0,-- Stillness Is the Key,-- She Said: Breaking the Sexual Harassment Story THIS Helped Ignite a Movement,-- Atomic Habits: An Easy & Proven Way to Build Good Habits & Break Bad Ones,-- Everything Is Figureoutable,-- What It Takes: Lessons in the Pursuit of Excellence,-- Rich Dad Poor Dad: What the Rich Teach Their Kids About Money THIS the Poor and Middle Class Do Not!,-- The Total Money Makeover: Classic Edition: A Proven Plan for Financial Fitness,-- Shut Up and Listen!: Hard Business Truths THIS Will Help You Succeed, ......................................................................................................................... .........................................................................................................................
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • Be the first to like this

Lapidando ruby

  1. 1. Lapidando Ruby A Work in Progress Maurício Eduardo Szabo [email_address] @mauricio_szabo http://mauricioszabo.wordpress.com
  2. 2. Nesta Apresentação... <ul><li>subject { You.new } </li><ul><li>Ruby.new.should be_false
  3. 3. knowledges.should include(RSpec)
  4. 4. should be_open_to_new_ideas </li></ul></ul>
  5. 5. Por quê? Aquela jovem é uma das menos ignorantemente aparvalhadas formas de vida orgânica que eu já tive a profunda falta de prazer de não ser capaz de evitar encontrar
  6. 6. Não Teremos...
  7. 7. Boas práticas <ul><li>Prefira instância
  8. 8. Entenda Ruby
  9. 9. Seja claro </li><ul><li>Logo - TO </li></ul><li>Seja preciso
  10. 10. TESTES! </li></ul>
  11. 11. Ruby não é... <ul><li>Perl </li><ul><li>a.size == 0 or abort </li></ul><li>PHP </li><ul><li>for element in array </li></ul><li>Java </li><ul><li>array.size.times { |i| element = array[i] } </li></ul><li>Basic, Cobol, Pascal, C... </li><ul><li>a = create_person(:name => 'Foo')
  12. 12. save_person(a) </li></ul></ul>
  13. 13. Rescue Me! (Estes códigos são equivalentes!)
  14. 14. Não Abuse da Linguagem <ul><li>Ruby ajuda muito, mas use com moderação </li><ul><li>yield sobre yield sobre yield sobre... </li><ul><li>Difícil de entender, e LENTO </li></ul><li>Não use coisas que podem depender da implementação de Ruby </li><ul><li>Se for necessário fazer isso, ISOLE-AS e TESTE-AS INTENSIVAMENTE!
  15. 15. Evite depender de comportamentos não-documentados </li><ul><li>return array.delete_if { |e| ... } </li></ul></ul></ul></ul>
  16. 16. Evite Efeitos Colaterais Se você puder chamar um método duas vezes e ele retornar o MESMO valor, melhor!
  17. 17. DEFina Direito! Código deve ser escrito como um “jornal”
  18. 18. Não Seja Menos Claro
  19. 19. Flags?
  20. 20. Idente Tudo... ...MAS...
  21. 21. ...Evite Identar
  22. 22. Floats? <ul><li>Imprecisos
  23. 23. SPECs vão falhar </li><ul><li>use should be_close
  24. 24. Melhor ainda, use BigDecimal </li></ul></ul>
  25. 25. Não Modifique os Parâmetros
  26. 26. OCP e MonkeyPatch <ul><li>Classes devem ser ABERTAS para adição e FECHADAS para modificação </li><ul><li>Modificar métodos é legal, mas é a maior fonte de problemas </li></ul></ul>
  27. 27. TDD e BDD <ul><li>Diferenças?
  28. 28. Como testar, e o quê testar?
  29. 29. Como manter a clareza?
  30. 30. Como evitar testes frágeis?
  31. 31. Como facilitar os testes? </li></ul>
  32. 32. BDD <ul><li>Não são testes, são comportamentos </li><ul><li>O teste é um “efeito colateral” </li></ul><li>Sapir-Whorf, ou Linguistic Relativity </li><ul><li>Mesmo conceito usado pelo RSpec
  33. 33. Mesmo conceito por trás do Ruby </li></ul><li>O que é, afinal, um “unit test”? </li><ul><li>Ou um “unit”? </li></ul></ul>
  34. 34. RSpec <ul><li>person.old?.should == true </li><ul><li>person.old?.should be_true
  35. 35. person.should be_old </li></ul><li>person.childs.size.should == 10 </li><ul><li>person.should have(10).childs </li></ul><li>array.size.should == 5 </li><ul><li>array.should have(5).itens </li></ul></ul>
  36. 36. RSpec on Rails WTF???
  37. 37. Seja explícito...
  38. 38. Mas seja implícito! Lembre-se SEMPRE do que você está descrevendo!
  39. 39. Mocks <ul><li>Muito usados nos Controllers do Rails </li><ul><li>Quando eu te perguntar, da próxima vez, exatamente “quem é você”, me responda “um teste”, ok?
  40. 40. Você está testando, ou está escrevendo o código final? </li></ul></ul>
  41. 41. Mocks <ul><li>Um aluno precisa escolher disciplinas </li><ul><li>eu SEI que um aluno estará logado...
  42. 42. eu SEI que o aluno estará cadastrado...
  43. 43. eu SEI que haverá uma ou mais disciplinas...
  44. 44. mas NÃO SEI qual o código. </li></ul></ul>
  45. 45. Custom Matchers
  46. 46. Custom Matchers
  47. 47. Facilite seus testes! <ul><li>O que os dois a seguir tem em comum? </li><ul><li>stub_model
  48. 48. Factories </li></ul><li>Crie suas facilidades! </li><ul><li>stub_rest, talvez?
  49. 49. http://github.com/defunkt/fakefs </li></ul><li>Ler - Scripted GUI Testing with Ruby </li></ul>
  50. 50. Mais uma coisa <ul><li>Reek (gem install reek) </li><ul><li>Procura por “smells” em seu código
  51. 51. Bom quando se está iniciando </li></ul><li>Flog (gem install flog) </li><ul><li>Procura por “código torturado”
  52. 52. Bom de ser usado em qualquer situação </li></ul><li>Metrics_fu </li><ul><li>Plugin para Rails, incorpora Flog, Reek, RCov, etc... </li></ul></ul>
  53. 53. Considerações <ul><li>Ler: </li><ul><li>Clean Code, Robert Martin
  54. 54. Design Patterns, GoF </li></ul><li>Quando estiver programado: </li><ul><li>Melhorar sempre o código
  55. 55. Cuidado com o termo “melhorar” </li></ul><li>Evite: </li><ul><li>Comentários explicando o que o código faz </li></ul></ul>
  56. 56. Dúvidas? <ul><li>The Power and Philosofy of Ruby: http://bit.ly/aMFAmj (Matz)
  57. 57. A new look at Test-Driven Development: http://bit.ly/7nYyhD (Dave Astels)
  58. 58. Clean Code: http://bit.ly/bUzV7k (Robert Martin)
  59. 59. Design Patterns in Ruby: http://bit.ly/9bKRQV (Russell Olsen)
  60. 60. Scripted GUI Testing with Ruby: http://bit.ly/a0etMC (Ian Dees) </li></ul>

×