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.
9. Active Record
Trade
value
advice
find
save
An object that wraps a row in a database table or
view, encapsulates the database access, and adds
domain logic on that data.
17. The first century Jewish interpretation found in Flavius Josephus
explains the construction of the tower as a hubristic act of defiance
against God ordered by the arrogant tyrant Nimrod.
Flavius Josephus (37 – c.100 AD)
18. The first century Jewish interpretation found in Flavius Josephus
explains the construction of the tower as a hubristic act of defiance
against God ordered by the arrogant tyrant Nimrod.
Hubris: extreme haughtiness, pride or
arrogance. Hubris often indicates being out
of touch with reality and overestimating
one's own competence or capabilities
Flavius Josephus (37 – c.100 AD)
23. 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”
24. Given I am a forgetful person
When I create a new event on my calendar
Then my event should appear in my calendar
25. Don’t expose ActiveRecord methods
Talk and listen to your customers
Don’t be afraid of asking stupid questions
Empty your cup!
26. Don’t expose ActiveRecord methods
Empty
Talk and listen to your customers
your
Don’t be afraid of asking stupid questions
Empty your cup!
beer!
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