|
|
(15 intermediate revisions by 4 users not shown) |
Line 1: |
Line 1: |
| <html> | | <html> |
| <h5> <strong> Deep overview of link objects and association classes </strong> </h5>
| | <h4> |
| <p> | | A Deep Overview of Link Objects and Association Classes |
| <em>To make your experience more comfortable, we set the main tags mentioned in the video to the right bar menu of this mini player. Choose the interesting subtitle on the list and immediately get to the exact theme timeplace in the video. Now you can pick any topic to be instructed without watching the whole video.</em> | | </h4> |
| <style type="text/css">
| | <p class="video-warn" > |
| p {
| | <em>To make your experience smooth, we set the main tags mentioned in the video to the right bar menu of this mini-player. Choose an interesting subtitle on the list and immediately get to the exact theme navigation item place in the video. Now you can pick any topic to be instructed on without watching the whole video.</em> |
| opacity: 0.7;
| |
| text-align: justify;
| |
| width: 90%
| |
| }
| |
| </style>
| |
| </p> | | </p> |
| <style>
| | <div class="video"> |
| #video12 {
| | <div class="video__wrapper"> |
| position: relative;
| | <iframe src="https://www.youtube.com/embed/PeCfgcUIrD4?rel=0&autoplay=0" frameborder="0" allowfullscreen></iframe> |
| height: 500px; | | </div> |
| width:560px; | | <div class="video__navigation"> |
| padding-bottom: 10px;
| | <span class="navigation-item" data-video="PeCfgcUIrD4" data-start="17" tabindex="0"> Typical association class |
| }
| | </span> |
| #video12 iframe {
| | <span class="navigation-item" data-video="PeCfgcUIrD4" data-start="172" tabindex="0"> Association class with the dotted line </span> |
| position: absolute;
| | <span class="navigation-item" data-video="PeCfgcUIrD4" data-start="309" tabindex="0"> Introduce and remove</span> |
| min-height: auto;
| | <span class="navigation-item" data-video="PeCfgcUIrD4" data-start="345" tabindex="0"> Association ends </span> |
| min-width: auto;
| | <span class="navigation-item" data-video="PeCfgcUIrD4" data-start="379" tabindex="0"> Implicit link </span> |
| }
| | <span class="navigation-item" data-video="PeCfgcUIrD4" data-start="594" tabindex="0"> Inner link name and link role name </span> |
| #video12 div {
| | <span class="navigation-item" data-video="PeCfgcUIrD4" data-start="902" tabindex="0"> Lifenavigation-item controlled objects and classes </span> |
| position: absolute;
| | <span class="navigation-item" data-video="PeCfgcUIrD4" data-start="1115" tabindex="0"> Concept of modelling and abstraction </span> |
| top: 0;
| | <span class="navigation-item" data-video="PeCfgcUIrD4" data-start="1602" tabindex="0"> No ability to remove things from the inner link </span> |
| left:760px;
| | <span class="navigation-item" data-video="PeCfgcUIrD4" data-start="1880" tabindex="0"> Remove from the correct link </span> |
| width: 260px;
| |
| height: 100%;
| |
| padding-left: 10px;
| |
| overflow-y: auto;
| |
| }
| |
| span { | |
| font-size: 18; | |
| display:block; | |
| padding: 2px 10px 2px 10px;
| |
| padding-bottom: 0.5;
| |
| padding-top: 0.5; | |
| opacity: 0.7;
| |
| }
| |
| span:hover { | |
| color: #0000FF;
| |
| cursor: pointer;
| |
| }
| |
| span:focus { | |
| color: blue;
| |
| </style> | |
| | |
| <div id="video12"> | |
| <iframe width="740" height="500" src="https://www.youtube.com/embed/yDKHzI992jQ?rel=0&autoplay=1" frameborder="0" allowfullscreen></iframe>
| |
| <div>
| |
|
| |
|
| <span data-video="yDKHzI992jQ" data-start="12" tabindex="0"> Typical association class
| |
| </span>
| |
| <span data-video="yDKHzI992jQ" data-start="167" tabindex="0"> Association class with the dotted line </span>
| |
| <span data-video="yDKHzI992jQ" data-start="304" tabindex="0"> Introduce and remove</span>
| |
| <span data-video="yDKHzI992jQ" data-start="340" tabindex="0"> Association ends </span>
| |
| <span data-video="yDKHzI992jQ" data-start="374" tabindex="0"> Implicit link </span>
| |
| <span data-video="yDKHzI992jQ" data-start="589" tabindex="0"> Inner link name and link role name </span>
| |
| <span data-video="yDKHzI992jQ" data-start="897" tabindex="0">Lifetime controlled objects and classes </span>
| |
| <span data-video="yDKHzI992jQ" data-start="1110" tabindex="0">Concept of modelling and abstraction </span>
| |
| <span data-video="yDKHzI992jQ" data-start="1597" tabindex="0"> No ability to remove things from the inner link </span>
| |
| <span data-video="yDKHzI992jQ" data-start="1875" tabindex="0"> Remove from the correct link </span>
| |
|
| |
| </div> | | </div> |
| </div> | | </div> |
|
| |
|
| <script>
| |
| var IMG = document.querySelectorAll('#video12 span'),
| |
| IFRAME = document.querySelector('#video12 iframe');
| |
| for (var i = 0; i < IMG.length; i++) {
| |
| IMG[i].onclick = function() {
| |
| IFRAME.src = 'http://www.youtube.com/embed/' + this.dataset.video + '?rel=0&autoplay=1';
| |
| if(this.dataset.end) IFRAME.src = IFRAME.src.replace(/([\s\S]*)/g, '$1&end=' + this.dataset.end);
| |
| if(this.dataset.start) IFRAME.src = IFRAME.src.replace(/([\s\S]*)/g, '$1&start=' + this.dataset.start);
| |
| this.style.backgroundColor='rgba(0,0,0,.2)';
| |
| }
| |
| }
| |
| </script>
| |
| </html> | | </html> |
| | | [[Category:MDriven Designer]] |
| Raw subtitles text
| | [[Category:MDriven Designer Sessions]] |
| | | [[Category:Associations]] |
| hi, we got a few questions on link objects or Association classes
| | {{Edited|July|12|2024}} |
| | |
| so, we're going to dive into those right now
| |
| | |
| this is a typical association class
| |
| | |
| it is on a many-to-many association
| |
| | |
| let's draw this in a new diagram
| |
| | |
| going just move these things
| |
| | |
| "person", "house, "lease contract"
| |
| | |
| not move them, we're going to view them in a separate diagram
| |
| | |
| create a new diagram
| |
| | |
| I open that diagram
| |
| | |
| I find what I was looking for house class, person class
| |
| | |
| as I drag this on, all the associations
| |
| | |
| associated with these two classes are also drawn
| |
| | |
| and since the association class is part of this
| |
| | |
| association it was implicitly added to my view
| |
| | |
| this is, of course, just what
| |
| | |
| I want now, so that's ok
| |
| | |
| if I didn't want it, I would mark it
| |
| | |
| and press "Delete"
| |
| | |
| remember, if we press Delete we just
| |
| | |
| remove it from the diagram
| |
| | |
| "Ctrl+Delete" delete from the model completely
| |
| | |
| this association, I'm not interested to show in this diagram
| |
| | |
| so I press delete and not "Ctrl+Delete"
| |
| | |
| because that will remove it and I don't
| |
| | |
| want that, that would remove it from the model
| |
| | |
| I just want to remove it from the diagram,
| |
| | |
| delete, all right
| |
| | |
| let's look at this, what happens
| |
| | |
| the house has many tenants that are of class person
| |
| | |
| the person has many rented apartments
| |
| | |
| that are of class house
| |
| | |
| in every relationship that is many-to-many, like this
| |
| | |
| we have the ability to add
| |
| | |
| association class, like this
| |
| | |
| it's added with the dotted line tool, this one
| |
| | |
| let's check the tooltip drag-out
| |
| | |
| new association class connection
| |
| | |
| so if I press that one, I can find association
| |
| | |
| but I had one already, so I can remove the
| |
| | |
| association class by clicking the association line
| |
| | |
| find in the property inspector the class
| |
| | |
| that is selected
| |
| | |
| and I can choose to have no association class
| |
| | |
| when I do this the dotted line is removed
| |
| | |
| I can set it back by choosing it,
| |
| | |
| but the dotted line would not get there
| |
| | |
| because he and it's only
| |
| | |
| drawn, when added to the diagram
| |
| | |
| if it is a association, so a better way,
| |
| | |
| now to get it to show
| |
| | |
| I can remove this from view
| |
| | |
| and say right-click, introduce&removed...
| |
| | |
| that ended up outside the screen
| |
| | |
| still, introduce&removed, pick from available
| |
| | |
| when I remove this might
| |
| | |
| as well, just to make it easier for me
| |
| | |
| introduce pick from available own houses
| |
| | |
| rented apartments
| |
| | |
| you can see it, but I see it
| |
| | |
| I don't know how to get this on screen
| |
| | |
| so now it added the thing like this
| |
| | |
| so now we're back, where we started from
| |
| | |
| that was around about way
| |
| | |
| sorry about that
| |
| | |
| so these are the association ends
| |
| | |
| rented apartments and tenants
| |
| | |
| and these is the association
| |
| | |
| so on the association I see the ends
| |
| | |
| rented apartments and tenants
| |
| | |
| if I click one, I only see this association end
| |
| | |
| and the other one and I can see that
| |
| | |
| name property to tenants
| |
| | |
| if I click the other one, we see
| |
| | |
| the name property rented apartments
| |
| | |
| what about this, what actually happens is
| |
| | |
| there is an implicit link available in OCL for us
| |
| | |
| so that we can go from the house
| |
| | |
| to the lease contracts,
| |
| | |
| because the lease contracts are often quite good to use
| |
| | |
| and it has important information in this case
| |
| | |
| apartment number, end date and rent, etc.
| |
| | |
| so let's see how a viewmodel that
| |
| | |
| started in house and say that it had all houses
| |
| | |
| so I would add a nested...with
| |
| | |
| multilinks, house allinstances
| |
| | |
| ok, so this will be a list where I have all the houses
| |
| | |
| and for certain house I can say that
| |
| | |
| I want to show the street number
| |
| | |
| and for the selected house
| |
| | |
| I can see that I have a few multi-link options
| |
| | |
| is that onscreen for you
| |
| | |
| the tenants, which is this one
| |
| | |
| but also the lease contract which is that one
| |
| | |
| alright, so
| |
| | |
| if I add a list of those lease contract
| |
| | |
| self lease contract it ended up a bit missplaced
| |
| | |
| but let's say that for each house
| |
| | |
| each selected the house
| |
| | |
| I have a list of lease contracts
| |
| | |
| so let's add a few columns to that grid
| |
| | |
| that apartment number and rent
| |
| | |
| so what we've learned is that there is an implicit
| |
| | |
| link to get here
| |
| | |
| why is that link called lease contract
| |
| | |
| good question
| |
| | |
| actually, when we stand on the association
| |
| | |
| we fold down the one called tenants
| |
| | |
| we have something we called inner link name
| |
| | |
| and link role name
| |
| | |
| these are both to default and
| |
| | |
| default means that it's gonna
| |
| | |
| and get a name based on the class
| |
| | |
| it's pointing to basically
| |
| | |
| and remember that the one used
| |
| | |
| was called lease contract
| |
| | |
| why was it called lease contract
| |
| | |
| well it turns out it's the link role name
| |
| | |
| so if I were to change this to
| |
| | |
| the lease contract the ocl editor
| |
| | |
| would say that you use the name lease contract
| |
| | |
| I don't even know what that is
| |
| | |
| but the lease contracts that I know
| |
| | |
| so let's remove that one and type the lease contracts
| |
| | |
| and that's a collection of lease contract
| |
| | |
| so this is actually a better naming
| |
| | |
| of lease contract list
| |
| | |
| so instead of the default, but that was
| |
| | |
| when I point at this end "tenants"
| |
| | |
| I can really go this way, with the link role name
| |
| | |
| the lease contract
| |
| | |
| but once here, I might want to continue
| |
| | |
| to go up this way
| |
| | |
| and go that way
| |
| | |
| let's see, so I'm in a lease contract
| |
| | |
| going to add a generic empty column
| |
| | |
| used to get an OCL position to writing
| |
| | |
| and see roles, there is one called tenants person
| |
| | |
| and that one, the tenants going to
| |
| | |
| use that one, that's just...
| |
| | |
| that points out one person, but maybe
| |
| | |
| we think that is a good name
| |
| | |
| it's actually quite ok name, but just
| |
| | |
| for the sake of arguments
| |
| | |
| we're gonna change the inner link name
| |
| | |
| this is called the inner link
| |
| | |
| to the interlink name, let's call it
| |
| | |
| the tenant of the lease
| |
| | |
| and if I have done that and check this OCL again
| |
| | |
| it says, oh I don't know anything about
| |
| | |
| tenants from lease contract
| |
| | |
| but I do know the tenant of the lease,
| |
| | |
| so that's still the new name that we gave it
| |
| | |
| so what we have learned is of course
| |
| | |
| we can go straight to the tenants
| |
| | |
| it will be a list of persons,
| |
| | |
| but we can also go to
| |
| | |
| the link role name, to the lease contract
| |
| | |
| in this case, we called it the lease contracts
| |
| | |
| then we are here and then we might want
| |
| | |
| to go up here and to the specific person
| |
| | |
| associated with this lease contract and
| |
| | |
| that would be called the tenant of the lease
| |
| | |
| ok so important things with link objects
| |
| | |
| or association classes or that they are
| |
| | |
| life time controlled by the framework
| |
| | |
| this is really part of the uml standard
| |
| | |
| that whenever a person is associated
| |
| | |
| with the house, in this association
| |
| | |
| namely the person gets another rented apartment
| |
| | |
| if we add a house to the person's rented apartments
| |
| | |
| a lease contract will implicitly be created
| |
| | |
| we can't avoid it, that is what the link class does
| |
| | |
| whenever there's a new of object
| |
| | |
| added in this end of the association
| |
| | |
| and new link oobject is created in of this class
| |
| | |
| and the same is if we had a this class
| |
| | |
| and were to add it in person as a tenant
| |
| | |
| it would create at lease contract
| |
| | |
| so that means that we can always trust
| |
| | |
| that there will be at lease contract
| |
| | |
| where we have designed it this way
| |
| | |
| ok, but if that is the case that it is
| |
| | |
| lifetime controlled
| |
| | |
| by the existence of this association
| |
| | |
| and how can we then delete or remove a lease contract
| |
| | |
| instead we should remove the person
| |
| | |
| as a tenant, if we remove a person
| |
| | |
| as a talent, the lease contract
| |
| | |
| associated with that person will be removed
| |
| | |
| and vice versa, if a person would
| |
| | |
| remove a rented apartment
| |
| | |
| the lease contract would be destructed
| |
| | |
| logically the association class could be simulated this way
| |
| | |
| if we have a multilink of
| |
| | |
| lease contracts that points out one house
| |
| | |
| and we also had a multi-ink from
| |
| | |
| person to lease contracts that as one person
| |
| | |
| this is more or less equivalent
| |
| | |
| to this association class, but this
| |
| | |
| implementation of the same concept does not offer
| |
| | |
| the lifetime control that this
| |
| | |
| implementation does
| |
| | |
| this is often how we see association class
| |
| | |
| is done in databases
| |
| | |
| but the databases seldom offer their lifetime control
| |
| | |
| actually, when we do it
| |
| | |
| with an association class we cover a lot of ground
| |
| | |
| with very few concepts
| |
| | |
| this tells the reader of the model
| |
| | |
| that the lease contracts are
| |
| | |
| implicitly created whenever there's a house
| |
| | |
| and person in association
| |
| | |
| lets use set the specific attributes on that
| |
| | |
| it's a real strong concept of modeling and abstraction
| |
| | |
| so we're gonna try this out
| |
| | |
| I'm going to remove this column and
| |
| | |
| add an action to show this
| |
| | |
| just a dummy action add, global action for show
| |
| | |
| then I got that this action will be created
| |
| | |
| ok, save this and see why its
| |
| | |
| yeah, since I changed the innerlink names
| |
| | |
| I will need to change the places
| |
| | |
| where I use them
| |
| | |
| so, this could be a good example of
| |
| | |
| so, we are on a lease contract, but we want
| |
| | |
| the tenant of the lease, self.. instead... and
| |
| | |
| we had more errors, so instead of calling it
| |
| | |
| that it was called the lease contract
| |
| | |
| so I corrected those, start prototyping
| |
| | |
| and bring up our sample prototype and
| |
| | |
| see there's an exception null value in
| |
| | |
| link object, because we loaded the file
| |
| | |
| where there were missing data
| |
| | |
| since we changed it in the XML file
| |
| | |
| we don't evolve the data,
| |
| | |
| so if we change names
| |
| | |
| we can get and strange results like this
| |
| | |
| but the xml file is mainly suitable
| |
| | |
| for prototyping data so that's not a problem for us
| |
| | |
| we can just clean that up,
| |
| | |
| so I cleaned up the file, out of the screen
| |
| | |
| I basically recreated a file
| |
| | |
| so this was the one we created
| |
| | |
| we can see that, we see just this street
| |
| | |
| number and the apartment number
| |
| | |
| that might be a little vague
| |
| | |
| can we add something more, so that we get
| |
| | |
| some context, the street
| |
| | |
| model refresh, view, the street name,
| |
| | |
| if I pointed this one
| |
| | |
| I can see that I have a few lease contracts
| |
| | |
| but on each lease contract
| |
| | |
| I can add a generic column following to
| |
| | |
| the tenant of the lease and full name
| |
| | |
| like that, want to call that "full name", like that
| |
| | |
| so, if I kwould want to remove one of
| |
| | |
| these lease contracts
| |
| | |
| how would I go about that
| |
| | |
| well, let's say that we want to add a button
| |
| | |
| to remove lease contract
| |
| | |
| this time I'm gonna add a generic volume here
| |
| | |
| and I'm gonna check "is action"
| |
| | |
| it ended up there, I'm going to add here
| |
| | |
| don't need to be that big, like that
| |
| | |
| "Delete Picked Lease", so which one is the
| |
| | |
| currently picked lease
| |
| | |
| I know they are in this list, lease contract list
| |
| | |
| so there should be a variable called "vCurrent
| |
| | |
| lease contract list"
| |
| | |
| and let's try with a delete
| |
| | |
| remember the thing I said that shouldn't work
| |
| | |
| because this is actually lifetime
| |
| | |
| controlled by the framework
| |
| | |
| model-refresh, select, select this one and delete
| |
| | |
| and that's you saw that, went just fine
| |
| | |
| so actually I remembered wrong
| |
| | |
| it's ok to delete the link objects
| |
| | |
| because what we will do is to
| |
| | |
| clean up these two associations
| |
| | |
| you can do delete this, what I was referring to
| |
| | |
| is that we cannot remove things from the inner link
| |
| | |
| so let's try that next
| |
| | |
| because this has no possibility
| |
| | |
| to live without the house and the person
| |
| | |
| so the house and the person is the reason
| |
| | |
| for this existence, for its existence
| |
| | |
| so this was ok, but I'm gonna undo
| |
| | |
| we had that one right, undo, so "Ctrl+Z"
| |
| | |
| cancel on everything
| |
| | |
| Discard changes? - yes,
| |
| | |
| so let's head back to the view model
| |
| | |
| if I right click here
| |
| | |
| and insert row, I get a new in the grid
| |
| | |
| everything is moved down one step for me
| |
| | |
| so that's a convenient way
| |
| | |
| to get more space
| |
| | |
| so I don't have to move everything by hand
| |
| | |
| but gonna copy this action "ctrl-c", "ctrl-v" and
| |
| | |
| remove from inner link
| |
| | |
| this is what shouldn't be possible
| |
| | |
| so from instead the selected house
| |
| | |
| vCurrent all house
| |
| | |
| this is the selected house, vCurrent is one
| |
| | |
| the current one and don't confuse that
| |
| | |
| this with vSelected all house
| |
| | |
| that contains all houses, that are selected
| |
| | |
| so basically when I do this
| |
| | |
| hold ctrl down and select another one
| |
| | |
| can't do that because we are in edit mode here
| |
| | |
| when I do this I have houses multiple houses selected
| |
| | |
| and they are all in the vSelected all house collection of houses
| |
| | |
| but we just want to the current house
| |
| | |
| the currently selected, the currently focused house,
| |
| | |
| that's in the vCurrent all house
| |
| | |
| like that and the inner link
| |
| | |
| that we gave a name, explicit name
| |
| | |
| the lease contracts
| |
| | |
| we can try to remove
| |
| | |
| here we could use the currently focused lease contract
| |
| | |
| vCurrent lease contact list
| |
| | |
| that's the one that is the current in this list
| |
| | |
| so this would be illegal
| |
| | |
| if what I say is correct
| |
| | |
| now they are on the same spot,
| |
| | |
| I'm going to move this one here
| |
| | |
| remove from inner link
| |
| | |
| head back over here, model refresh,
| |
| | |
| show the view model again
| |
| | |
| now this one is selected and now that one is also
| |
| | |
| this one is vCurrent for all house
| |
| | |
| this is the current for lease contract list
| |
| | |
| remove from inner link error and
| |
| | |
| list of link objects is read-only
| |
| | |
| list of links object is read-only
| |
| | |
| that was where I was going for to show you
| |
| | |
| so that it's not allowed, because we can't
| |
| | |
| remove things in this implicit link
| |
| | |
| instead we would need to remove this one
| |
| | |
| from this link
| |
| | |
| so if we were to rectify this
| |
| | |
| let's do yet another copy
| |
| | |
| remove from correct link, we could use
| |
| | |
| the same vCurrent all house
| |
| | |
| but then it should be the role to tenants
| |
| | |
| from here we want to remove the vCurrent lease contract
| |
| | |
| but that will not be correct because that's
| |
| | |
| of the wrong type it expects a tenant
| |
| | |
| so we need to follow the inner link up to
| |
| | |
| the tenant of the lease
| |
| | |
| now we have the tenant of the lease
| |
| | |
| in the tenants collection
| |
| | |
| so the buttons ended up on top of each other
| |
| | |
| when I copy, going to move it here
| |
| | |
| so now I'm removing one of
| |
| | |
| these from the selected of those
| |
| | |
| selected of those following the inner link to here
| |
| | |
| inner link name, the tenant of the lease that name
| |
| | |
| and the link role name, that name
| |
| | |
| so there's an implicit name here and one here
| |
| | |
| I showed these in the second grid
| |
| | |
| but in order to remove, to delete this one
| |
| | |
| by removing
| |
| | |
| I need to remove one of these from this link
| |
| | |
| not really that confusing once you get the hang of it
| |
| | |
| model refresh, so I picked that one
| |
| | |
| and I picked this one
| |
| | |
| now I'm going to remove from correct
| |
| | |
| link and then it disappears and
| |
| | |
| what happens is that since one of these
| |
| | |
| objects are removed from this link
| |
| | |
| this one has no, one of these loses its right to exist
| |
| | |
| so it is destroyed by the framework
| |
| | |
| get some warnings, because they
| |
| | |
| should have apartment numbers
| |
| | |
| yeah, that's okay, the ones missing
| |
| | |
| apartment numbers were these step
| |
| | |
| or any other ones, these have,
| |
| | |
| ok so quite an in-depth check on Association classes
| |
| | |
| and how they work
| |
| | |
| let me know if you
| |
| | |
| have further questions
| |
| | |
| and we will dive into those as well thank you
| |