Presentation is loading. Please wait.

Presentation is loading. Please wait.

Generic Modeling. 2 home back first prev next last What Will I Learn? In this lesson, you will learn to: –Define generic modeling –Evaluate and describe.

Similar presentations


Presentation on theme: "Generic Modeling. 2 home back first prev next last What Will I Learn? In this lesson, you will learn to: –Define generic modeling –Evaluate and describe."— Presentation transcript:

1 Generic Modeling

2 2 home back first prev next last What Will I Learn? In this lesson, you will learn to: –Define generic modeling –Evaluate and describe the advantages and disadvantages of generic modeling –Construct a generic version of a more specific data model

3 3 home back first prev next last Why Learn It? Generic models can reduce the number of entities in a diagram and provide a lot of flexibility in unstable situations, where the business requirements change often. A business that needs to frequently add entities and/or attributes could benefit from generic modeling. One example would be a pawnshop ( 当铺 ) that buys and sells different types of items all the time. It would be difficult to predict the number of item types and the different attributes each type would have.

4 4 home back first prev next last Background Knowledge When database has been built according to the ER Model: –Entity has changed to TABLE. –Attribute and relationship has changed to COLUMN. –Instance has changed to ROW or RECORD in TABLE. Users can change rows/data by themselves but they can not change the TABLE or COLUMN of the database. They can not change the structure of the database. –As the user of your house, you can decide what can be stored in a house. But if you need to add a room in your house, you cannot do it by yourself. You must ask help from the professionals.

5 5 home back first prev next last Background Knowledge If the business of your client changes very quickly and you are asked to add some new tables or columns every week, that would be a disaster for you. In this case, Generic Modeling can save you.

6 6 home back first prev next last The main idea Modify your model –Change some Entity/table to instance/row –Change some Attribute/column to instance/row So the client can do the work by themselves. To understand the contents of this lesson, you need to simulate your client and try some new requirements. Then you can see how your model can adapt to the new requirements.

7 7 home back first prev next last Changing Article type from Entity to Instance Generic modeling looks at the same context from another, more distant perspective. From a distance, many things look the same.

8 8 home back first prev next last Changing Article type from Entity to Instance Suppose you are to make a model for a clothing store. The business typically sells many different articles: shoes, shirts, dresses, pants, and so on. For each type of clothing article, there are different attributes. You can model every type as an entity. Or you could create a more generic model that uses one entity, ARTICLE, with or without subtypes. However, this model would be fine only if there were no (or possibly very few) new instances of ARTICLE TYPE during the life cycle of the system. –For example, the store need to sell shoes tommorrow and the shoes have new attributes which are not included in the model. How can the store track these data?

9 9 home back first prev next last Recycling of Attributes Another generic model involves recycling attributes. Using this structure, here are some examples of instances of ARTICLE TYPE:

10 10 home back first prev next last Recycling of Attribute You can also store information about the data types of each property in the definition attributes (example: property 2 for all articles (length) has a data type of number, property 4 of DRESS (bodice style) is stored as text)

11 11 home back first prev next last Recycling of Attribute These would be the examples of corresponding instances of ARTICLE Using this method, you can add new types of articles fairly easily, provided that the number of attributes does not exceed the maximum that was originally defined.

12 12 home back first prev next last Attributes Modeled as Property Instance This model takes a third approach. –Every value for a property of an ARTICLE is stored separately. This model gives a lot of freedom to define new articles and properties during the life cycle of the system. –Using this structure, here are some examples of instances of each entity:

13 13 home back first prev next last Attributes Modeled as Property Instance In this model, Attributes of ARTICLE have been changed into instances of PROPERTY and ARTICLE PROPERTY VALUE.

14 14 home back first prev next last Generic Models Benefits: –(1) Flexible -- can prevent the need to change data structures in the future –(2) Can reduce the number of entities dramatically –Cost: Increased complexity in both the data model and application programs

15 15 home back first prev next last Terminology Key terms used in this lesson include: –Generic –Perspective

16 16 home back first prev next last Summary In this lesson, you have learned to: –Define generic modeling –Evaluate and describe the advantages and disadvantages of generic modeling –Construct a generic version of a more specific data model


Download ppt "Generic Modeling. 2 home back first prev next last What Will I Learn? In this lesson, you will learn to: –Define generic modeling –Evaluate and describe."

Similar presentations


Ads by Google