Скачать презентацию ACET 2003 The Online Grade Book A Case Скачать презентацию ACET 2003 The Online Grade Book A Case

422f0294690e86694e9b14bfc8d5ce3c.ppt

  • Количество слайдов: 74

ACET 2003 The Online Grade Book A Case Study in Learning About Object-Oriented Database ACET 2003 The Online Grade Book A Case Study in Learning About Object-Oriented Database Technology Charles R. Moen, M. S. Morris M. Liaw, Ph. D. October 18, 2003

Why do we need OODB? 1. When creating an application with an object-oriented programming Why do we need OODB? 1. When creating an application with an object-oriented programming language… • Objects can be saved without translating them to another data structure • Vice versa, stored objects can be loaded without translation • Efficiency and speed! 2

Why do we need OODB? 2. When creating an application that uses complex data, Why do we need OODB? 2. When creating an application that uses complex data, e. g. , building a space shuttle, creating an electronic medical record system, storing bioinformatics sequence information, … • Complex data can be stored without • • complicated table schemas Data can be retrieved by pointer traversal, no need for time-consuming joins Efficiency, speed, and complexity! 3

Background Highlights § Object-oriented database • Persistent store of objects created with an OO Background Highlights § Object-oriented database • Persistent store of objects created with an OO programming language § Advantages • No need to convert objects to tables • Capable of storing entities with complex relationships • Faster—no need for joins § Some important points • No tables, no need for normalization • Capable of computing transitive closure • Relational databases are better for business apps 4

How do we teach OODB? CSCI 5433 Object-Oriented Database Systems • Prerequisites - CSCI How do we teach OODB? CSCI 5433 Object-Oriented Database Systems • Prerequisites - CSCI 3233 Object-Oriented Design and Programming (C++) - CSCI 5333 Database Management Systems (DB theory) • Learning Goals - Learn how to use OOAD for database development - Learn how to use OO technology to develop an OO database and a Web application that uses it as a backend • Tools - Object Modeling Technique (OMT) - Object. Store and MS Visual C++ • Project - The Online Grade Book 5

Resources 1. Textbook Object-Oriented Modeling and Design for Database Applications Michael Blaha & William Resources 1. Textbook Object-Oriented Modeling and Design for Database Applications Michael Blaha & William Premerlani Prentice-Hall, 1998 ISBN 0 -13 -123829 -9 6

Resources (Cont. ) 2. Software • Object. Store - OO database management software - Resources (Cont. ) 2. Software • Object. Store - OO database management software - Progress Software Corporation - http: //www. progress. com/ http: //www. objectstore. net/index. ssp - Educational license available • MS Visual C++ - Object. Store Wizards create C++ code - Writing the callbacks - Compiling the DLLs 7

Resources (Cont. ) 3. Object. Store Manuals • Extensive PDF documentation • The most Resources (Cont. ) 3. Object. Store Manuals • Extensive PDF documentation • The most important manuals - Rapid Database Development Object. Forms Publisher Tutorial Inspector Tutorial Object. Forms User Guide C++ API User Guide Building C++ Interface Applications 8

Resources (Cont. ) 4. Computer Lab • Dedicated room with seven PCs • PC Resources (Cont. ) 4. Computer Lab • Dedicated room with seven PCs • PC configuration - Windows 2000 - Object. Store - MS Visual C++ • Object. Store Mini Server 9

Teaching Technique § Lecture • Intro to OODB § Student presentations • Based on Teaching Technique § Lecture • Intro to OODB § Student presentations • Based on textbook and Object. Store manuals § Project assignment • Online Grade Book • Personal home page with links to the project § Exams • Midterm and final 10

Learning Goals 1. Learn how to use OOAD for database development • OMT Methodology Learning Goals 1. Learn how to use OOAD for database development • OMT Methodology 11

Learning Goal 1 – Learning How to Use OOAD OMT Methodology § Object Modeling Learning Goal 1 – Learning How to Use OOAD OMT Methodology § Object Modeling Technique (OMT) § Developed by James Rumbaugh § Consists of: • Concepts about object modeling • A process called the “OMT Process” • Modeling notation 12

Learning Goal 1 – Learning How to Use OOAD The OMT Process 1. Conceptualization Learning Goal 1 – Learning How to Use OOAD The OMT Process 1. Conceptualization 2. Analysis 3. System design 4. Detailed design 5. Implementation 6. Maintenance 13

Learning Goals 1. Learn how to use OOAD for database development • OMT Methodology Learning Goals 1. Learn how to use OOAD for database development • OMT Methodology 2. Learn how to use OO technology to develop an OO database and a Web application that uses it as a backend • Project assignment—“Online Grade Book” 14

Learning Goal 2 – Developing an OODB Project Assignment § Create an Online Grade Learning Goal 2 – Developing an OODB Project Assignment § Create an Online Grade Book • Web site where students can check grades • The teacher will record the grades in an OODB • Course grade calculated automatically, according to weight percentages assigned by the teacher § OMT Process • Conceptualization Report • Analysis Report • Project Report § Implementation • Object. Store and C++ • Final Demonstration 15

Learning Goal 2 – Developing an OODB OMT Process Steps 1. Conceptualization • Business Learning Goal 2 – Developing an OODB OMT Process Steps 1. Conceptualization • Business analysts or users conceive of an application and list requirements 16

Learning Goal 2 – Developing an OODB Step 1, Conceptualization § Why is the Learning Goal 2 – Developing an OODB Step 1, Conceptualization § Why is the Online Grade Book needed? • Students can get grades without contacting the teacher • Teacher will not have to contact each individual student § What problems will it solve? • Problem statement: Develop software for an online grade book using Object. Store. The following capabilities must be provided: - Provide an automated system to show students their grades - Allow the student to see his grades after entering his ID - Display all the grades for that student, including the midterm exam grade, the final exam grade, the presentation grade, the group project grade, the individual project grade, the course score, and the course letter grade. - Permit the teacher to change all the student data, including the name, password, and grades - Permit the teacher to change the grade weights for the grade components 17

Learning Goal 2 – Developing an OODB Step 1, Conceptualization § What problems will Learning Goal 2 – Developing an OODB Step 1, Conceptualization § What problems will it solve? (Cont. ) • Detailed software requirements: (examples) - The system shall have an ID for each user. - The ID shall be an integer assigned to each student in a class by the teacher. - The system shall provide a course ID for each user. - The course ID shall identify the specific course that the student is enrolled in, including the course number, section, semester, and year. - The system shall check the ID of the user when he wants to check his grades. - The system shall identify whether a user is a student or an administrator. § Where will it be used? • Environment—UHCL campus • System requirements § When is it needed? —The end of the semester 18

Learning Goal 2 – Developing an OODB Step 1, Conceptualization § Who is the Learning Goal 2 – Developing an OODB Step 1, Conceptualization § Who is the application for? • Actors § How will it work? • Scenarios and use cases Student View Grades Administrator Edit Student Data Edit Grade Weights 19

Learning Goal 2 – Developing an OODB Step 1, Conceptualization Report 1 WHO IS Learning Goal 2 – Developing an OODB Step 1, Conceptualization Report 1 WHO IS THE APPLICATION FOR? 1. 1 USERS 1. 1. 1 Student—Description, Responsibilities, Success Criteria 1. 1. 2 Administrator —Description, Responsibilities, Success Criteria 2 WHAT PROBLEMS WILL IT SOLVE? 2. 1 APPLICATION OVERVIEW 2. 2 PROBLEM STATEMENT 2. 3 DETAILED SOFTWARE REQUIREMENTS 3 WHERE WILL IT BE USED? 3. 1 ENVIRONMENT (e. g. , UHCL classrooms) 3. 2 SYSTEM REQUIREMENTS 3. 2. 1 Server Software (e. g. , MS IIS, Object. Store) 3. 2. 1 Client Software (e. g. , modern Web browser) 3. 2. 2 Development Software (e. g. , Object. Store, MS Visual C++, Notepad) 4 WHEN IS IT NEEDED? 4. 1 PROJECT DEADLINE 20

Learning Goal 2 – Developing an OODB Step 1, Conceptualization Report (Cont. ) 5 Learning Goal 2 – Developing an OODB Step 1, Conceptualization Report (Cont. ) 5 WHY IS IT NEEDED? 5. 1 CONTEXT (e. g. , class assignment) 5. 2 OBJECTIVES 6 HOW WILL IT WORK? 6. 1 SCENARIOS 6. 1. 1 Initial setup and addition of students by the Administrator 6. 1. 2 Adding the grades 6. 1. 3 Checking the grades 6. 2 USE CASES 6. 2. 1 Use case diagram 6. 2. 2 Use case descriptions 6. 2. 2. 1 View grades—preconditions, flow, post conditions 6. 2. 2. 2 Edit student data —preconditions, flow, post conditions 6. 2. 2. 3 Edit grade weights —preconditions, flow, post conditions 6. 3 INITIAL ARCHITECTURE 21

Learning Goal 2 – Developing an OODB OMT Process Steps 1. Conceptualization • Business Learning Goal 2 – Developing an OODB OMT Process Steps 1. Conceptualization • Business analysts or users conceive of an application and list requirements 2. Analysis • Real-world models are constructed • Specify what to do, not how to do it 22

Learning Goal 2 – Developing an OODB Step 2, Analysis § Attribute-based approach (not Learning Goal 2 – Developing an OODB Step 2, Analysis § Attribute-based approach (not OO) • Used with relational databases • List attributes in related groups • Check normal forms Course( course. ID, course. Name, teacher. Name, department. Name) Course( course. ID, course. Name, teacher. ID , department. ID ) Teacher( teacher. ID, teacher. Name ) Department( department. ID, department. Name ) 23

Learning Goal 2 – Developing an OODB Step 2, Analysis § Entity-based approach (OO Learning Goal 2 – Developing an OODB Step 2, Analysis § Entity-based approach (OO technique) • Real-world entities and relationships between them • Advantages: - Fewer entities than attributes - No need to check normal forms - Compatible with OO program code Teacher teacher. Name teaches Course course. ID course. Name taught in Department department. Name 24

Learning Goal 2 – Developing an OODB Step 2, Analysis OMT Methodology Models Functional Learning Goal 2 – Developing an OODB Step 2, Analysis OMT Methodology Models Functional Model (Defines operations of objects) Dynamic Model (State Diagram, but not used for databases) Object Model (Defines the structure, e. g. , classes) 25

Learning Goal 2 – Developing an OODB Step 2, Analysis Object Model § Start Learning Goal 2 – Developing an OODB Step 2, Analysis Object Model § Start with the problem statement • Develop software for an online grade book using Object. Store. The following capabilities must be provided: - Provide an automated system to show students their grades - Allow the student to see his grades after entering his ID - Display all the grades for that student, including the midterm exam grade, the final exam grade, the presentation grade, the group project grade, the individual project grade, the course score, and the course letter grade. - Permit the teacher to change all the student data, including the name, password, and grades - Permit the teacher to change the grade weights for the grade components 26

Learning Goal 2 – Developing an OODB Step 2, Analysis Object Model § Start Learning Goal 2 – Developing an OODB Step 2, Analysis Object Model § Start with the problem statement § Locate nouns to find the entities for classes • Develop software for an online grade book using Object. Store. The following capabilities must be provided: - Provide an automated system to show students their grades - Allow the student to see his grades after entering his ID - Display all the grades for that student, including the midterm exam grade, the final exam grade, the presentation grade, the group project grade, the individual project grade, the course score, and the course letter grade. - Permit the teacher to change all the student data, including the name, password, and grades - Permit the teacher to change the grade weights for the grade components 27

Learning Goal 2 – Developing an OODB Step 2, Analysis Object Model § Eliminate Learning Goal 2 – Developing an OODB Step 2, Analysis Object Model § Eliminate unnecessary classes that are: • Irrelevant: software, book, capabilities, system • Redundant: data, components • Used only as values (attributes): grades, score, ID, name, password • Develop software for an online grade book using Object. Store. The following capabilities must be provided: - Provide an automated system to show students their grades - Allow the student to see his grades after entering his ID - Display all the grades for that student, including the midterm exam grade, the final exam grade, the presentation grade, the group project grade, the individual project grade, the course score, and the course letter grade. - Permit the teacher to change all the student data, including the name, password, and grades - Permit the teacher to change the grade weights for the grade components 28

Learning Goal 2 – Developing an OODB Step 2, Analysis Object Model § Establish Learning Goal 2 – Developing an OODB Step 2, Analysis Object Model § Establish the model’s basic structure Student Teacher Weight 29

Learning Goal 2 – Developing an OODB Step 2, Analysis Object Model § List Learning Goal 2 – Developing an OODB Step 2, Analysis Object Model § List the attributes Student f. Name: char[50] m. Name: char[50] l. Name: char[50] midterm: float final: float presentation: float group. Project: float individual. Project: float course. Score: float course. Grade: char[10] Teacher Weight midterm. Weight: float final. Weight: float presentation. Weight: float group. Project. Weight: float individual. Project. Weight: float course. ID: char[10] 30

Learning Goal 2 – Developing an OODB Step 2, Analysis Object Model § Add Learning Goal 2 – Developing an OODB Step 2, Analysis Object Model § Add associations and refine the model Person user. ID: char[10] password: char[10] Student f. Name: char[50] m. Name: char[50] l. Name: char[50] midterm: float final: float presentation: float group. Project: float individual. Project: float course. Score: float course. Grade: char[10] weight. Table: os_Collection Teacher Weight midterm. Weight: float final. Weight: float presentation. Weight: float group. Project. Weight: float individual. Project. Weight: float course. ID: char[10] 31

Learning Goal 2 – Developing an OODB Step 2, Analysis Object Model Notation Class Learning Goal 2 – Developing an OODB Step 2, Analysis Object Model Notation Class Attributes Person user. ID: char[10] password: char[10] Inheritance Student f. Name: char[50] m. Name: char[50] l. Name: char[50] midterm: float final: float presentation: float group. Project: float individual. Project: float course. Score: float course. Grade: char[10] weight. Table: os_Collection Weight Teacher midterm. Weight: float final. Weight: float presentation. Weight: float group. Project. Weight: float individual. Project. Weight: float course. ID: char[50] Multiplicity Association 32

Learning Goal 2 – Developing an OODB Step 2, Analysis Functional Model § Start Learning Goal 2 – Developing an OODB Step 2, Analysis Functional Model § Start with the use cases 1. View grades 2. Edit student data (includes adding grades) 3. Edit grade weights § Straightforward object creation, deletion, or retrieval? attribute value update? — no need for pseudocode § Use case 2 requires pseudocode for the course grade, since it is calculated 33

Learning Goal 2 – Developing an OODB Step 2, Analysis Functional Model Use Case Learning Goal 2 – Developing an OODB Step 2, Analysis Functional Model Use Case 2: This is the pseudocode for setting the course score and the course grade for a student. They must be calculated, and the calculations are triggered when the administrator sets the student’s final exam score. Student: : set. Final ( final. Grade ) self. final : = final. Grade; self#set. Course. Score( ); return; Student: : set. Course. Score ( ) score : = 0; score += self. midterm * self. weight. Table. midterm. Weight; score += self. final * self. weight. Table. final. Weight; score += self. presentation * self. weight. Table. presentation. Weight; score += self. group. Project * self. weight. Table. group. Project. Weight; score += self. individual. Project * self. weight. Table. individual. Project. Weight; self. course. Score : = score; self#set. Course. Grade( ); return; 34

Learning Goal 2 – Developing an OODB Step 2, Analysis Functional Model (Use Case Learning Goal 2 – Developing an OODB Step 2, Analysis Functional Model (Use Case 2 cont. ) Student: : set. Course. Grade ( ) if self. course. Score >= 93 then self. course. Grade : = “A”; else if self. course. Score >= 90 then self. course. Grade : = “A-”; else if self. course. Score >= 87 then self. course. Grade : = “B+”; else if self. course. Score >= 83 then self. course. Grade : = “B”; else if self. course. Score >= 80 then self. course. Grade : = “B-”; else if self. course. Score >= 77 then self. course. Grade : = “C+”; else if self. course. Score >= 73 then self. course. Grade : = “C”; else if self. course. Score >= 70 then self. course. Grade : = “C-”; else self. course. Grade : = “F”; end if return; 35

Learning Goal 2 – Developing an OODB Step 2, Analysis Navigational Flow § All Learning Goal 2 – Developing an OODB Step 2, Analysis Navigational Flow § All pages in the Web site § Block diagram—each page is a rectangle with a descriptive name § All links between the pages drawn as directional lines § Initial design of each page usually developed at the same time 36

Learning Goal 2 – Developing an OODB Step 2, Analysis Navigational Flow Enter Student Learning Goal 2 – Developing an OODB Step 2, Analysis Navigational Flow Enter Student ID Administrator Log In Admin Log In OK N OK Found? Admin? Y N Y Student Grade Report Logout Admin Grade Report Delete Change Admin Change Dialog Add A New Student Admin Add Student Dialog OK or Cancel Edit Grade Weights Admin Grade Weight Dialog 37

Learning Goal 2 – Developing an OODB Step 2, Analysis Web Page Layouts 38 Learning Goal 2 – Developing an OODB Step 2, Analysis Web Page Layouts 38

Learning Goal 2 – Developing an OODB Step 2, Analysis Report 1 NAVIGATIONAL FLOW Learning Goal 2 – Developing an OODB Step 2, Analysis Report 1 NAVIGATIONAL FLOW BETWEEN WEB PAGES 2 WEB I/O COMPONENTS A list of the forms, buttons, and links for each Web page 3 WEB PAGE LAYOUTS The design of each Web page in the navigational flow chart 4 ANALYSIS OBJECT MODEL 5 ANALYSIS FUNCTIONAL MODEL 5. 1 USE CASES (a list of the use cases) 5. 2 PSEUDOCODE 6 DATA DICTIONARY 39

Learning Goal 2 – Developing an OODB OMT Process Steps 1. Conceptualization • Business Learning Goal 2 – Developing an OODB OMT Process Steps 1. Conceptualization • Business analysts or users conceive of an application and list requirements 2. Analysis • Real-world models are constructed • Specify what to do, not how to do it 3. System Design • Develop the high-level architecture 40

Learning Goal 2 – Developing an OODB Step 3, System Design : oodb server Learning Goal 2 – Developing an OODB Step 3, System Design : oodb server : personal computer Client Browser HTTP Web Server Object. Store Application Packages Created by the developer Template Files *. OFT (e. g. , the Web. Connect CGI program and the Template Processor) Callback Functions *. DLL Persistent Objects *. DB 41

Learning Goal 2 – Developing an OODB OMT Process Steps (Cont. ) 4. Detailed Learning Goal 2 – Developing an OODB OMT Process Steps (Cont. ) 4. Detailed Design • Adjustments to simplify implementation and improve execution 42

Learning Goal 2 – Developing an OODB Step 4, Detailed Design § Simplify the Learning Goal 2 – Developing an OODB Step 4, Detailed Design § Simplify the object model Person user. ID: char[10] password: char[10] Person Student Teacher f. Name: char[50] m. Name: char[50] l. Name: char[50] midterm: float final: float presentation: float group. Project: float individual. Project: float course. Score: float course. Grade: char[10] weight. Table: os_Collection Weight course. ID: char[10] midterm. Weight: float final. Weight: float presentation. Weight: float group. Project. Weight: float individual. Project. Weight: float Analysis Object Model user. ID: char[50] password: char[50] f. Name: char[50] m. Name: char[50] l. Name: char[50] midterm: char[50] final: char[50] presentation: char[50] group. Project: char[50] individual. Project: char[50] course. Score: char[50] course. Grade: char[10] course. ID: char[50] admin: char[10] Weight midterm. Weight: char[50] final. Weight: char[50] presentation. Weight: char[50] group. Project. Weight: char[50] individual. Project. Weight: char[50] course. ID: char[50] Detailed Design Object Model 43

Learning Goal 2 – Developing an OODB Step 4, Detailed Design Database Designer § Learning Goal 2 – Developing an OODB Step 4, Detailed Design Database Designer § GUI-based Object. Store program § Used to draw the “Detailed Design” object model § Saves the database schema in a *. dbs file 44

Learning Goal 2 – Developing an OODB Step 4, Detailed Design Database Designer § Learning Goal 2 – Developing an OODB Step 4, Detailed Design Database Designer § Create the classes and save as gradebook. dbs 45

Learning Goal 2 – Developing an OODB Step 4, Detailed Design Database Designer § Learning Goal 2 – Developing an OODB Step 4, Detailed Design Database Designer § Create the classes and save as gradebook. dbs 46

Learning Goal 2 – Developing an OODB Step 4, Detailed Design Database Designer § Learning Goal 2 – Developing an OODB Step 4, Detailed Design Database Designer § Create the classes and save as gradebook. dbs 47

Learning Goal 2 – Developing an OODB OMT Process Steps (Cont. ) 4. Detailed Learning Goal 2 – Developing an OODB OMT Process Steps (Cont. ) 4. Detailed Design • Adjustments to simplify implementation and improve execution 5. Implementation • Translate the design into code 48

Learning Goal 2 – Developing an OODB Step 5, Implementation § Object. Store tools Learning Goal 2 – Developing an OODB Step 5, Implementation § Object. Store tools for implementation • • Visual C++ Wizards (e. g. , Component Wizard) Inspector Publisher Mini Server § MS Visual C++ • Run the Object. Store Wizards • Write the methods from the functional model • Write the callback functions for adding, deleting, and editing items in the database 49

Learning Goal 2 – Developing an OODB Step 5, Implementation Component Wizard § Automatically Learning Goal 2 – Developing an OODB Step 5, Implementation Component Wizard § Automatically writes code for all classes created by Database Designer • Including “get” and “set” methods • Inserts “TODO” comments as placeholders for recommended modifications • Creates main( ), which can be modified to create and populate the OODB file § When these files are compiled the DLL is created 50

Learning Goal 2 – Developing an OODB Step 5, Implementation Component Wizard § Begin Learning Goal 2 – Developing an OODB Step 5, Implementation Component Wizard § Begin by starting MS Visual C++ § In the File menu, select New § In Projects, select “Object. Store Component Wizard” 51

Learning Goal 2 – Developing an OODB Step 5, Implementation Component Wizard § In Learning Goal 2 – Developing an OODB Step 5, Implementation Component Wizard § In the Wizard, open the gradebook. dbs created by § Database Designer Then skip to the third Wizard screen, and select “Console Application” 52

Learning Goal 2 – Developing an OODB Step 5, Implementation Component Wizard § After Learning Goal 2 – Developing an OODB Step 5, Implementation Component Wizard § After clicking “Finish, ” a complete Object. Store project will be created, including these files: • Weight. h, Weight. cpp, Person. h, and Person. cpp - Attributes - Constructors - “set” and “get” methods • • gradebook. def—DLL definition file gradebook. dsp—DLL project file gradebook. dsw—workspace file schema. scm—schema definition used by automatic processes § A Console project will also be created, including: • main. cpp —will create the database file when executed 53

Learning Goal 2 – Developing an OODB Step 5, Implementation Visual C++ § Write Learning Goal 2 – Developing an OODB Step 5, Implementation Visual C++ § Write the “special” methods • Any methods other than routine “set” and “get” methods • Methods that are specified in the functional model • Example: Setting the course grade Generated by the Wizard: void Student: : set_Course. Grade(char *value){ if(value) { int len = strlen(value); if(len < 10) strcpy(Course. Grade, value); else { strncpy(Course. Grade, value, 9); Course. Grade[9]=0; } } else Course. Grade[0]=0; } Added by the developer: void set_Course. Grade(double score) { if( score >= 93. 0 ) { strcpy(Course. Grade, "A"); } else if( score >= 90. 0 ){ strcpy(Course. Grade, "A-"); } /* … */ else { strcpy(Course. Grade, "F"); } }; 54

Learning Goal 2 – Developing an OODB Step 5, Implementation Visual C++ § Create Learning Goal 2 – Developing an OODB Step 5, Implementation Visual C++ § Create the DLL—Compile the Object. Store project § (gradebook) that has the Person and Weight classes Create the gradebook. db file to hold the database • In the Console project (gradebook_console), modify main. cpp //os_database * db = os_database: : open("", 0, 0666); //db->close( ); os_database * db = os_database: : open(“gradebook. db", 0, 0666); db->close( ); • Compile and execute the Console project 55

Learning Goal 2 – Developing an OODB Step 5, Implementation Visual C++ § If Learning Goal 2 – Developing an OODB Step 5, Implementation Visual C++ § If desired, additional code can be added to main. cpp to populate the gradebook. db file with some objects OS_BEGIN_TXN (tx_transaction_number_0, 0, os_transaction: : update) os_database_root *Weight. Root = db->find_root("Weight_root"); if(!Weight. Root) { Weight. Root = db->create_root("Weight_root"); } os_collection* Weight. Coll = (os_collection*)Weight. Root->get_value(); if(!Weight. Coll) { Weight. Coll = &os_collection: : create(db); Weight. Root->set_value(Weight. Coll); } Weight *a. New. Weight = new(db, Weight_type) Weight(25, 15, 20, "2002 fa 5433"); Weight. Coll->insert(a. New. Weight); OS_END_TXN(tx_transaction_number_0) § Recompile and execute the Console project 56

Learning Goal 2 – Developing an OODB Step 5, Implementation Visual C++ § To Learning Goal 2 – Developing an OODB Step 5, Implementation Visual C++ § To update the database content dynamically within the Web application • The developer must write the C++ code that will make updates • Callback functions - add. Item. cpp - delete. Item. cpp - edit. Item. cpp • Added to the DLL when compiled • “Object. Forms App. Wizard” generates a skeleton C++ source file that can be modified 57

Learning Goal 2 – Developing an OODB Step 5, Implementation Visual C++ Callbacks § Learning Goal 2 – Developing an OODB Step 5, Implementation Visual C++ Callbacks § In the File menu, select New § In Projects, select “Object. Forms App. Wizard” 58

Learning Goal 2 – Developing an OODB Step 5, Implementation Visual C++ Callbacks § Learning Goal 2 – Developing an OODB Step 5, Implementation Visual C++ Callbacks § Select “Publisher callback DLL” § Enter “ 3” because we need three callback functions (for § adding, deleting, and editing) Use meaningful names (e. g. , add. Item, delete. Item) 59

Learning Goal 2 – Developing an OODB Step 5, Implementation Visual C++ Callbacks § Learning Goal 2 – Developing an OODB Step 5, Implementation Visual C++ Callbacks § Edit the skeleton callbacks in Visual C++ os_database* the. DB = Sync. Open. Write. DB(db. Name, b_was. Open. MVCC); b. Error = (the. DB == NULL); if(!b. Error) { TIX_HANDLE(err_objectstore) { OS_BEGIN_TXN(Add. Item_txn, 0, os_transaction: : update) { /************************* * TODO: Add transaction code *************************/ } OS_END_TXN(Add. Item_txn); } TIX_EXCEPTION { b. Error=TRUE; /*************************** * TODO: Add exception handling code ***************************/ } TIX_END_HANDLE; } Sync. Close. Write. DB(the. DB, b_was. Open. MVCC); 60

Learning Goal 2 – Developing an OODB Step 5, Implementation Visual C++ Callbacks // Learning Goal 2 – Developing an OODB Step 5, Implementation Visual C++ Callbacks // TODO: Add transaction code //Get the person root and the person collection os_database_root *Person. Root = the. DB->find_root("Person_root"); if(! Person. Root) { b. Error = TRUE; sprintf(error. Str, "

Error looking for root.

"); } else { os_collection* Person. Coll = (os_collection*) Person. Root->get_value(); if( ! Person. Coll ) { b. Error = TRUE; sprintf(error. Str, "

Error looking for root value.

"); } else { //Create a new student from the data Person *new. Person = new(the. DB, &Person_type) Person(courseid, studentid, lname, fname, mname, admin, coursegrade, midterm, final, presentation, groupproject, individualproject, coursescore, midtermaverage, finalaverage, presenterid, atoi(baddtoroot)); //Insert the new person into the collection Person. Coll->insert(new. Person); } } 61

Learning Goal 2 – Developing an OODB Step 5, Implementation OFT Templates § Create Learning Goal 2 – Developing an OODB Step 5, Implementation OFT Templates § Create the Web pages § HTML with special Object. Forms tags • Server-side code that generates HTML • Used to publish OODB data on a Web page § Created by Object. Forms Publisher § OFT files can be modified • Any text editor • Add formatting to change the page appearance • Refine the code by adding Object. Forms tags 62

Learning Goal 2 – Developing an OODB Step 5, Implementation Publisher § Uses gradebook. Learning Goal 2 – Developing an OODB Step 5, Implementation Publisher § Uses gradebook. db to publish data on the Web page § Creates the *. oft template files in the Publish Wizard 63

Learning Goal 2 – Developing an OODB Step 5, Implementation OFT Templates <%include Learning Goal 2 – Developing an OODB Step 5, Implementation OFT Templates <%include "HeadersGrade. Book. Header. html"%> <%osdatabase=“C: gradebook_consolegradebook. db"%> <%QUERY NAME="query 1" OSFUNCTION="osiquery"%> <%if query 1. Status EQ 0%>

<%BEGINDETAIL NAME="query 1"%> <%ENDDETAIL%>
<%Course. ID%> <%Mid. Term. Weight%> % <%Final. Weight%> % <%Presentation. Weight%> % <%Group. Project. Weight%> % <%Individual. Project. Weight%> %
<%else%> <%query 1. Error. Msg%>

<%endif%> 64

Learning Goal 2 – Developing an OODB Step 5, Implementation OFT Templates 65 Learning Goal 2 – Developing an OODB Step 5, Implementation OFT Templates 65

Learning Goal 2 – Developing an OODB Step 5, Implementation Local Testing § Publisher Learning Goal 2 – Developing an OODB Step 5, Implementation Local Testing § Publisher Runtime Service • An Object. Forms service that provides the callback functions • Set the configuration by adding gradebook. DLL • Start the service—runs in a separate console window § Start the Mini. Server • An Object. Store HTTP server • Listens on port 8484 by default § Start your browser, and enter the URL for the opening page of the Online Grade Book • http: //129. 7. 166. 73: 8484/Grades_submit. html 66

Learning Goal 2 – Developing an OODB Step 5, Implementation Steps 1. Implement the Learning Goal 2 – Developing an OODB Step 5, Implementation Steps 1. Implement the classes drawn with Database Designer When compiled, and create the database. creates gradebook Project Object. Store Creates To create and Component Wizard gradebook_console populate initially Project 2. Create the callback functions. Object. Forms App. Wizard Creates Skeleton callback functions When compiled, creates Modify and compile MS Visual C++ 3. Create the Web pages. Object. Forms Publisher Creates Queries and initial *. OFT templates Modifications added Modify gradebook. DLL The classes gradebook. db The OO database Callback functions in DLL To add, delete, or edit the data Formatted *. OFT templates The Web pages Text editor 4. Test with the Mini. Server, then make any necessary revisions. 67

Learning Goal 2 – Developing an OODB Step 5, Implementation Completed Project § The Learning Goal 2 – Developing an OODB Step 5, Implementation Completed Project § The student ID is used to retrieve the grades § HTML response displays the grades if the student ID is valid, else an error message says to try again Grades_submit. html Grades_submit. oft 68

Learning Goal 2 – Developing an OODB Step 5, Implementation Completed Project § By Learning Goal 2 – Developing an OODB Step 5, Implementation Completed Project § By clicking on “Administrator Login, ” the teacher can go the admin login page § The grades of all students are displayed to the teacher Grades_admin. html Grades. oft 69

Learning Goal 2 – Developing an OODB Step 5, Implementation Completed Project § Clicking Learning Goal 2 – Developing an OODB Step 5, Implementation Completed Project § Clicking on “Add A New Student” lets the teacher enter § student data, which is added after clicking “Add” Clicking on “Edit” lets the teacher change student data Grades_edit_user. oft Edit Grades_edit_commit_user. oft Grades_add_user. oft Add Grades_add_commit_user. oft 70

Learning Goal 2 – Developing an OODB Step 5, Implementation Completed Project § By Learning Goal 2 – Developing an OODB Step 5, Implementation Completed Project § By clicking on “View Grade Weights, ” the teacher can view the weight for calculating the course score § By clicking on “Edit Grade Weights, ” the weights can be changed Weights. oft Weights_edit_user. oft Edit Weights_edit_commit. oft 71

Learning Goal 2 – Developing an OODB Step 5, Implementation Project Report 1 SPECIAL Learning Goal 2 – Developing an OODB Step 5, Implementation Project Report 1 SPECIAL FEATURES A list of any unique features 2 LESSONS LEARNED Problems and solutions 3 USER NAMES AND PASSWORDS FOR TESTING 4 USER GUIDE 5 FLOW CHART The final design of the navigational flow chart 6 CODE FOR TEMPLATES AND C++ CALLBACK FUNCTIONS 7 STEPS FOR DEVELOPING AND DEPLOYING 8 DIARY 72

Conclusion § Students were able to learn OO analysis and design with real-world tools Conclusion § Students were able to learn OO analysis and design with real-world tools § Students were also able to implement an OO database and use it with a Web application that they developed 73

Thank You Any questions? 74 Thank You Any questions? 74