 Okay, so don't build another tower of Babel. So let me start with actually the story about Babel. So and the whole earth was of one language and with one speech and it came to pass as they journeyed from the east that they found a plane in the land of Sheenar and they dwelt there and they said to one another go to let us make brick and burn them thoroughly and they had brick for stone and slime they had for mortar and they said go to let us build us a city and a tower whose stopmate reached upon the heaven so they started building a really big tower because they wanted to defy the Lord God and God looking in amusement saw people building this tower and he went on and said okay let me confuse them and he basically changed or made everybody speak a different language so that they wouldn't understand each other and the gente empezó hablar en diferentes idiomas they couldn't understand each other si vos ni me vas los va es bar wirklich comish y nadie entendía qué es lo que estaba sucediendo and I suppose que nadie que está aquí is really understanding what I'm really saying so I'd rather stop so there's two lessons learned actually from from this biblical event which I think are quite important the way we build software and the way we interact with our customers for one we've got language I mean we develop software it's about language we write software to communicate to communicate what our customers are trying to do to communicate their business value to communicate whatever they're doing into software now language is actually this cognitive ability that we have as humans to translate our ideas our concepts and communicate them to others as opposed to speech speech is just a form of communication speech can found for example in birds you've seen parrots that can mimic the way we talk but they don't have the syntactical acquisition of this language they don't understand what they're saying they're lacking this language so from there I started thinking and looking at rails applications actually and the way we build this applications actually makes me sad because we have tools like active record that help us actually to reach into the database get some data show it presented to the customers and work that way which is a very convenient and a very easy way to work but it leads to applications that are rather cruddy I would say instead of conveying what the business really wants to say what the business really wants to do with this application what is their domain have we ever thought about it now everybody of us has seen something like that user find what does it mean to find a user in your application I mean every application has users or most have and unless you're actually doing some kind of application that is specialized in finding people saying find to a user is actually not really the context of the domain you're working with is just reaching out into the database and figuring out giving me that row that particular row of data we can have a little bit more extremes examples which do the same thing and I agree with Charlie Sheen here what the heck is this you know what are we trying to say here can anybody really understand what's going on well I might know one person in the audience who might but for the rest of us I think it's quite hard to figure out what is going on here the problem with most applications is that we don't really focus on the domain we don't really focus on our customer needs on our customers language we can find other examples like inside of controller where this is a simple example I mean it's not that horrible as we said and we saw before where we create a new trade with some parameters that are passed from the view and if the trade has been saved we actually act upon it in a way or another now some would say this is actually quite clean that's that code is okay looks okay but what does trade new mean what does it really mean or what does trade save in a trading system actually mean do trade us safe trades do they really they don't they don't do that they might book a trade right but they don't save them they don't save them anywhere in a bank in an account or something they're doing something different and we lack usually the time ability to actually listen to them and actually figuring out what is really they want to do now this happens for obvious reasons you know in rails we've got active record which follows the pattern of active record and this pattern actually says that the database access very explicitly talking about it and is encapsulated in our domain object now as you can see from the pattern is this pattern is actually giving us that access it's making it possible to access the database is actually showing it right is showing to the outside world to the clients of your application or at least the controllers which are clients to your models that hey if you want to find something in the database this is how right so we're exposing the database to the outside now in a way is I would say that this actually defies the single responsibility principle in a way it's not really the case but in a way you are giving your clients or this object is offering to your clients to responsibilities is basically telling you you know what you can work with my domain but you can as well reach out into the database you can do two things here and that is not for me a single responsibility anymore you're actually reaching into the database which you possibly shouldn't or you should at least not see it now the other patterns like the domain model which sounds similar right it's very similar to active record from the sound of it you've got an object model which incorporates the data and the behavior so at the end of the day yes is reaching out into the database but no it's not showing you right it's just doing it why because we're keeping the data very close to our objects but we are modeling it in a different way now if you look at some code that would reflect that in a way or another we find things like appointment book on a date or if you're talking about the telecoms application subscriber provision new data plan or trade pending compliance approval all these methods would actually very probable look into the database crunch some data and return whatever action they did but we're not showing it we are actually speaking in the language our customers are speaking at that moment now if you go back to this controller we saw before where you could see that the trade being created and saved this could be rewritten in a different way way say hey book a trade and if the trade was booked successfully then act on it which actually reflects reflect much better the language that your customers might be using obviously I don't think that all of you are working on trades but you get the the idea now as a some tips when you're doing this when you're working with your data and with the application you should try to encapsulate your active record calls into your domain models if you have to use active record if you want to use active record basically as a rule of thumb you could always say the only object in your application that is allowed to actually use active record methods like finders and all these methods is actually the same object that is the model so find methods would only be found inside your model where internally he is doing the finding internally he's doing the saving internally he's crunching the data and exposed to your controller you wouldn't see that you basically just work with your domain it's a very lively domain it's a domain where objects work together in a way data gets saved data gets changed data gets created but you don't see it you have this graph of objects that are kind of working together you can also use namescopes with active record which more or less do the same thing it's like using more like the power of active record in that case which is a similar approach to encapsulating this method calls there's another part that we can actually learn from the history of Babel I'll call it hubris now there was a Jewish Roman historian called Flavius Josephus who actually said that what the people at Babel did was an obristic act defying God so what does that actually mean what does hubris mean it's basically when we are arrogant when we lose touch for what other people or the reality of other people and we put ourselves upon them we are more important than them and as developers we usually are quite arrogant there's a lot of ego between us right and what happens is that our customers are wrong right they don't know what they're talking about they tell us a problem and we listen to it a little bit and then we go well but what they really mean is this what they really mean is this other thing you know they don't know really what they're talking about and it is actually quite interesting how how we do that because our customers know quite well what they're talking about it's just us that we think that we need to translate everything they say into something we believe is right so to avoid doing this to avoid being so egoistic to avoid not listening to your customers there's certain tricks or certain things you can do as part of your development process or as part of your interaction with your customers now one of the first things I've seen which are quite successful and maybe at the same time quite scary when you do it because you think oh my god you know how is this going to play out so ask stupid questions if you don't understand something ask always ask it's very interesting to figure out that this question you had that you thought was stupid wasn't stupid at all you just didn't understand something your customers you have to think as well they work in a certain domain they've been working possibly for years doing something and they have this lingo that they use they used to it right and they don't might not understand that some people who come outside of that domain don't understand that language right so you need to figure those things out and question just question make this stupid question the world what's a trade I well a trade is so and so and so and then start explaining what's a broker I don't understand that recently I didn't really know what a security was what is that now it might sound stupid and actually your customer will look at you like oh my god he doesn't know that right but he will find the answer and as funny as it is there is no such thing really as a stupid question we actually say ask stupid questions but they are not really stupid and the only thing I can say there are no stupid questions it might be just stupid answers right that must that could have been the question how many cigarettes can you put in your nose you know well the question might seem stupid but actually that could only lead to that stupid answer another thing that you need to do that you really need to make sure you do when you're when you're working with your customers is to keep the conversation constant there's no such thing as talking too much Joe was saying it in his previous talk there is no such thing as over communication there is no such thing I worked in a project a couple of years ago where we are modeling a bingo server actually that was quite fun now we actually spend like at least an hour a day talking to our customers playing bingo hearing him talk going to bingo halls you know just listening you know just listening and taking notes and figuring out what they were really talking about what is this world you know what's the zombie holes where people go and play it's actually quite bizarre when you go to bingo hall if you haven't done it ever do it it's really weird and so we kept on talking to this people and you know we were not understanding that certain things about the tickets about how they call the numbers and how they really work and so we kept come conversing with them talking with them and figuring all this little things out and it turned out that we did a really good application that reflected actually whatever they did in this bingo halls and you know we challenged them a lot it's like but when you say ticket do you mean this paper thing what is it actually you know constantly asking these questions what is it this all about so it's really really important that you keep this conversations flowing that you understand what they're talking about that you really challenge your understanding and challenge them to actually explain it because they it's not that they can't or they don't want to it's just that they don't have the opportunity to talk to you and you're not giving them that a lot of times I found that we as developers we sometimes act like this doctors you know we work with our white ropes you know we know everything don't worry I do this right you don't know anything I'm a technician I know what I'm doing and it's quite weird you know because we don't know anything you know we know what we know we know about technology we know about solving problems that's our strength right but in order to solve a problem I need to understand that problem pretty well so keep on the conversation there's another way of actually once you're having this conversations you can actually start writing cucumbers so you write them like this right probably not probably not but this is something common this is something you see a lot people writing cucumber steps like this and scenarios and again it shows this arrogance that we have right somebody's telling me you know I'm actually quite a forgetful person I forget things a lot and I need to have a place where write down some events in a calendar so that I don't forget them right and we go oh this is how you do it it's like well hang on this is quite brittle you know why why should I do it this way where is the business value here where I'm reflecting here what you want to do I'm actually not I'm just telling you how to do it I'm not listening to you I'm absolutely not listening to what you're telling me and I'm creating this image in my mind this is how it's done and I know it because I'm right I'm always right everybody knows that so hey this is how you do it now a much better way and a rather more pleasing way maybe polite way as Jim was saying of actually writing your scenarios would be something like this now this sounds much more as something that your customer might have said so you write this notes down like that knowing that oh yeah given I'm a forgetful so I'll create this event and it should appear in my calendar the funny thing about this about this conversation and this language that is happening here is that suddenly you're not any more focusing on the technology using you're not any more focusing on how to do it but you're focusing on the language you're focusing on the language of your customer you're focusing on everything they really care about which is their business value and in the background of that you will actually write which ever you need to do as an I click here I fill in this I fill in that that's happening in the background that's something that they shouldn't care about I've been actually talking quite quick okay so here are some advices that I can give you don't expose your active records methods to the outside world let these be handled internally use name scopes encapsulate your methods make sure that you listen to your customers make sure that you understand their problem make sure they talk a lot to them it really pays off and don't be afraid to asking stupid questions and last and not least I'm really quick I'm really sorry for that don't forget to empty your cup you have to go into every situation prepared to learn something prepared to understand prepared to actually get all the information you can from your customers to actually make this work and maybe instead of emptying your cup quoting Dave in his keynote maybe what you should do is emptying your beer thank you