Understanding Data Modeling vs Object Modeling
Data modeling involves exploring data-oriented structures, identifying entity types, and assigning attributes similar to class modeling in object-oriented development. Object models should not be solely based on existing data schemas due to impedance mismatches between object and relational paradigms. It is essential to properly map objects to relational databases for effective development.
Download Presentation
![](/assets/img/so-down.gif)
Please find below an Image/Link to download the presentation.
The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author. Download presentation by click this link. If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.
E N D
Presentation Transcript
Data Modeling VS Object Modeling L2 3-2-2020
Data Modeling Data Modeling Data modeling is the act of exploring data-oriented structures. Like other modeling artifacts data models can be used for a variety of purposes. From the point of view of an object-oriented developer data modeling is conceptually similar to class modeling. With data modeling you identify entity types whereas with class modeling you identify classes. Data attributes are assigned to entity types just as you would assign attributes and operations to classes. There are associations between entities, similar to the associations between classes relationships, inheritance, composition, and aggregation are all applicable concepts in data modeling.
Steps for Data modeling Steps for Data modeling The following tasks are performed in an iterative manner: Identify entity types Identify attributes Apply naming conventions Identify relationships Apply data model patterns (analysis pattern for reuse etc.) Assign keys Normalize to reduce data redundancy De-normalize to improve performance - See more at: http://www.agiledata.org/essays/dataModeling101.html#sthash.tBH8f6xj.dpuf
Why Data Models Shouldn't Drive Object Models (And Vice Versa) A common problem is the idea that a data model should drive the development of objects. This idea comes in two flavors: physical data schema should drive the development of objects and that a conceptual/logical data model should be (almost) completely developed up front before beginning to design objects. Both of these views are inappropriate for non-agile projects as well as for agile projects. Why do we want to base object models on existing data schemas? First, there is very likely a desire to reuse the existing thinking that went behind the current schema. But it is important to reuse only right things. There is an impedance mismatch (conceptual and technical difficulties) between the object and relational paradigms, and this mismatch leads object and data practitioners to different designs. Object developers apply different design techniques and concepts than the techniques that data modelers apply. Second, the database owner seeks to maintain or even enhance their political standing within an organization by forcing developers to base their application on their existing design. http://www.agiledata.org/essays/drivingForces.html#sthash.sBpfWrV1.dpuf
What to do? First, look at existing physical data models to get an idea of what is currently going on, and look for the technical constraints. Don t limit the application with a bad database design. Second, even if the existing database design is very good there can be significant differences in the way that objects are mapped to relational databases. The solution is to properly map Objects to relational databases http://www.agiledata.org/essays/drivingForces.html#sthash.sBpfWrV1.dpuf
Example: Online book store Starting with data modeling!
Data Modeling for Online Book Store Data Modeling for Online Book Store Customers will use a web based interface to browse books based on categories. Books are represented by, ISBN, Title, Author, Publisher, Edition, Year of Publication, Price, Short Reviews if available, ratings and recommendations, Table of Contents if available., an image of the book cover, category e.g., computer science, History, General Knowledge, Biography, etc. Only digital copy of books (in pdf format) will be available. Books are not available in hard copy. (printing and free distribution of pdf will not be allowed). Customers can simply search books using keywords. A keyword can be an author name, book title (or part of title), or a category, such as History . The system will provide all search results based on the keyword provided. Search can be filtered on specific categories. Search can also be filtered on a language (Eng., Urdu), or on a price range (<1000, 1000-2000, >2000, etc.) Initially only the title and author of the book(s) are displayed; on click (of a selection) other attributes are displayed.
Customers create accounts in the book store. Each account contains customer profile information: name, age, geographical location, categories of interest, email. Each account has a PayPal account linked to it. Profile information can be updated by the customer. Customers will login to the book store using an account name and password. Customers can save books in cart or as favorite for later use. Guest users can search but must create account for purchase. Registered customers will be provided recommendations based on their profile. Best sellers, latest arrivals will be displayed for all customers. All online sales data are recorded in the database with timestamp. The system will have a separate view of admin, customers (and suppliers - optional). Customers can buy books using their PayPal account. The customers will be able to remove or add more books the order before making a payment.
Paypal will be used to manage the Shopping cart and to deal with the payment options (using PayPal https://developer.paypal.com/docs/classic/lifecycle/ug_sandbox/). If the payment transaction is successful, a tracking number and receipt will be generated. The users will be able to track their shipment, based on this tracking number. Sandbox Testing environment Extra features A supplier account can also be created. A supplier will upload pdf of books. The owner will purchase the book from the supplier through paypal.
Database design Book ISBN - Primary Key Title Author Publisher Edition Year Price Reviews Rating recommendations Contents ImagePath SourcePath Popularity Category_ID
Customer Customer_ID - Primary Key Name Age Location Interests Email Epurse Username Password IfAdmin
Category Category_ID - Primary Key Name Parent_ID
Sales Book - Foreign Key Customer Foreign Key Timestamp SalesID Primary Key
Publishers Name Address PublisherID primary key
Order Book_id - Foreign Key Customer_id Foreign Key OrderID Primary Key
Do we need any stored procedure? DB group: read about stored procedures, if these are of any use here to increase the efficiency and security.