Kevin is experienced in web application development, agile project management, and systems analysis. He is dedicated to executing the technical aspects of software development projects with a keen eye towards driving business value.View the profile
About the talk
RailsConf 2019 - I know I can, but should I? Evaluating Alternatives by Kevin Murphy
You can use a hammer to drive a screw into wood, but I’d recommend a screwdriver. Why? And when is a hammer the better option? This talk will propose a framework to use when comparing alternative technical choices. I won’t decide for you, but will leave you with a structure to apply in your decision-making process.
The ruby toolbox is vast. While Rails provides a default experience, it leaves plenty of room for alternatives. In learning how to do something, you may uncover different ways to accomplish the same goal. Determine which tool fits best in your situation with these lessons.
Everybody. Thanks for coming. Jeremy talking about making choices does a lot of information out there about making choices about what programming language to use or what was framework to pick for your next project. We're here at rails, So I'm assuming it's a small problem for one of the room day to day basis in your job. Just trying to push to get to the system will start with an example you to join two pieces of wood together as a couple of screws already started in there. You have a hammer and screwdriver available to you. So little audience participation by show of hands
who just knows which option they would choose it does matter which for just I know which one I would use Okay, great. Wonderful. I'm going to change it slightly now and take a screwdriver way and give you a brick. Again, who knows which option they would choose? Awesome, cool one last scenario when I get the screws out of there. If your choice of Hammer & Nails some tape screws and screwdriver or wood glue who knows which of those options they would use to join the two pieces of wood together. I want to raise a hand for any of those situations.
You could have a lot of experience right maybe use a hammer a lot. And like I was just another tool situation where I can use the hammer cool wonderful might want to get it over with the tape and wrapping his work together and I'm done gone, right? I'm at the requirement to join. You might be interested in degree of difficulty. You see the brick laying there and you can think of maybe you're interested in something. You've never use wood glue before. Seems like a reasonable application to call the hubs about everyone's talking
about wood glue the new hot thing. Let me don't really know why but you definitely have an opinion we're going to talk about today is how we can develop a system for how we think about all these kind of choices that were making. My name is Kevin Murphy. I work at a software consultancy called in our company where in Boston Massachusetts and we work really closely with our clients and our partners to make sure that we're making the right testicle choice for them in the context of the problem of trying to solve. So we try to think of some theoretical backing for how
we're going to make these decisions. We can consult the sacred project management text and you'll see a lot of references to alternate is analysis big words and they'll propose something called a weighted scoring model. So let's build a weighted scoring model today and talk about how we do it as with any good project management tools just a spreadsheet. Fine start by building up some criteria that are important to making this decision. So if it is to be able to Salem care about price and ease-of-use and compliance with the
regulatory body and how fast until I can get it. I put those on the slide really quickly the fact a whole lot of time to figure out what's important to you. Natural step one do they need to put them against each other and say yeah, these things are important to you. But really how important are they out of a fix pool of a hundred points. How do you determine when you really care about then you identify what choices you're going to evaluate for this example to call them A and B, cuz I'm really good at naming things. So be thankful. You're listening to a talk and I redeem a
code. I want to know which of those options are going to be looking through you then need to score them on the different criteria. So I'm going to say how well he is on price and all the other criteria and same thing for B. Winter wrap up. I can computer score for each of the Alternatives by multiplying The Weight by the score for the individual criteria and stopping them all up. At the end of the day, I choose the option with the highest score. We're done. We're going to do a great. It would be burned here. Like why is this beneficial? Well, it
did take some thought right week. We gave due consideration to each of the Alternatives. We can just make it up right we went through some thoughtful process that got us to some endpoint. Calcified some justification for our decisions. Why do we choose a we actually have an artifact that we can point to and say well I delivered AA 143 Lastly and most importantly to me. Is it a huge consensus-building opportunity building this out by yourself, you're involved all of your project stakeholders are aligned on what's important to you. When I going to get there right never going to
be all behind on a cuz yeah, we all came together and that's what being so great. It's not all roses though, right? It's going to take a lot of time to do even just knowing what's important to you. Like I said that difficult What about status options you really it's a bear out. They need to learn a lot about the different things are going to choose between and make a decision. To do this, right? You have perfect knowledge. That's not reasonable before you have done anything with a are being right? You just figure out which one should I do?
Because of that these things tend to be a bit rigid and inflexible, right? It takes a lot of time. It's really hard to get right. So you're not likely to iterate on it. You might do it at the beginning of a project and big kickoff meeting. If I won't revisit it. Even with his limitations that that doesn't mean that it's not valuable, but it may be a little difficult for us to use on a daily basis and try to get us some help here. Let's talk about how we can actually do that to save everyone some time and proposed some criteria that we can use and punch into our way to scoring model.
Identify this material going to represent them with for tools that we talked about at the beginning of the presentation about the impact of the choices that we make cost. They introduce maintenance activities me to undertake and lastly how each of these options at consistency. Let's get started with impacts of course will represent with a hammer because what tool could be more emblematic of making an impact than a big ol hammer. For all of these criteria, we're going to grab a ticket out of her ticketing system and and it all together. And so for the
purpose of this presentation, we all need to be working on a shared application. And so we're going to be building a pool that food scientists are going to use to conduct their studies. The Hormel Corporation is a side of Minneapolis. And for all of you can't beat aficionados. The Spam Museum is south of here in Austin Minnesota some extra time and the means to get down there and checked out the tool to help those food scientists are working on spam make Spam taste even better if you can even imagine that there is no try And they need our help building a system to let them keep track of
the food test with running. It's what I do that today. The first ticket is at these food scientist need a way to welcome participants after they've enrolled in this in this. Okay, you do that start with the test will build up system test or future tests will go to the page where you can enroll as a participant in that form of the information you need and when you click and roll will make sure that we sent some email off. Okay. Now he's been exactly work. We already have existing system rails knows how to
save stuff and roll also knows when it stays stop and create stuff. So let's just look into an active record lifecycle callback and say one of these things will call this deliver. Welcome our method and what that will do is as the name implies will call Action Miller will send itself to it and it will send that welcome email out to the participant. Cast in the passes so great. We're done right and we can push it and go grab coffee and go home today play ping pong, whatever it is. We do maybe alternatives.
We can set build a whole separate class will call to study enrollment. When you make a new cellular wrong with it takes a bunch of parameters about a study participants. MSA you can save a study enrollment and when you do that build a new study participant and if you successfully save send the welcome email or as well, okay? Get a pasta pass directly to change our existing control or a little bit before we are creating a study participant. We now need to create an enrollment. Save that enrollment and if it doesn't say we need to tell you I've are
about what the kids when is so we can but whatever former is it has on there right now? Through things that both work equally well and now we need to figure out which one we're to do. So talk about how impact can help us make that decision. First thing that's important in Impact is talk about how your team is going to react to these. So presumably you're working on with other people and presumably they're all lovely people that have great experiences and you love working with them and they probably have opinions. And you might agree
with them you might not but they're still their opinions and we're all working on this case together and we all need to be comfortable with the work that we're doing. So you may know that some person on your team is that Paseo deep-seated issues with active record callbacks or maybe there's something else that really doesn't like layers of code and figuring out all in Direction where things are coming from and what class to use in which scenario if you know that information about your team that can help sway your decision on how you look,
What's the standard you're setting any code that you're right that end up getting merged into the main line branch of your application going to be used as an example in the future. So now I build the next feature that sends an email as a result of creating some sort of object to look back at how we did it this time and do it really similarly concept but you're leaving by introducing this code must be worried about What's the weather impact you think service or non-functional requirements may be associated with this
work? So one example of a non functional requirement make the performance if you're interested more about performance. Hopefully you were here in our last session a Percabeth gave a great talk about profiling and benchmarking if you weren't here definitely check those out check that out when the videos come out but if performance is important in this particular time. One thing is a bit more performance in the other than house where decision? Accessibility is another incredibly important non-functional requirements. I want to make sure that we're writing systems that the most of us can use
the rest of this talk. I'll be giving you just medications for saying one thing or another. I'm going to draw a hard line here if you have two Alternatives in one is more accessible. Just pick that one. And if there are trade-offs that you're making find other ways to mitigate them. They're actually dry hard line somewhere. But an easy one. So, there you go. Do the one at the festival? But like I said for everything else we're going to talk about different ways to do things. Right? So let's let's revisit our second criteria just cost is relatively abundant find a
premature anywhere get the job done really quickly. And if you screwed up you can just remove and try again. grab our second ticket never to make sure that only principal investigators can create study protocols. These folks have phds. They went to college for a million years and this is their big payoff. Congratulations. You're the only people that can do this. Stop the test as we doing our last exercise will sign into some non principal investigator. I wouldn't go to the page to try to create a new study protocol and we'll make sure that we see some message
that says sorry. I can't really do this and some other page. Okay, and I'll talk to make this work already have a way to create a new study protocol so we can write it if test that says if your principal investigator cool keep going If you're not sorry, but here's this message that says you can't do that and going to go some other place. Crash test once again. We're done right know. This is a talk about alternatives. So go back to that control that we had before. Instead what's pulling some third-party authorization library and we'll ask it to handle
being able to answer the question. Can this person do this thing on this resource? Not for this example of Music pundit pundit specific Library authors in the room, and I didn't use your authorization to land. Sorry. I'm sure it's great. I had to pick one. We do that we want to test and it happens again. Okay, cool GIF test. Napoleon a third-party dependency how we know which one to choose? Lacoste so of errands here. Yes, we're going to answer the question. We can do these things. But at what cost?
Turn on Michigan cost. I like to talk about is what sort of appetite you have for risk. Any of these Solutions are going to introduce some level of risk may be of the same risk, but they manifest themselves in different ways. U-Pull-It a third-party dependency you're accepting any performance problems. They might have in their code need security issues. You're availing yourself to hoping that they will continue to maintain its right. You can help maintain its senior to be usable. If you read the coded yourself, you still have all those problems, but it's just you trying to
fix them all. I don't mean it's wrong or bad there's different but you need to go through the exercise of understanding what's important to you? And how are you going to mitigate those risks? They are introducing. Just need to be aware of the context within which you're being asked to solve the problem. So we pick the stick it up and let's say that it was introduced to us in a in a Sprint planning meeting Monday morning you I'll sit down with a coffee and a bagel and a product manager get something so great. Everybody gets a new work working on this week. I only certain people should be
able to do certain things in the system. Let's go make sure it happens. We all high five and go off and do that. Turn the power on Monday morning to go with everyone. But the way I actually saw that problem might be super different if I never actually got this ticket of the ticket, but I got it from someone running at my desk at 4:30 on Friday saying co-investigators protocols will fix this right now. We're all fired. I also have dinner reservations for the weekend. So I just want to get this done.
the choice that I make going to be impacted by the context within which I'm being asked to solve that there's a cost associated with that and that's perfectly fine. Just need to recognize that. We also need to be considered with cost of what the big picture is. So we're going on our one ticket and we're just making sure that only principal investigators can make study protocols and that's fine. Waiting for this one will take it. We just be guarded on the new action do the same thing on create, right? So someone happens to find a way to post to our form. We don't want to let them
create a new study protocol unless that's fine. If we're going with it if we can add the clause in the crate action, too and we can even when we did it once wonderful then maybe a couple weeks later. We have to guard some other resource again some other action and we do a similar thing and we think I can go out. Hey, we actually were thinking in this other controller. Let's extracted into its own modular class. Awesome. That's super cool. You're now maintaining an authorization Library. Maybe you want to do that.
And that's cool. I mean you don't that's fine too. But if you knew how your sister was going to change and what are the risk you're willing to take on at the onset my impact which option you choose. Does idea of the big picture is going to come back in our next criteria? What is maintenance? I know about you, but I spend every Monday morning walking in open up my rails app pending a couple screws making sure everything's all good to go then going about my business. But actually end up being for me is updating gems, but we're going to use a
screwdriver to represent. So grab another ticket a food scientist friends have the ability to look at the data. They're collecting about how much people are loving spam. But for whatever reason those food scientist can't see when we actually got this data when when the actual taste has happened. So we need to make sure that the belt aren't already passed yet again, and we'll set some time that this data was collected that and will create a data collection event and will say that the created at timestamp is that time
we'll go to the show action. I will make sure that it spits out that date and whatever format we expect. Okay, so I got to go to wash a load of you will have some list that says hey, here's one that was collected and then it spits out the the real spray that time stamp and format is the right format in the test. the passwords once again, this is a test about alternatives. So let's look at a different way. We could solve that for some inspiration rocks going to change the test a little bit. We had this variable called
collected at and we ended up setting isn't on an attribute called created at. What happens if you have a separate attribute on the model called collected at? You did there. We can make that work a lot of migration to add the new attribute. Make a subtle change to review where we were once using the create a timestamp when I get selected at. Runtastic Okay, we can use the rails timestamp the fault of the crater. Time or can it reduce a whole new afternoon?
How can maintenance help us solve the problem? With a really to nail maintenance you need to be able to predict the future. I'm going to ask you to do that cuz I'm not so great at it. But I can just stand up here until all you hate just be able to bring the future and then you'll never have a problem maintenance. But even though I'm not that rented it to back to that big picture ID. I still do a little more of them application just the current problem. I'm trying to solve. Maybe I know that we're going to be importing a bunch of data from another system that has food science
experiments from the last 15 years. If I know that then the part of doing that import if I'm using the real time stamp that created a time you need to represent the time. It was entered into the database or the time that the data collection event actually took place, but I hope I can be a problem. So I know that it helped make the choice of what I'm doing, but I know Dad is ever going to come from a place or even if I just don't know it's not going to happen as far as We Know. Finger waves using the real time stamp could be perfectly fine. If you don't have the contacts
yourself when I was a radical idea talk to other people about it. I don't do most of the talking do a lot of the listening. Particularly talk to folks that aren't doing the same work as you talk to developers. Another team's talk to users talk to your support folks project management. Sure, they'd love to hear from you before you make something their problem for the end of time thinking about what about directly influence the work that you're doing right now?
Bosley for maintenance consider ways that you can make things easier on yourself. Drove all been in situations were been working on a couple days for a while. Unemployment some new feature looking at some section of the code and sometimes it's not sitting right don't really know what's going on with it. The weather is procrastination or just get blame the line from a couple months ago and time. Really really with us that wrote that code we have no idea. We just take a deep breath and think
so I had my reasons. And you're right. You did the best mechanic car in time. That's wonderful. We will talk of code. Are you written in the past? Do you think and go all there's no way I would solve that problem this way right now. That's awesome. That's something in the right context to be celebrated. You're learning you're growing. It was a design pattern you didn't even know about 3 months ago to write the code that would radically solve or make this more simple or whatever mechanism. That's
not what I'm talking about the future self on actual time of the situations where you sitting down trying to tell the future and he was like, you know, I just I need this to be over. And I know I couldn't take another hour and fix this. The other thing but it's just need to be done with it. That's right. It's 4:30 on Friday you get fired. find we had the opportunity to step back a little bit and think about how can I just a little bit more effort? How can I make it so that? Future self the past self
who is currently living in the present. We got one last criteria to consider. does consistency the glue that holds everything together metaphors are great. We've got one last ticket, but I'll be working on together. We have a page where some folks can edit some of their personal information. And we're going to continue to allow them to do that. But if they do, so we need to make sure they're aware that may no longer be eligible to participate in study. Maybe the
folks at Hormel are only interested in people in certain age demographics or that have certain food pallets, whatever other things are interested in. protest everything else What are the page we can edit your personal information? And we'll make sure there's some message that says, you know, you can really do this, but there are consequences for your actions. Okay, and we already have existing controller cuz we already have the ability to edit personal information without a flash message that they just they just do this immediately. And as long as that localization shows
what's in the test, we're good. Once again, everyone say it with me one last time. This is a talk about Alternatives great job everybody. Southwest I'm going to have on this is this actually isn't going to propose a new implementation that's fine with a black message one line, but I need this test. Medallia doesn't have how do I know how to test something? How do I know the right level to test it? How do I know if I should have something at all? Consistency can help you hear. But look at what sort of institutional knowledge there
is in the world. What are the current best practices in the world about passing class messages? What are the thought leaders thought about about testing last message? What are we care about as an organization about testing flash messages? You work at a company that has a giant poster on the wall as we do not test flap messages. Probably going to color what your decision if you also work for that company come talk to me after cuz I have so many questions. But if you do work there. I got to make a choice for you.
The other part of consistency is also be interested in what existing standards already exist. This is the flip side of impact. Remember? I said any work that ends up being merged with the main line branch of your application going to be used as an example. This is the time where I can use that so if I quickly look for the code base, and I don't see any test for Flash messages going to give me some signal. If I see tests that test a bunch of things off last message that will give me a different signal and that can help me make my decision. Lastly with consistency consider
how easy or difficult this is for someone new to be able to understand it or make a change to it. We are real, then. We will have a bit of rails knowledge focuses heavily on convention over configuration and rails way to solve certain problems that has immense value means that most of us if not all of us in this room could probably swap rails apps and pretty quickly have some sense of what's going on some even a small level. That doesn't mean that we should blindly follow the rails way. There's certainly reasons to deviate from it.
But there's value in solving similar problems in a similar way. If not throughout the industry units within your organization. cycling make sure that we're allow yourself to introduce new people to the code base and have them understand what's going on relatively quickly. To talk about our four criteria. We've talked about them separately. But annoyingly we could actually think about all of them at once. I'm going to consider how each of them apply in the given situation that were trying to solve. So even though I would never actually sit down with my
team or even by myself and break out a spreadsheet and say great news everybody. We're building a weighted scoring model. I probably have some sense of just working in the team for a while roughly how important these things are. Directions to Baseline starting point. These numbers are malleable and need to change the result of whatever problem trying to solve. So go back to your ticket because actually omitted the beginning of it, which is the reason we're doing this is to maintain compliance with some FDA regulation and for anyone in the audience that actually deals with
application that has FDA regulations. Hold on don't run out of the room with your laptop screen. We got to fix this I made this one up. I'm sure your app is totally compliant and you're good to go. But even just knowing that the reason we're doing this is to meet some sort of Regulation with a government body. might change our Baseline We now know we have to put together some gas station report for Auditors to make sure that they can understand that what we're doing is still in compliance, right? We need to definitely make sure that this never breaks. So maybe
consistency is less Porton and impact those up in the maintenance costs go up. That's fine. Let's take a little deeper and look at what does regulation actually says again for this thing that's made up and doesn't actually exist. I don't even know if the FDA can do this fella said I could throw you in jail. Or cost you a lot of money. And presumably if you enjoy whatever level of Freedom you have right now and you like the company you work for in like would like it to remain solvent. You probably don't want to run afoul of this dramatically changes this criteria.
Now I pretty much just care about cost at the cost of everything else sweet. If I work at a company that has that poster that says we do not test last messages. We have one now. We got this one. Cuz I want to go to jail. That's fine. What is still care about the impact and I don't want every developer on my team cursing at me saying like, you know, CI times will be 5 Seconds faster. If you didn't have that test that tests that last message, that's fine. We just drove everything else. So we probably have happy path test
coverage for our editing personal information page. So I'll rather than building up a whole new task so I can just hook into that existence back and say hey why you do what you doing speaker? And I go to jail and then keep going it's fine. So even though we don't we we change our approach a little bit. We didn't we didn't break still like this is the most important thing to me. So when I keep doing this, but I can still find different ways to meet other people's needs. What's up next time? You're at work? Work on a personal project whatever it is working on.
They were probably trying to solve. You know, there's a bunch of different ways. You could do it Vine. Make sure to consider an impact. It has not only on the code base in your products. But also on your team. Going to costs introducing and I are going to be aware of them and mitigate them. Understand what sort of Maintenance activities you need to undertake as a result of implementing other these options. This is against you solve problems. Princeton copies of these slides or to see a full rails app that has these fully built out. You can either
go to the Nar. Post railsconf or visit my GitHub at Kevin. Evaluating alternatives. I have stickers. It look like this if you would like to one of them come talk to me. Otherwise, I'm the only thing standing between you and happy hour. So I'm happy to take questions after the back down here if you want to chat. Otherwise, thank you all very much for your time. You were great audience at 3 p.m.
Buy this talk
Access to all the recordings of the event
Buy this video
With ConferenceCast.tv, you get access to our library of the world's best conference talks.