I am new to entity-relationship diagrams, but I am trying to plan out a concept for an app.
Using Facebook as an example, users can write comments on each other's walls, on their own walls, and on the walls for events and fan pages.
My question is this: How do you write a UML diagram for the relationship between a user and their comments, if their comments can be made to themselves and to other users?
UML is an object approach while entity-relational diagrams are related to data top down approach.
What I do is to mix Class diagram generating java annotations coming from my Database profile and then add Hibernate mapper to create my database.
Really cool but this is still not entity-relationship diagrams.
(source: forum-omondo.com)
It is true that UML is aimed towards OO, but it doesn't mean it cannot be used for data modeling. You can simply use the class diagram, which allows you to specify even foreign keys. However the tool support is questionable.
Related
Should I put the test classes in the UML diagram? I can't find any "best practice" about this!
It depends. Firstly "the UML diagram" suggests that you are creating a single diagram. This is definitely not good practice. Create as many diagrams as needed lighting certain aspects of the model. So - test cases would be one of those aspects. That means: put them in (a) separate diagram(s).
To add a suggestion, if you want to model tests, you can look to UML testing profile ( UTP link) it provides needed elements to model tests, requirements and so on.
You can use SysML also since it integrates a part of UTP.
It definitely depends on context. Who is going to use the UML model and what will they use it for? In general I would say that adding test classes is going to clutter a UML model and make it difficult to understand - so no. But if the context is that the testing is what you want to explain, then clearly the test classes are going to be pretty important.
As Thomas Kilian points out, creating a number of diagrams from one underlying model is probably the right answer - and being able to do this is one of the reasons you would use UML rather than a simple diagram.
This is a preference. You can choose to or choose not to.
I would say it's better practice to have the tests modeled into the solution. But I wouldn't claim I always follow best practices 🙊
There are many diagrams needed in modeling a solution. I would focus on three: Analysis, Design, and Implementation. All three are class diagrams. All three define your solution at different abstractions.
In the analysis, you're closest to the requirements and the beginning of your solution. In here, you would want to have broad classes. I would not put tests in here since this diagram is still trying to get the shape of the solution from the user and their requirements. An analysis diagram would only have class names in a box, with lines which show their associations.
The design diagram would go into a little more detail on how classes would be built. The blueprint of the application would take shape in the design. This design can be given to any programmer and they write code which would build the solution. The interesting part of the design diagram is that it could also be given to a test engineer and they would write proper tests for the solution to be created.
The implementation diagram is the lowest level class diagram which is created. Most times, I would create this in retrospect. The implementation diagram should be a verbatim translation of the codebase. In the implementation diagram, I would have my test classes included for completeness.
Note, these are my views which I sometimes do not follow to the letter because of business constraints. However, in an ideal world, this is how I would prefer my modeling done.
I am beginning in UML and software analyse and i do not understand how UML and diagrams can influence coding and software architecture while we can directly build the code and its data base without diagrams.
I read lot of tutorials abouat the subject but not enough to understand the utility of UML in coding.
I understand everey diagram and its role. That is not my problem but i do not yet understand their roles after the analyse and design phase.
So what is the role of UML in coding phase of a software ?
Thank you.
The comment by #xmojmr already puts it right. UML creates a model (hence the M in UML) of a system. A model reduces information of a system to a level so it is a) manageable and b) complete. Human brains are not computers and you need a means of communication what the system is all about. You can do that as pure code, as paper document and as UML model. A combination of all is not uncommon. As long as you have tiny systems you can live with pur code and tools like Doxygen. But once it starts getting complex you need some handles. UML offers these to end users, architects, testers, developers, managers, etc. Along with UML you will also need a methodology. UML delivers the syntax how to document a system. But you need some structure above to write a nice novel.
UML-based models play an essential role for coding/implementing a software system in model-based (or model-driven) development. The basic idea is that you start making a model of your problem domain (the domain model), then you derive from it a platform-independent design model, which can be transformed into platform-specific implementation models (e.g. for Java- or C#-based platforms) that are finally encoded in the target languages.
The most prominent part of model-based development is the encoding of model classes (forming the model layer in an MVC architecture for apps) based on a data model (a UML class model) that has been derived from an information design model, which was obtained from a domain information model (where all these information/data models are UML class models).
You can find an instructive example of model-based development in my tutorial book Engineering Front-End Web Apps with Plain JavaScript.
This one is in my point of view a duplicate of that other question. It can't be flagged because there is no accepted answer. The related question on meta stackexchange does not provide a clear solution to that situation.
I think my personal answer was relevant and is applicable to the current question.
To be synthetic, Martin Fowler considers current uses of UML. I think he describe the current practices. Perhaps should these evolve ?
Perhaps would the initial question be the right place to discuss ?
UML notations says, Usecases are drawn to point out the functional requirements in the Problem Domain, it by no means gives the information about object or class as Data Flow Diagrams or Entity Relationship diagrams. But also why do we use Usecase Diagrams in object oriented analysis and design even if Usecases are not considered as Object oriented.
Use case diagram is meant to shed light on the main functionalities of the system , and emphasis the perspective presenting the latter as a blackBox merely existing for a sole mission;deliver to the actor the Promised service .
At this point we don't realy care about OOP realy , as you can definetly use Use case diagram for any other type of analysis.
UML is just a set of visual tools to allow a unified expression of different perspective of the system.
In Case you are using The Unified Process it advocates to start with identifiying the use cases first then explode every use case into collaborative entities (classes) and establish the static collaboration between them by harnessing the Class Diagram toolbox.
Object-oriented is analysis and design methodology, while use case is requirements methodology.
And be aware of the core development workflow:
Business modeling
Requirements
Analysis
Design
If we use UML to do these works, we may have:
Business use case+ Business sequence diagram
System use case+ System use case specification
Analysis class diagram+ Analysis sequence diagram+ Analysis state machine diagram
Code, Database......
UML diagrams in 3. can be replaced by DFD/ER
Kirill Fakhroutdinov's online book uml-diagrams.org defines UML as
The Unified Modeling Language™ (UML®) is a standard visual modeling language intended to be used for
modeling business and similar processes,
analysis, design, and implementation of software-based systems
UML is a common language for business analysts, software architects and developers used to describe, specify, design, and document existing or new business processes, structure and behavior of artifacts of software systems....
As such the language needs words to describe processes, their actors (the code and its users, why the code exists, what is it good for, why someone should pay a money for it..)..
If in your designs you don't need to take users and their needs into account (you have the user interface designs set and you are focusing just on a library code) then don't bother, use UML to describe the parts you are dealing with and use diagrams that are natural and useful for you (and your teammates)
Some related articles:
http://www.uml-diagrams.org/use-case-diagrams.html
http://www.jamasoftware.com/blog/when-use-cases-arent-enough-part-1/
http://agilemodeling.com/essays/agileRequirements.htm
http://www.sparxsystems.com/downloads/whitepapers/Requirements_Management_in_Enterprise_Architect.pdf
http://alistair.cockburn.us/Stop+confusing+use+cases+and+user+stories (and http://c2.com/cgi/wiki?UserStoryAndUseCaseComparison)
If well use cases diagrams are mainly intended for communication with non-technical people, I would like to add that in some software architectures (like Clean Architecture), use cases are represented as actual objects that orchestrate the entities (they are equal to services after all).
Eg.
Given the use case "Submit Issue", you can create the following definition for it:
Submit Issue Use Case
Input data:
issue_id
issue_description
date
Output data:
same input data as confirmation
Primary Course
Validate input data
Create new Issue instance using the input data
Persist new Issue
return confirmation data
As you can see in the Primary course, there is even a detectable dependency between this use case and an entity object named "Issue".
A python example for this SubmitIssue Use Case class:
class SubmitIssue(UseCase):
def __init__(issue_repo):
self._repo = issue_repo
def execute(self, input_data):
#validate input data as needed
#and apply branching logic if it is valid
new_issue = Issue(input_data) #create new issue
self._repo.add(new_issue) #persist new issue
return self._generate_output_data(new_issue)
#staticmethod
def _generate_output_data(new_issue):
#logic that returns the output data as specified
#in the use case output data definition
return output_data
regards.
I'm not sure if this is the right place to ask this question but here goes.
I'm currently looking into some different techniques to model a business proces. I need to find a suitable option for my company which develops all kind of web applications.
What i have found so far:
UML, specificly the activity diagrams
Flow charts
Windows workflow foundation
Business process modeling
I had a dive into the world of workflows but it's mainly about automating a process of a company and thats not what I'm looking for. My focus is on software and the process within.
If anyone else knows some other technique or can tell me the advantages or disadvanteges of the techniques I allready found that would be much appreciated because I'm a little stuck right now.
Right now BPMN (Business Process Modeling Notation) and UML activity diagrams are the two most popular options for that.
I think of BPMN as the right choice when you are modeling the business aspects of the organization and move to Activity Diagrams as soon as you drill down to the technical design of the software system (as a core component of the UML language, activity diagrams are a better fit when having to combine workflow information with other views of the system, expressed also as UML diagrams like class diagrams or sequence diagrams).
Note that now a UML profile for BPMN is being created which means that you will be able to mix BPMN and UML diagrams in the same project
I suggest you consider ISO/IEC 24744. It will give you a very different perspective, since it does not use the ubiquitous "organisation as machine" metaphor, going for a more opportunistic, people-oriented viewpoint.
In other words, ISO/IEC 24744 does not represent a business process as a workflow where the process to follow is the driver. Instead, a business process is represented through the work products that are involved and the people that act upon them. The process performed plays an important but secondary role.
If you are interested in why this is so, or what the advantages are, let me know and I'll be happy to elaborate.
I think you are asking about transforming your business requirements/rules into technical requirements and then into a design? After that you will implement this design into code.
Am not sure if this is what you are asking about..
Just I am new to Object Modelling.I want to know still there is a need to use Sequence Diagram, Use case Diagram to develop an object model or any other new technology is available?
Update :
CRC (Class,Responsibilites,Collaborator) is very limited ?
It depends on the team or teams you're working with. The chief benefit of UML is that you can share diagrams with other individuals and teams without having to learn each others diagramming language. If the team you're working with doesn't know UML, it may not be worth going down that road unless everyone is interested and you know you'll be working together for a while.
In my experience UML sequence diagrams and object model diagrams are very usefully and generally understood by all. Sequence diagrams in particular have the ability to resolve design issues through the disipline of their construction. I haven't found use case diagrams to be as useful. Requirements are challenging and strongly dependent on human and organizational factors regardless of the methodology.
If you're communcating with non-technical stakeholders, UML is a waste of time because they won't have studied it. Use simple, well annotated diagrams. Colors are very effective.
If your team is all onsite, sometimes there's nothing better than a couple of whiteboards and a freeform diagramming style.
You don't necessarily need these items. They are just aids which are available if you choose to utilise them. They are particularly useful in a business environment where you need to articulate your architecture to fellow developers, but you can choose to use whatever you like, inc. your own personal standards or no standards at all!
"any other new technology is available?"
No.
UML pretty much dominates. A classic ERD is just a specialized class diagram that omits the method box from each class. Also, classic ERD's use crows feet instead of text annotation for cardinality and optionality. So ERD's are actually part of UML.
You can read about OPM, if you want something slightly different. They appear to combine an activity diagram and a class diagram into one thing: a process-data diagram.