• Save
DSLs Internas e Ruby
Upcoming SlideShare
Loading in...5
×
 

DSLs Internas e Ruby

on

  • 2,254 views

Palestra que aconteceu no Rails Summit Latin America 2009, em São Paulo - Brasil.

Palestra que aconteceu no Rails Summit Latin America 2009, em São Paulo - Brasil.

Statistics

Views

Total Views
2,254
Views on SlideShare
2,233
Embed Views
21

Actions

Likes
1
Downloads
0
Comments
0

4 Embeds 21

http://coderwall.com 9
http://www.slideshare.net 6
http://www.linkedin.com 5
https://www.linkedin.com 1

Accessibility

Categories

Upload Details

Uploaded via as Apple Keynote

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

DSLs Internas e Ruby DSLs Internas e Ruby Presentation Transcript

  • DSLs Internas e Ruby @fabiokung
  • DSL? http://www.flickr.com/photos/pragdave/173640462/
  • DSLs internas hoje().mais(meses(2));
  • DSLs internas hoje().mais(uns(2).meses());
  • Date.today + 2.months 4.weeks.ago DSLs internas
  • var d1 = Hoje mais 2 meses var d2 = Amanhã menos 1 mês e mais 10 anos e mais 1 dia Scala: http://gist.github.com/207718 (by Sergio Lopes) Date.today + 2.months 4.weeks.ago DSLs internas
  • DSLs externas
  • Feature: Search courses In order to ensure better utilization of courses Potential students should be able to search for courses Scenario: Search by topic Given there are 240 courses without topic "biology" And there are 2 courses A001, B205 with topic "biology" When I search for "biology" Then I should see the following courses: | Course code | | A001 | | B205 | DSLs externas
  • o problema...
  • http://www.flickr.com/photos/stephenvandyke/96983232/
  • http://www.flickr.com/photos/hand-nor-glove/438290969/ 2.maneiras
  • http://www.flickr.com/photos/aussiegall/759309122/ Top-Down
  • http://www.flickr.com/photos/akiraikari/2657579326/ Bottom-Up
  • hora de codar
  • (define cdar-sequence? (automaton init [init : (c -> more)] [more : (a -> more) (d -> more) (r -> end)] [end : accept]))
  • hora de codar
  • http://martinfowler.com/dslwip/SemanticModel.html Semantic Model
  • http://martinfowler.com/dslwip/SemanticModel.html My advice is to always use a Semantic Semantic Model
  • Resumo • Module.included(klass) • obj.extend(Module) • Class.class_eval { ... } • obj.send(method) • obj.instance_eval { ... }
  • E mais... • method_missing(name, *args) • Class.inherited(subclass) • lambdas, Proc • ...
  • Dúvidas? Obrigado! fabio.kung @ [gmail locaweb] http://twitter.com/fabiokung