UML Use-Case and Sequence Diagrams Made Simple | Step by Step Guide | UML Diagrams | Geekific

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
What's up geeks and welcome to the channel! To model a system there are two main aspects   that you should take into consideration: the Static and the Behavioral aspect  the object and class diagrams we  previously covered are considered   structural or static diagrams they are great at representing   the overview of the classes and objects in your  application and seeing inheritance and composition  however they are not so great at representing the  lifetime of an object, the users of your system  or how these objects and users interact with each  other and maybe with third-party applications  this leads us to the second  aspect: behavioral diagrams  these describe how different objects change  and how they communicate with one another  the two most well-known behavioral diagrams are  the use case and the sequence diagrams and we   are going to cover both in this video. Use case diagrams summarize the details   of your system's users also known as actors and   their interactions with this system it is also being said that use case   diagrams are the blueprints of your system so using one or multiple use case diagrams   any person should be able to know what  your system or application is meant to do  and using these same diagrams any developer should  be able to understand and replicate this system.  Okay suppose now that you are  working on an online shopping system  and the application you are developing allows  you to browse the items you are selling,  purchase the items you want of course, and  also create an account on this platform.  These are the use cases of our system and  are represented with a labeled oval shape  you see you need to be a registered  customer in order to make purchases  however any customer or guest viewer can  browse through the items you have to offer  both the registered and unregistered  users are considered customers of our   system a.k.a. actors of this system Now the different services provided   by this application may require the help of  third-party actors or what we call service actors  like if a registered user made a  few purchases and now wants to pay  our application could be using an out-of-the-box  service provided by PayPal or Credit Card  or as another example when a guest user  wants to create an account on our platform  we may be using the authentication or login  services provided by Google or Facebook  these are service actors required  for our application to work  all actors of the system are  represented with stick figures  but service actors like Facebook's  authentication service for example  will have on top of the stick figure a service tag  on it to differentiate it from our normal actors.  Finally I'm going to draw  a box around the use cases  this box represents the boundaries of my system anything inside the box is part of   my system and anything outside is not So all of our actors will be outside it   in the diagram we've been drawing you can see that we didn't dive   in the details of each use case like what are the items we are   offering and that is exactly the way to go because you see use case diagrams don't go   into a lot of detail as written use cases do I know the name can be a little misleading   and you may think that it's a  diagram of a use case but it isn't  these diagrams almost always represent several  use cases and multiple actors at the same time   like the one we just had the reason it exists is so   we can get an overview of these use cases  and see how they all interact in context  so it's not a replacement or substitution  for the written use cases we previously saw  instead it is a high level  overview of the relationship   between use cases, actors, and systems Now contrary to the use case diagram,   a sequence diagram does not describe the  entire system just one particular part of it  one particular interaction between  a few objects and one scenario  we start the sequence diagram with some  boxes at the top that represent the objects  which are the participants in this sequence  we could have two, three, or several  beneath these we stretch out some  dotted lines these represent lifelines   the timeline of these objects we start by representing the   messages that go between these objects  at the top of this timeline or sequence  So first will be, say a checkout message, customer  is telling the shopping cart I want to checkout  the shopping cart is going to create a  new order and initiate an order object  once that happens we realize that the  shopping cart needs to start adding   the different items to this order object these messages that we are writing can be   named very simply or they can be named  with parameters such as I'm doing here,  when I add an item I know that I will  need to tell the order what item it is   and what quantity the customer picked so if I am doing solid arrows with the full head,   here these are regular calls regular messages if I'm expecting a response I would   use a dashed arrow with a stick head now you don't always need to write down   the return messages only when they add value you'll also sometimes see solid boxes on the   lifelines called activation  boxes or method call boxes  when you see them you can tell that some kind of  processing is being done in response to the method   called in our case, the add item method. Now, if we realize that this add item   message might need to happen multiple times if we have multiple items in the cart for example  then we can surround the calls with what we  call a frame or more commonly known as a loop  similarly to what we did for the  add items and item total calls  keep in mind that you are not trying  to model this entire scenario down to   the last conditional and the last iteration that's not what sequence diagrams are for,  they offer an overview of the important parts  of this process and don't try to model every   last if-statement or while-loop. Okay so the next thing the shopping   cart needs to do is calculate the  total amount the customer has to pay  that's going to involve a bit of  processing in the order object  that will then send the total back and  even though this might go back to the cart  we realize that effectively that's being  passed all the way back to the customer  who is going to be the one to submit payment Now we realize we don't have anything here   to take care of that payment itself so we can initiate a message from, the   order that's going to create a new payment object and the only reason for this payment object to   exist is to validate that payment and return  a response and then it goes off the timeline  in fact, we can indicate that by  saying we will send back some results  and then we'll put in an X here to  say the payments lifeline is now over  whether that was successful or not  the object doesn't exist anymore  So Order has been given results and then has  to send those all the way to the Customer.  Now one of the benefits of a sequence  diagram is that at this level of interaction  you should be able to sit down with say a  business user someone who is not a developer  and explain this general process and they can  hopefully give you some ideas on whether it   is correct or something is missing out of it you may create several sequence diagrams to   help you understand the specific scenarios but be aware that there is no need to try   and diagram every single part of your  application, you don't need to do that  these are for sketching out a situation  that's not completely clear already  they will often result in you realizing that  a new class needs to be created somewhere  and if that happens in this  process, then that's great!  So that's it for this video, I hope it was  helpful thank you guys for watching take care,   and I will see you in the next one!
Info
Channel: Geekific
Views: 27,694
Rating: undefined out of 5
Keywords: geekific, programming, coding, computer science, use case, use case diagram, sequence diagram, uml diagram, uml, use-case, sequence representation, drawing a use-case diagram, drawing a sequence diagram, behavioral diagram, static diagram, actors, scenarios, regular calls, activation boxes, unified modeling language, uml sequence diagram, uml use case diagram tutorial, uml use case diagram شرح, how to draw uml, how to use case diagram, how to write sequence diagram, how to, geek
Id: el501qi0KtI
Channel Id: undefined
Length: 7min 48sec (468 seconds)
Published: Sat Aug 21 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.