Project Solution: Uber Activity Diagram
In this lesson, we're going to walk through the solution for designing an activity diagram that shows how we can order a car using the nuber service.
Guide Tasks
  • Read Tutorial
  • Watch Guide Video
Video locked
This video is viewable to users with a Bottega Bootcamp license

large

Starting here right at the very top left hand side this is going to be when the car has been ordered and we're going to start immediately right here and start with a branch. Now remember this is not a branch because it doesn't have a question mark here. It is not a branch that is going to have other types of places where the user can go. Instead this is a branch that simply can have multiple inputs for set departure. So that is just a UML mechanism and it is one of the elements that you want to have to be able to visualize how branches work and how these different activities can receive input. So you only want one item coming into each one of these activities. So the very first thing is we go and it sets the departure. Now from there, it sets the destination. Now technically you can have both these merged and I just thought that it would make sense to break them up because these are two different activities. If you have ever used the Uber app you know the very first thing that you want to do is you want to log into it when you do that. It's going to pick out where you are so that's going to set the departure. And so if you're building this out and this is part of the reason why I broke it into two pieces I would need to be able to find out your geo location.

This will have a full set of modules and device API requirements right here just to make sure I know where you are in where you want to be picked up. Then you also set the destination. And this is where you would type in the address or where ever it is that you want to go. Now with these two items, now the system can check to see if the trip is possible. So if you went into the app and this comes down to data validations if you went in the app and you're in New York City and you accidentally type a location that is in Australia uber can not take you at this moment from New York to Australia. With that in mind you do not want the system to simply plan the trip to Australia. So you need to be able to check to make sure that it's possible. If it is not possible then right here with this branch you want to immediately go down and give an error. And so it's going to say the price can't be calculated and it will not allow them to run it. Now you could also have a system in place where it will send the error and then it will give them the ability to start over again at the beginning. You can add that in. It's not necessary for this specific solution because I think some of these items are relatively common sense.

Now going to the next one if the trip is possible. We go down and we get the trip details. So this could be everything from the price points to who the drivers are. All of those kinds of elements. So we get the trip details and then you as a user are given the chance to either confirm or deny that agreement. So if you're presented with the trip details you have the ability to say yes I want to take the drive or no. If no then you're going to be redirected all the way to the top and you can start the process all over again. If you say that you do agree with the trip details then you're redirected to take the car once you've taken the car then you have some other items. And this is completely optional. But I just wanted to try to mimic the uber system as much as possible so the next branch allows you to share trip details. That's a common feature where you can send your ETA to your friends and family or whoever you're going to meet and it will send not only your ETA it will also show on a map where you are so your friends can go and track it. And I think that's a pretty cool feature.

Once you do that you have the option to share the details or you can choose not to. If you select yes then it's going to go down into this activity where it sends a message to the individual in your contact list, who you want to share it with. And then it continues all along the way. If you say you do not want to share the trip details goes to no goes back to this branch here and then it gives you another decision to make do you want to share the payment?

This would be the scenario where you're going with two of your friends and uber gives the ability to split the payment up so if each one of you want to take a third then what it can do is it can go in and right here. Choose mate to share price so it goes in and says I want to share it with this individual. And then Ill break it up. And then finally it takes you to the process where you've had the payment approved and then you're taken to your destination.

This is a very straightforward approach to looking at the entire process. But even though there isn't a lot of complexity in this diagram. Notice how many decision points we have here. We have a few very critical ones placed at times where you as a developer or whoever is developing this is going to have to be aware that there are multiple outcomes based off of the data input such as is the trip possible? Does the individual agree with the trip that's proposed? Do they want to share trip details? Do they want to share payment? Each one of these is going to change the logic and it's going to change the flow of that user's experience and that is one of the biggest key's is with building this type of activity diagram. Now I really like these kinds of diagrams because I could take what I have right here and it would help me go and visualize exactly how I would organize the code base. And that leads us into our next solution where we go and we build that package diagram.