• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

sathish316/metaprogramming_koans: Ruby Metaprograaming Koans (Inspired by EdgeCa ...

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称:

sathish316/metaprogramming_koans

开源软件地址:

https://github.com/sathish316/metaprogramming_koans

开源编程语言:

Ruby 100.0%

开源软件介绍:

Ruby Metaprogramming Koans

Ruby Metaprogramming Koans walk you along the path to enlightenment in order to learn Metaprogramming in Ruby. It is inspired by the original Ruby koans (rubykoans.com) by Jim Weirich which can be forked here: github.com/edgecase/ruby_koans

Koans teach you a programming language using Tests/TDD. Metaprogramming koans attempts to teach Ruby metaprogramming using the same philosophy of koans used for programming languages.

Metaprogramming examples

The metaprogramming examples used in the koans are derived from the following sources:

  1. Seeing Metaclasses clearly by _why

dannytatom.github.com/metaid/

  1. Metaprogramming in Ruby: It’s All About the Self by Yehuda Katz

yehudakatz.com/2009/11/15/metaprogramming-in-ruby-its-all-about-the-self/

  1. Ruby Object model and Metaprogramming screencasts by Dave Thomas

pragprog.com/screencasts/v-dtrubyom/the-ruby-object-model-and-metaprogramming

The koans are a starting point and only supplement the above articles/books/videos. Please use the original source for more enlightenment.

The Structure

The koans are broken out into areas by file, metaclasses are covered in about_metaclasses.rb, define_method is covered in about_define_method.rb, etc. They are presented in order in the path_to_enlightenment.rb file.

Each koan builds up your knowledge of Ruby metaprogramming and builds upon itself. Koans will have __ or _ which you need to fill in with the correct answer to progress.

Installing Ruby

The koans require Ruby 1.9.2. To install Ruby:

  1. Install RVM beginrescueend.com/rvm/install/

  2. Install Ruby beginrescueend.com/rvm/install/

$ rvm install ruby-1.9.2

All the koans are in Test::Unit and don't require additional gems

The Path To Enlightenment

To start working your way through the koans, run rake

metaprogramming_koans$ rake

To run a specific koan, run it with ruby:

metaprogramming_koans$ ruby about_metaclasses.rb

Follow the instructions and keep filling the answers to start your journey towards mastering metaprogramming in Ruby

Inspiration

The Little Schemer (www.amazon.com/Little-Schemer-Daniel-P-Friedman/dp/0262560992) by Daniel Friedman is one of my all time favorite programming books. It follows the socratic instruction method, which is teaching by way of asking progressively complex questions. You can learn the basic concepts of Lisp/Scheme in a few hours.

I checked out Ruby Koans (rubykoans.com/) by JimWeirich and solved it. The idea of learning a new language using Test driven development was fascinating. It was very similar to the approach in Little Schemer, except that instead of a book, it is an automated testsuite that's asking you questions.

If you're learning Ruby, you should check out the original koans (github.com/edgecase/ruby_koans) first:

Other Resources

To get more insight on the Ruby koans way of learning, check out the EdgeCase Ruby koans (github.com/edgecase/ruby_koans):

Following are some more resources to learn Metaprogramming in Ruby:

  1. Seeing Metaclasses early dannytatom.github.com/metaid/

  2. Ruby Object model and metaprogramming screencasts pragprog.com/screencasts/v-dtrubyom/the-ruby-object-model-and-metaprogramming

  3. Metaprogramming Ruby pragprog.com/book/ppmetr/metaprogramming-ruby

How do i add my own koans?

To add your own koans and contribute to the community:

  1. Fork this repo

  2. Copy src/about_template.rb to src/about_foo.rb

  3. Add src/about_foo to src/path_to_enlightenment.rb

  4. Start adding your koans as test cases

  5. Make sure the solved koans work by running: ruby about_foo.rb

  6. Execute $rake gen to generate koans/about_foo.rb with all assertions replaced with __

  7. Create pull request

License

You're free to copy, add, change or distribute the koans here. The structure of this whole project is forked from Edgecase Ruby koans (github.com/edgecase/ruby_koans)




鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Alsiso/Koala: Koala 一 更简洁高效的基础样式库发布时间:2022-06-24
下一篇:
Jay214/myblog-koa2发布时间:2022-06-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap