Presentation is loading. Please wait.

Presentation is loading. Please wait.

CH 10 DB Application Design n 10.1 Functions n 10.2 Case Application n 10.3 Creating, Reading, Updating, Deleting View n 10.4 Form Design n 10.5 Report.

Similar presentations


Presentation on theme: "CH 10 DB Application Design n 10.1 Functions n 10.2 Case Application n 10.3 Creating, Reading, Updating, Deleting View n 10.4 Form Design n 10.5 Report."— Presentation transcript:

1 CH 10 DB Application Design n 10.1 Functions n 10.2 Case Application n 10.3 Creating, Reading, Updating, Deleting View n 10.4 Form Design n 10.5 Report Design n 10.6 Enforcing Constraints n 10.7 Security and Control

2 Ch - 10 Application Design page DB Application Design n Introduce fundamental concepts in database application design n Between DBMS and Application –In the early days it was easy to find a line between them –Today the line between them has become blurred

3 Ch - 10 Application Design page Functions of a database application

4 Ch - 10 Application Design page n View: more than a row of a table and more than the result of a SQL statement –Often the construction of an application view requires two or more SQL statements n Difference: –Data Content(view) and appearance of that content(format) –A given view usually has many different formats n Enforcing constraint: 2 types of constraints –Structural: requiring data values to fit domain spec., ensuring uniqueness, or relationship cardinalities –Business Rule: “No salesman can sell to a customer whose billing address is outside of his region” n Security and Control: –Application work in conjunction with the OS and DBMS to augment security provided by user names and passwords

5 Ch - 10 Application Design page n Executing business logic: –e.g., In an order entry application: when a customer orders 5 copies of book, the application needs to reduce the quantity of that book on hand by 5. If insufficient copies are in inventory, or if the quantity on hand is less than the reorder quantity, other action needs to be taken.

6 Ch - 10 Application Design page Case Application: view ridge gallery View Ridge Gallery is a small art gallery that sells contemporary fine art, including lithographs, original paintings, and photographs, all of the lithographs and photos are signed and numbered, and most of the art is priced between $1,000 and $25,000. View Ridge Gallery has been in business for 27 years, has one full-time owner, three salespeople, and two workers who make frames, hang art in the gallery, and prepare art works for shipment. View Ridge holds openings and other gallery events to attract customers to the gallery. Art is also placed on display in local companies and restaurants and in other public places. View Ridge owns all of the art that it sells; it holds no item on a consignment basis.

7 Ch - 10 Application Design page n Summary of Requirements

8 Ch - 10 Application Design page n Database Design –Figure 10: View Ridge Gallery Database Design –View Ridge wants to be able to track its customers’ interests –CUSTOMER and ARTIST is in M:N relationship –WORK and TRANSACTION is weak entity relationship –Figure (c) shows table design –Figure (d) shows better table design(less data are duplicated) –Figure (e) shows relationship diagram

9 Ch - 10 Application Design page

10

11

12 n Creating, Reading, Updating, and Deleting View Ridge –A view is a structured list of data items from the entities or semantic objects defined in the data model –Figure 10-4 shows customer view(structured list of attributes and sample data) –A view is a structured list of attributes –Also a view is a list of data values only –View can be formatted or materialized in many different ways(as a form, as a report, or in some other type of materialization)

13 Ch - 10 Application Design page

14 Insert Into Table Value(.... ) Update Table Set attribute= value Where condition Delete Table Where condition

15 Ch - 10 Application Design page n The second major function of a DB application is to generate materializations of views n Form is a screen display used for data entry and edit –Read only form(user) –Data entry and edit form(developer) n Discuss several principles of good form design Form Design

16 Ch - 10 Application Design page 1. Form structure should reflect the view structure 2. The semantics of the data should be graphically evident 3. The form structure should encourage appropriate action 4. Forms in a GUI environment –Drop-down list box –Option buttons and groups –Check boxes 5. Cursor movement and pervasive keys –Cursor follows the end user’s processing pattern as he or she reads the source data entry documents –The actions of special purpose keys such as ESC and function keys should be consistent and pervasive

17 Ch - 10 Application Design page

18

19 n The principles of effective report design are similar to those for form design(just as with forms, the structure of a report should reflect the structure of the underlying view) n Figure 10-12 n It is difficult to construct a report that follows more than one multi-value path through the DB schema Report Design

20 Ch - 10 Application Design page

21 n DBMS is often the better place to enforce constraints(it is a central point through which all data changes must pass) n When possible, enforce constraints at the DBMS; if not, enforce them in application n Four types of constraint: –Domain, uniqueness, relationship cardinality, business rules Enforcing Constraints

22 Ch - 10 Application Design page n Domain constraint –E.g., copy attribute(format: nn/mm, nn<=mm) –Need to develop validation code to ensure format Purchase date <= now() Minimum cardinality is mandatory: required field set to yes(attribute must have a value)

23 Ch - 10 Application Design page

24

25

26

27 n Uniqueness constraint –Figure 10-16: Indexed set to yes(no duplicates) –Ensure that no duplicated artist names are entered from any source

28 Ch - 10 Application Design page n Relationship cardinality constraints

29 Ch - 10 Application Design page n Relationship cardinality constraints

30 Ch - 10 Application Design page –Enforce referential integrity(check box in relationship) To insert a record in child table related record must exist in parent table –Cascade update related records(check box in relationship) –Cascade delete related records(check box in relationship) Effect in parent side record deletion not child side

31 Ch - 10 Application Design page n Business rule constraint –Because business rules are application dependent, there are no generic features of DBMS products for enforcing them –DBMS products provide means for inserting code before or after most important events(e.g., MS access form design) –Figure 10-21 –With server DBMS products such as ORACLE or SQL server, a similar means is used(logic can be enforced in triggers, which are program segments that are invoked when events occurs in the database)

32 Ch - 10 Application Design page

33 n Security –Most DBMS products provide user name and password level of security(does not help in limiting the instances of data that users can view) –Horizontal security: would limit access to certain rows, but all columns could be seen –Vertical security: would limit access to certain columns, but all rows could be seen –Applications that limit users to certain forms, reports, tables, or columns provide vertical security –Those that limit users to certain data in forms, reports, tables, or columns provide horizontal security –User name and password can be readily used to provide vertical security –Horizontal security generally requires developers to write application code Security and Control

34 Ch - 10 Application Design page n Control –Most database application provide control via menus –Figure10-22 –In multi-user processing, one user’s actions do not have inappropriate side consequences on a second user’s actions –Transaction control: identify boundaries of work that must be completed as a unit(called transaction boundaries) –E.g., a series of SQL for creating a view need to be completed as a unit, as a single transaction

35 Ch - 10 Application Design page


Download ppt "CH 10 DB Application Design n 10.1 Functions n 10.2 Case Application n 10.3 Creating, Reading, Updating, Deleting View n 10.4 Form Design n 10.5 Report."

Similar presentations


Ads by Google