Hi, I have recently started to learn system analysis and design and am having some trouble understanding domain model class diagram (DMCD) association class.
As per image, when drawing the DMCD, I'd like to understand if an association class is allowed to contain attributes of the classes it derives from. The Invoice needs to contain the attributes apptNo and svcName.
Association class inquiry image:
Do I include the attributes as shown in the image?
Or do I assume that the Invoice would already have these attributes because it is derived from Appointment and Service and that it is not necessary to include them as they can be referred back to the keys apptNo and svcID?
I am confused about the concept. How should I present the association class?
Can someone please provide some guidance?
Thank you.
As already pointed out by Geert Bellekens in his comment above, you don't repeat any of the attributes of the classes involved in an association class in the association class. You only include attributes that specifically characterize the links classified by the association class.
In your example, you should only include attributes that are specific for Invoice links, such as invNo, invDate and totalPrice.
This rule holds independently of the kind of class diagram (domain/design/implementation model).
However, your model is only good for invoices refering to one appointment and one service. It does not account for invoices concerning one appointment, no matter how many services it includes. In a model for this business logic, Invoice would no longer be an association class, but an ordinary class associated with Appointment. This would allow it to access each service included in an appointment and turn it into an invoice line.
To make it short:
is (sort of; please read the comments below) an alternative notation for
which means that Class3 already has associations to both Class1 and Class2. So there's no point in adding attributes of the latter in the association class. If you're on a DB level you eventually introduce redundancy for performance reason at the cost of violating the principle of single source of truth. But that's another story.
It depends.
A domain model class diagram models the concepts found in the domain, i.e. the part of the real world relevant for your project. In the classes, you only include attributes that are indicated by domain experts or by other sources describing the domain.
I will assume that a domain expert knows what an appointment number and a service name are. If these were just technical data, they should not be attributes of Appointment and Service in the first place. To determine whether these attributes should also be included in Invoice, you need to ask domain experts what they think. Does an invoice always include an appointment number and a service name? Only if the domain expert says "Yes", I would model them as attributes of Invoice.
(To double check, you could ask "Is it also valid to say that the appointment number is not part of the invoice, but that the invoice is somehow associated with an appointment having a particular appointment number?")
Maybe the domain expert says an invoice does not contain the appointment number or the service name, because the corresponding Appointment and Service are always associated to the Invoice as attachments or hyperlinks or otherwise. In that case, the fact that Invoice is an association class on the association between Appointment and Service is enough. You don't have to include attributes of these classes in Invoice. These will probably be added later, when the domain model class diagram is turned into a system model class diagram or database model class diagram.
Related
I have a scenario about a customer purchasing a stock from a company and calculating branch sales. So I made a class diagram of customer, purchase and branch sales but I am not sure what to put in the branch sales entity as this branch sales should indicate total sales done for each branch.
Here my diagram:
Should the branch sales includes purch_totalprice, purch_stock, and purch_stockquantity too, like in purchase entity?
The diagram looks more like an entity/relationship diagram for database tables than like an UML class diagram:
In an UML class diagram, you would not use a dotted line to separate the unique identifier form the other properties, but you would use a separator to show operations (i.e. methods or functions).
In an ER diagram, this practice is less unusual althoug not common either.
This being said, whatever the modelling language, this diagram:
doesn't show what the Customer is purchasing. stock is too ambiguous: is it a material that you have in an inventory? Is this a stock-exchange stock (a share in a company)? Whatever the answer, it would be nice to show this as an own class/entity (I'll use Product hereafter).
doesn't show any class/entity that is identified with a branch_id. I'd suggest to add an entity called Branch
doesn't show the associations/relations. You should have at least Customer--Purchase, Purchase--Product, and Purchase---Branch, nor their multiplicity/cardinality.
If you have all these information in your model, the "branch sales" are in fact a data extract of Purchase and not a distinct entity: the purchase of the customer being the sales for the branch. For your diagram:
If you're on a class model, you'd add a getSalesDetails() function: this function would return the list of all the relevant Purchase objects for that branch. You could also add a getTotalSales() that would make do a total of the relevant sales. Perhap's taking into account a date of the purchase?
If you're in an ER model, you would know how to find this data thanks to the association between branch and purchase (you can make it clear by labelling the relation Branch--Purchase as makes sales. But you could also show a separate table with the relevant data duplicated, if you want to document your physical model and intend to implement this in your database (either with redundant data ,not recommended, or with a view)
Last important remark regarding classes:
If your diagram should be an UML class diagram, but you want to show the details of your database model, you may put «table» above every entity.
But if you do not intend to document classes, i.e. the classes would stay without operations (i.e. class behavior) there's really something missing - it's like an anemic domain model (not forbident, but far from ideal).
I have this basic class diagram:
and was wondering whether this object diagram is allowed:
The class diagram is given and I was wondering whether it is possible to create an object diagram where two customers (maybe wife and husband) are sharing the same bank account with this structure. But because a composition is used, the bank account would get deleted if one of the owners gets deleted right? So this class diagram is not really suitable for shared accounts, right?
This scenario for the objects in the second diagram is indeed not valid. The reason is that composition implies an exclusive ownership.
For an account to be shared by several customers you’d have to change the class diagram, for example:
use aggregation instead of composition (white diamond). Although its semantics are not well defined in the UML specification, it allows in any case for shared ownership.
use a simple association (without diamond). You could express the fact that an account has several customers with an explicit multiplicity.
use a composite client: the client could either be a single person, or a group of several clients. This construct is more complex.
The diagram below is based on these facts:
A citizen may make a claim / reclamation on pollutions
An administrator will send the reclamation by type to the appropriate agency / organization, and it will respond with a diagnostic report
This report will be sent by the administrator, to another organization, for the estimation of the solution (costs, etc.).
My problem is to how can I show that Admin will send the claim to an agency? Do I have to make an association between Organization and Reclamation?
If your requirements include that the communication between the Admin and the Organization is to be documented, then you need to take care of this in your class diagram. And, in fact, you already have an item for this: the NotifyOrganization association class. Notice, however, that it's not a good idea to use the questionable UML concept of an association class, which does not have a clear semantics and is confusing. This seems to be confirmed by your flawed modeling of the multiplicities of the NotifyOrganization association, which must not be one-to-one (or 1 to 0..1), but rather many-to-many (* to *).
So, better replace the NotifyOrganization association class with an ordinary class (possibly with an improved name such as Notification) and attach it to Admin and Organization with two many-to-one associations such that each notification is linked to exactly one admin and one Organization.
Notice that a notification represents a (communication/message) event, so Notification represents an event type. It*s quite common in business information models to have both object types and event types, both as classes in a UML class diagram.
...how can I show that Admin will send the claim to an agency?
UML Class Diagram is not show-everything document. In order to document that admin will send claim to agency you can document it effectively using UML Sequence Diagram or some other behavior diagram
...do I have to make an association between Organization and Reclamation?
No, if the agency does not need to care about who exactly delivered the claim or what's the person's role (e.g. "admin"), then you don' have to add it to the class model (and show some association) at all
...diagram...based on these facts...
In order to describe the overall process in a one-page style picture, you (and your business partners) can find very useful the Business Process Model and Notation (BPMN) graphical language in addition to UML
I have an abstract base class Contact that has two subclasses: Person and Company.
I want to have a Customer, Vendor or other types that can be either a Company or a Person (all sharing the same primary key ContactId).
My question is if it's possible to inherit all these types from Contact? If the answer is no, is there another option of utilizing the Contact property from the PK? What's the recommended design for this scenario?
Note that I want an Employee/Customer etc. to also be able to be a User.
How would you achieve that in C#? That is the first question you must answer yourselves because .NET doesn't support multi-inheritance so you cannot have single Customer class derived from Person or / and Company - you need separate Customer class derived from Person and another Customer class derived from Company but every time you see this you should know that you are doing something wrong. Also if you in the future find that you need to have Contact which is both Employee and Customer you will be ready to delete whole your application because with inheritance there will be no way to achieve that. Changing Contact from Customer to Employee will be possible only with direct SQL because EF doesn't allow that.
Inheritance is not solution for your problem - you must use composition (relations).
I am trying to draw a domain model or class diagram in UML for car dealership. I am stuck with how to present test drive in the model. One way is to have appointment class and then test-drive as sub class. A dealer also offers after-sale vehicle service so i could have appointment/booking class as super class and then vehicle service and test-drive as two sub classes.
Another way is to have the customer class have a direct relationship with test drive class and vehicle service class under appointment class.
A dealer also sells new and used cars and their parts.
A dealer also offers finance for car sale.
Would testdrive class have relationship with vehicle class or there is separate class for display and testdrive class?
Another question is how do I show potential customers and their inquiries about sale and service in the model. A dealer wants to save details of potential customers if they allow for marketing purposes. Shall I have two classes: one for customers and one for potential customers or it can be achieved just by using an attribute in customer class?
You can really only distinguish the right decision by having a good set of use cases or expected behaviors of the model.
This will inform whether a particular sub-classing is really accurate.
I can see that an appointment might contain several test-drives, which are themselves linked to individual vehicles, So a test-drive itself is nothing more than a link from a customer to a vehicle which are linked to an appointment.
test-drive would contain the information relevant only to the test-drive:
reference to the customer - even this might be debatable to include
reference to the vehicle
length of test drive
location (perhaps the vehicle was driven at a different location than could be determined from the owning appointment)
customer temperature (hot or cold - i.e. did the customer seem enthusiastic)
comments
etc.
But what is not in the test-drive object is anything related to the appointment - since it is always contained in a collection - possibly as part of an appointment or some other event container. Now if the containers which can contain test-drives always include customer information, I might not even include the customer reference in the test-drive object - after all, it will be redundant.
It depends if test-drives can occur in non-appointment scenarios - perhaps at a "sales event" or an "open house" or something where appointments are not actually created in the use cases - or if test-drives for multiple customers will occur within a container.
The second part of your question has been forgotten (easily done when you ask two questions in one):
Another question is how do I show potential customers and their inquiries about sale and service in the model. A dealer wants to save details of potential customers if they allow for marketing purposes. Shall I have two classes: one for customers and one for potential customers or it can be achieved just by using an attribute in customer class?
I think your use case there is "A dealer wants to save details of potential customers if they allow for marketing purposes." and the simplest solution is to have a Mailing List collection which holds name and address of each potential customer.
I think you miss the point. The aim of the domain model is make famliiar you with the domain:
-- What kind of entities you have in yor domain?
-- If they are important for your system under desing,
what kind of properties they have, how they behave?
-- What kind of business rules they obey?
The rest is details. Think like a map maker. Record what there is.Create a simple map so you can not lost your way in that domain. Not try to invent.Abstract what exist in the domain: Not run behind the "fancy abstractions" you created yourself.
Domain model can be used as a source
for object oriented analysis/design.
But their aim is not to represent
software abstractions.