I have been asked this question and even after a lot of research, I cannot find the answer.
When I design a database using Entity relationship (ER) and then re-draw it as UML class model (extended with Data modeling profile for UML), what are the differences and how both models can be (in their way) useful for db developer? With regard to multiplicity, foreign keys..
UML class - model doesn't support views, stored procedures, triggers and databases elements. ER does.
There is NO data modelling profile over class diagram in UML. look a search. It seams, it is a special feature of IBM, but they don't keep to UML.
We can draw anything on the newly-invented diagram language. But what is the use of it? If you are really interested, study the pdf.
Related
is there any way to create Django Models from a given UML drawing (e.g. in diagrams.net).
Since I am still new to Django I would like to learn best practices on how to generate models in the most efficient ways.
Thanks inadvance!
I am new to Zend Framework and currently struggling with the implementation of Model. Actually, what I want is as follows:
I have two tables (am using MySQL):
Musicians(id, name)
Albums(id, musician_id, album_name)
Now, I want to design the model, so that I can create an efficient join query in there.
I have tried many things, but am unclear about various things. For example, currently I have created a Table class (which extends Zend_Db_Table_Abstract), a model class and a model_mapper class. I am not sure, what code to put in which file and how actually I am going to call the model functions (containing the query result) in the action function in controller.
Any help is highly appreciated.
There is no single answer to this question. The best code to put in each class is based on the application logic your requirements call for.
There are methodologies to guide object-oriented design:
GRASP
SOLID
Domain-Driven Design
This free e-book has an introduction to DDD: Domain-Driven Design Quickly
I am trying to read and understand the source of an existing C project. I keep feeling like it would be great to draw a UML Class Diagram for it to help me understand the high level relationships better, but of course - there are no classes to model.
Is there a formal diagram system that is used to model module relationships in a non-OO language? One that would be on a similar level of abstraction to a UML Class Diagram.
One alternative is to use Doxygen to map your function tree.
The OO paradigm is not a property of programming language and it's very possible to make OO implementation in C (just hard and not very intuitive). The OO design (in UML or any other modeling language) is not bound to a specific language.
Now let's get back to your question. There are many tools available for non-OO design. You can find a nice summary here and choose what fits you best.
Try FMC ( http://www.fmc-modeling.org/home) and "Apache Modelling Project" (Apache HTTP Sever modeled using FMC: http://www.fmc-modeling.org/projects/apache) as a starting point and guideline.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 3 years ago.
Improve this question
I have created an class diagram of my application, I wonder if it's possible to create an relational database diagram based on the class diagram. If it's possible, can it also be done the other way arround?
A class diagram represents a system using the object model. A relational database diagram represents a system of data using the relational model. There are significant differences between the ways these two models will present the same system. And a data model does not model behavior. It only models data.
There is, however, a modeling system that is sort of halfway between a class diagram and a relational diagram. Its called an E-R diagram, where E-R is short for Entity-Relationship. In the E-R model, the entire subject matter is analyzed into "entities", which can be persons, places, or things that have an identity. They can even be intangible things, like a bank account. Relationships involve two or more entities, and its assertions about the relationships that make up much of the data in a database. Data values are instances of attributes, and attributes describe either entities or relationships among entities.
Most of the E-R diagrams you'll see in SO are really relational diagrams masquerading as ER diagrams. In a true ER diagram, foreign keys are not present, many-to-many relationships can be diagrammed as a single line, and such things as gen-spec patterns look much the same way as they do in class diagrams. If fact, an ER diagram can be viewed as the projection of an object world onto the world of data only.
If you'll learn ER modeling as a distinct activity from relational modeling, resulting in a different model, you'll find it fairly easy to transform class diagrams into ER diagrams.
From there, transforming ER diagrams into relational diagrams is almost mechanical. Every entity gets a table, many-to-many relationships get their own table. Inheritance and association get special treatment, and so on. Relationships which were treated as abstractions in the world of ER modeling become materialized as foreign keys. The primary key of each table becomes obvious in terms of the key attributes of entities in the ER model.
And what were called "attributes" in the ER model (possibly "properties" in the class model) become "columns" in the relational model.
there are some fancy tools that manage object models, ER models, and relational models all in the same tool, and can move between these models for you. One of them, "Data Architect" was very good but very pricey a few years back.
Not sure what you mean by a "relational database diagram". If you refer to a SQL script with the DDL sentences to create the relational schema for your model, then maybe you can just see how tools do this transformation (e.g. check this online UML to SQL code generator http://modeling-languages.com/content/uml2db-full-code-generation-sql-scripts-databases)
Most of the transformations rules are straightforward (class-> table, attribute ->column, association -> foreign key,...) but you can play with UML diagrams with inheritance and association classes and see how this is translated.
Another option that I use is add Database stereotypes in my class diagram. It generates Java persistence annotation in my code. Finally I generate my code from my Java code with Hibernate.
It works really well !!
Using Enterprise Architect you can automatically generate your Class modals into relational database models using its MDA (Model Driven Architecture) Transformations. This saves you the work of having to re-do all your diagrams again by hand.
More Information on MDA Transformations
I am developing an application in WPF using the MVVM pattern. If I have Student as a data model, for example, where could I add the business logic like adding new Students, deleting Students and updating Student info, calculating marks and so on?
Does all the business logics come under the model or the viewmodel?
If it is in the model how can we do that? Any example code please? I need full code for an example!
Business logic should be part of of your model, as all of that code should be reusable across different technology platforms. For example, you may want to reuse your models across a web site in ASP.NET MVC, and a desktop application in WPF, so it wouldn't make sense to have business logic in your view models.
View models should contain presentation logic which is specific to that particular application instance.
As for example code, this will be specific to the domain that you are modelling, so you would have to ask a more specific question about what you are trying to model.
I suggest you read PRISM documentation on this subject: Chapter 5: Implementing the MVVM Pattern.
Even if you don't plan to use PRISM, the article is very well written and details the pattern in Microsoft's technology terms.
I would trust very little of what Microsoft has to say on Patterns as their articles are often dated, or modified to support their own proprietary frameworks or products. Also I've found MS thoughts/approaches contradictory within their different teams and also within the generally accepted approach in software.
Not all of it is good and not all of it is bad basically.
To answer your question. I'd use a Service for Business Logic. I'd instantiate a reference to it in the ViewModel and I would not put any logic in either the ViewModel or the Model that did not have anything to do with their role. ie Presentation logic is okay dependingon what it is, it might be best placed in the ViewModel as it is highly tied to the View in question. Same goes for the model.
Keeping in mind these roles you will have a scaleable and testable application.