Dont Build Another Tower of Babel

675 views
608 views

Published on

To many rails applications suffer from ActiveRecorditis in their models. We expose the api of our domain to the other layers of the application (controllers and views) offering methods that have nothing to do with the domain we are modelling. Our problem?

The language we use is not the language our customers use!

In this talk I will be talking about the issues of naming and how you can (and should) avoid translating your customers language and write applications that map to your customers view of the world creating so a rich domain model which leads to simple to understand code without translating the language of your customer avoiding so The Towel of Babel.

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

  • Be the first to like this

No Downloads
Views
Total views
675
On SlideShare
0
From Embeds
0
Number of Embeds
44
Actions
Shares
0
Downloads
6
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide
  • \n
  • And the whole earth was of one language, and of one speech.\n\nAnd it came to pass, as they journeyed from the east, that they found a plain in the land of Shinar; and they dwelt there.\n\nAnd they said one to another, Go to, let us make brick, and burn them thoroughly. And they had brick for stone, and slime had they for mortar.\n\nAnd they said, Go to, let us build us a city and a tower, whose top may reach unto heaven; and let us make us a name, lest we be scattered abroad upon the face of the whole earth.\n\nAnd the Lord came down to see the city and the tower, which the children built.\n\nAnd the Lord said, Behold, the people is one, and they have all one language; and this they begin to do; and now nothing will be restrained from them, which they have imagined to do.\n\nGo to, let us go down, and there confound their language, that they may not understand one another's speech.\n\nSo the Lord scattered them abroad from thence upon the face of all the earth: and they left off to build the city.\n\nTherefore is the name of it called Babel; because the Lord did there confound the language of all the earth: and from thence did the Lord scatter them abroad upon the face of all the earth.\n
  • \n
  • language (as a context for communication, and primarily as a cognitive ability to form concepts and communicate them) was developed earlier in human evolution, and speech (one of the forms of communication) was developed much later. The presence of speech (without language) is also possible in some cases of human mental retardation or learning disabilities(like Specific Language Impairment) and is also known in the animal kingdom. For instance, talking birds are able to imitate human speech with varying ability. However, this ability to mimic human sounds is very different from the acquisition of syntax. Likewise, the production of speech sounds is not necessary for language use, as evidenced by modern sign languages, which use manual symbols and facial grammar as a basis for language rather than speech. Morse coding system, and the system of the Marine Signal Flags are other forms of communication, but not necessarily language.\n
  • \n
  • \n
  • \n
  • \n
  • \n
  • single responsibility principle states that every object should have a single responsibility, and that responsibility should be entirely encapsulated by the class. All its services should be narrowly aligned with that responsibility.\n
  • single responsibility principle states that every object should have a single responsibility, and that responsibility should be entirely encapsulated by the class. All its services should be narrowly aligned with that responsibility.\n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • \n
  • Dont Build Another Tower of Babel

    1. 1. Don’t build anotherTower of Babel Enrique Comba Riepenhausen @ecomba http://ecomba.org
    2. 2. ‫א   וַ יְ הִי כָל- הָאֶָרץ, ׂשָפָה אֶחָת, ּוְד בִָרים, אֲחִָדים.‬ ‫ב   וַ יְ הִי, ּבְ נָ סְעָם מִּקֶֶדם; וַ ּיִמְצְאּו בְִקעָה ּבְאֶֶרץ ׁשִ נְעָר, וַ ּיֵׁשְבּו ׁשָם.‬ ‫ג   וַ ּיֹאמְרּו אִיׁש אֶל-ֵרעֵהּו, הָ בָה נִלְ ּבְ נָה לְ בֵ נִים, וְ נִׂשְְרפָה, לִׂשְֵרפָה;‬ ‫וַּתְ הִי לָ הֶם הַּלְ בֵ נָה, לְאָ בֶן, וְ הַחֵמָר, הָ יָה לָ הֶם לַחֹמֶר.‬‫ד   וַ ּיֹאמְרּו הָ בָה נִ בְ נֶה-ּלָנּו עִיר, ּומִ גְ ּדָל וְֹראׁשֹו בַּׁשָמַ יִם, וְ נַעֲׂשֶה-ּלָנּו,‬ ‫ׁשֵם:  ּפֶן- נָפּוץ, עַל-ּפְ נֵי כָל- הָאֶָרץ.‬‫ה   וַ ּיֵֶרד יְה וָה, לְִראֹת אֶת- הָעִיר וְאֶת- הַּמִ גְ ּדָל, אֲׁשֶר ּבָנּו, ּבְ נֵי הָאָָדם.‬ ‫ו   וַ ּיֹאמֶר יְה וָה, הֵן עַם אֶחָד וְׂשָפָה אַחַת לְכֻּלָם, וְ זֶה, הַחִּלָם‬ ‫לַעֲׂשֹות; וְעַּתָה ֹלא- יִ ּבָצֵר מֵ הֶם, ּכֹל אֲׁשֶר יָ זְמּו לַעֲׂשֹות.‬ ‫ז   הָ בָה, נְֵרָדה, וְ נָ בְלָה ׁשָם, ׂשְפָתָם--אֲׁשֶר ֹלא יִׁשְמְעּו, אִיׁש ׂשְפַת‬ ‫ֵרעֵהּו.‬ ‫ח   וַ ּיָפֶץ יְה וָה אֹתָם מִּׁשָם, עַל-ּפְ נֵי כָל- הָאֶָרץ; וַ ּיַחְ ּדְלּו, לִ בְ נֹת הָעִיר.‬ ‫ט  עַל-ּכֵן ָקָרא ׁשְמָּה, ּבָ בֶל, ּכִי-ׁשָם ּבָלַל יְה וָה, ׂשְפַת ּכָל- הָאֶָרץ;‬ ‫ּומִּׁשָם הֱפִיצָם יְה וָה, עַל-ּפְ נֵי ּכָל- הָאֶָרץ.‬ ‫)5681( ‪The Confusion of Tongues by Gustave Doré‬‬
    3. 3. Languagecognitive ability to form concepts and communicate them.
    4. 4. User.find(params[:id])
    5. 5. User.find(params[:id])Trade.find(:all, :conditions => filter_str, :include => [:trade_processes, :broker, :requested_by, {:security => {:sector => [:primary_specialist, :secondary_specialist]}}, {:advice => [{:fund => [:primary_advisor, :secondary_advisor]},]},])
    6. 6. User.find(params[:id])Trade.find(:all, :conditions => filter_str, :include => [:trade_processes, :broker, :requested_by, {:security => {:sector => [:primary_specialist, :secondary_specialist]}}, {:advice => [{:fund => [:primary_advisor, :secondary_advisor]},]},]) JESUS CRAP!
    7. 7. @trade = Trade.new(params[:trade])if @trade.save ...end
    8. 8. Active Record Trade value advice find save An object that wraps a row in a database table orview, encapsulates the database access, and adds domain logic on that data.
    9. 9. Single Responsibility Principle?
    10. 10. Single Responsibility Principle?
    11. 11. Domain ModelAn object model of the domain that incorporates both behaviour and data.
    12. 12. Appointment.book_on(date)Subscriber.provision_new(data_plan)Trade.pending_compliance_approval DUH!
    13. 13. @trade = Trade.book(params[:trade])if @trade.booked? ...end
    14. 14. • Encapsulate ActiveRecord calls• Use named scopes
    15. 15. Hubris
    16. 16. The first century Jewish interpretation found in Flavius Josephusexplains the construction of the tower as a hubristic act of defianceagainst God ordered by the arrogant tyrant Nimrod. Flavius Josephus (37 – c.100 AD)
    17. 17. The first century Jewish interpretation found in Flavius Josephusexplains the construction of the tower as a hubristic act of defianceagainst God ordered by the arrogant tyrant Nimrod. Hubris: extreme haughtiness, pride or arrogance. Hubris often indicates being out of touch with reality and overestimating ones own competence or capabilities Flavius Josephus (37 – c.100 AD)
    18. 18. Stupid Questions
    19. 19. Stupid QuestionsOnly stupid answers
    20. 20. Constant Conversations
    21. 21. Given I am on “/calendar”And I click ok “create new event”And I fill in “event name” with “Talk at SRC”And I fill in “date” with “16/04/2011”And I click “submit”Then I should see “The event has been saved”
    22. 22. Given I am a forgetful personWhen I create a new event on my calendarThen my event should appear in my calendar
    23. 23. Don’t expose ActiveRecord methods Talk and listen to your customersDon’t be afraid of asking stupid questions Empty your cup!
    24. 24. Don’t expose ActiveRecord methods Empty Talk and listen to your customers yourDon’t be afraid of asking stupid questions Empty your cup! beer!
    25. 25. Don’t THANK YOU! Towerof anotherBabelEnrique Comba Riepenhausenecomba@ecomba.org @ecomba ! build http://ecomba.org

    ×