the online grade book
DESCRIPTION
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?. When creating an application with an object-oriented programming language… - PowerPoint PPT PresentationTRANSCRIPT
The Online Grade BookThe Online Grade Book
Charles R. Moen, M.S.Morris M. Liaw, Ph.D.
October 18, 2003
A Case Study in Learning About Object-Oriented Database TechnologyA Case Study in Learning About Object-Oriented Database Technology
ACET 2003ACET 2003
2
Why do we need OODB?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!
3
Why do we need OODB?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!
4
Background HighlightsBackground 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
5
How do we teach OODB?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)- ObjectStore and MS Visual C++
• Project- The Online Grade Book
6
ResourcesResources
1.TextbookObject-Oriented Modeling and Design
for Database ApplicationsMichael Blaha & William PremerlaniPrentice-Hall, 1998
ISBN 0-13-123829-9
7
Resources (Cont.)Resources (Cont.)
2.Software• ObjectStore
- OO database management software- Progress Software Corporation
- http://www.progress.com/- http://www.objectstore.net/index.ssp
- Educational license available
• MS Visual C++- ObjectStore Wizards create C++ code- Writing the callbacks- Compiling the DLLs
8
Resources (Cont.)Resources (Cont.)
3.ObjectStore Manuals• Extensive PDF documentation
• The most important manuals- Rapid Database Development
- ObjectForms Publisher Tutorial
- Inspector Tutorial
- ObjectForms User Guide
- C++ API User Guide
- Building C++ Interface Applications
9
Resources (Cont.)Resources (Cont.)
4. Computer Lab• Dedicated room with seven PCs
• PC configuration
- Windows 2000
- ObjectStore
- MS Visual C++
• ObjectStore Mini Server
10
Teaching TechniqueTeaching Technique
Lecture• Intro to OODB
Student presentations• Based on textbook and ObjectStore manuals
Project assignment• Online Grade Book• Personal home page with links to the project
Exams• Midterm and final
11
Learning GoalsLearning Goals
1. Learn how to use OOAD for database development
• OMT Methodology
12
OMT MethodologyOMT Methodology
Object Modeling Technique (OMT)
Developed by James Rumbaugh
Consists of:• Concepts about object modeling• A process called the “OMT Process”• Modeling notation
Learning Goal 1 – Learning How to Use OOADLearning Goal 1 – Learning How to Use OOADLearning Goal 1 – Learning How to Use OOADLearning Goal 1 – Learning How to Use OOAD
13
The OMT ProcessThe OMT Process
1. Conceptualization
2. Analysis
3. System design
4. Detailed design
5. Implementation
6. Maintenance
Learning Goal 1 – Learning How to Use OOADLearning Goal 1 – Learning How to Use OOADLearning Goal 1 – Learning How to Use OOADLearning Goal 1 – Learning How to Use OOAD
14
Learning GoalsLearning 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”
15
Learning Goal 2 – Developing an OODBLearning Goal 2 – Developing an OODBLearning Goal 2 – Developing an OODBLearning Goal 2 – Developing an OODB
Project AssignmentProject 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• ObjectStore and C++• Final Demonstration
16
Learning Goal 2 – Developing an OODBLearning Goal 2 – Developing an OODBLearning Goal 2 – Developing an OODBLearning Goal 2 – Developing an OODB
OMT Process StepsOMT Process Steps
1. Conceptualization• Business analysts or users conceive of
an application and list requirements
17
Learning Goal 2 – Developing an OODBLearning Goal 2 – Developing an OODBLearning Goal 2 – Developing an OODBLearning Goal 2 – Developing an OODB
Step 1, ConceptualizationStep 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 ObjectStore. 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
18
Step 1, ConceptualizationStep 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
Learning Goal 2 – Developing an OODBLearning Goal 2 – Developing an OODBLearning Goal 2 – Developing an OODBLearning Goal 2 – Developing an OODB
19
Learning Goal 2 – Developing an OODBLearning Goal 2 – Developing an OODBLearning Goal 2 – Developing an OODBLearning Goal 2 – Developing an OODB
Step 1, ConceptualizationStep 1, Conceptualization
Who is the application for?• Actors
AdministratorStudent
Edit Grade Weights
View Grades
Edit Student Data
How will it work?• Scenarios and use cases
20
Learning Goal 2 – Developing an OODBLearning Goal 2 – Developing an OODBLearning Goal 2 – Developing an OODBLearning Goal 2 – Developing an OODB
Step 1, ConceptualizationStep 1, Conceptualization
1 WHO IS THE APPLICATION FOR?1.1 USERS
1.1.1 Student—Description, Responsibilities, Success Criteria1.1.2 Administrator —Description, Responsibilities, Success Criteria
2 WHAT PROBLEMS WILL IT SOLVE?2.1 APPLICATION OVERVIEW2.2 PROBLEM STATEMENT2.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, ObjectStore)3.2.1 Client Software (e.g., modern Web browser)3.2.2 Development Software (e.g., ObjectStore, MS Visual C++, Notepad)
4 WHEN IS IT NEEDED?4.1 PROJECT DEADLINE
Conceptualization Report
21
Learning Goal 2 – Developing an OODBLearning Goal 2 – Developing an OODBLearning Goal 2 – Developing an OODBLearning Goal 2 – Developing an OODB
Step 1, ConceptualizationStep 1, Conceptualization
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 Administrator6.1.2 Adding the grades6.1.3 Checking the grades
6.2 USE CASES6.2.1 Use case diagram6.2.2 Use case descriptions
6.2.2.1 View grades—preconditions, flow, post conditions6.2.2.2 Edit student data —preconditions, flow, post conditions6.2.2.3 Edit grade weights —preconditions, flow, post conditions
6.3 INITIAL ARCHITECTURE
Conceptualization Report (Cont.)
22
Learning Goal 2 – Developing an OODBLearning Goal 2 – Developing an OODBLearning Goal 2 – Developing an OODBLearning Goal 2 – Developing an OODB
OMT Process StepsOMT 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
23
Learning Goal 2 – Developing an OODBLearning Goal 2 – Developing an OODBLearning Goal 2 – Developing an OODBLearning Goal 2 – Developing an OODB
Step 2, AnalysisStep 2, Analysis
Attribute-based approach (not OO)• Used with relational databases• List attributes in related groups• Check normal forms
Course( courseID, courseName, teacherName, departmentName)
Course( courseID, courseName, teacherID , departmentID )
Teacher( teacherID, teacherName )
Department( departmentID, departmentName )
24
Learning Goal 2 – Developing an OODBLearning Goal 2 – Developing an OODBLearning Goal 2 – Developing an OODBLearning Goal 2 – Developing an OODB
Step 2, AnalysisStep 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
Course
courseIDcourseName
Teacher
teacherName
Department
departmentNameteaches taught in
25
Learning Goal 2 – Developing an OODBLearning Goal 2 – Developing an OODBLearning Goal 2 – Developing an OODBLearning Goal 2 – Developing an OODB
Step 2, AnalysisStep 2, Analysis
Object Model(Defines
the structure,e.g., classes)Dynamic Model
(State Diagram,but not used for databases)
Functional Model(Defines operations of objects)
OMT Methodology Models
26
Step 2, AnalysisStep 2, AnalysisStep 2, AnalysisStep 2, AnalysisLearning Goal 2 – Developing an OODBLearning Goal 2 – Developing an OODBLearning Goal 2 – Developing an OODBLearning Goal 2 – Developing an OODB
• Develop software for an online grade book using ObjectStore. 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
Object ModelObject Model
Start with the problem statement
27
Step 2, AnalysisStep 2, AnalysisStep 2, AnalysisStep 2, AnalysisLearning Goal 2 – Developing an OODBLearning Goal 2 – Developing an OODBLearning Goal 2 – Developing an OODBLearning Goal 2 – Developing an OODB
• Develop software for an online grade book using ObjectStore. 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
Object ModelObject Model
Start with the problem statement Locate nouns to find the entities for classes
28
Step 2, AnalysisStep 2, AnalysisStep 2, AnalysisStep 2, AnalysisLearning Goal 2 – Developing an OODBLearning Goal 2 – Developing an OODBLearning Goal 2 – Developing an OODBLearning Goal 2 – Developing an OODB
• Develop software for an online grade book using ObjectStore. 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
Object ModelObject Model Eliminate unnecessary classes that are:• Irrelevant: software, book, capabilities, system• Redundant: data, components• Used only as values (attributes): grades, score, ID, name, password
29
Step 2, AnalysisStep 2, AnalysisStep 2, AnalysisStep 2, AnalysisLearning Goal 2 – Developing an OODBLearning Goal 2 – Developing an OODBLearning Goal 2 – Developing an OODBLearning Goal 2 – Developing an OODB
Teacher
Object ModelObject Model
WeightStudent
Establish the model’s basic structure
30
Step 2, AnalysisStep 2, AnalysisStep 2, AnalysisStep 2, AnalysisLearning Goal 2 – Developing an OODBLearning Goal 2 – Developing an OODBLearning Goal 2 – Developing an OODBLearning Goal 2 – Developing an OODB
Object ModelObject Model List the attributes
Weight
midtermWeight: floatfinalWeight: floatpresentationWeight: floatgroupProjectWeight: floatindividualProjectWeight: floatcourseID: char[10]
TeacherStudent
fName: char[50]mName: char[50]lName: char[50]midterm: floatfinal: floatpresentation: floatgroupProject: floatindividualProject: floatcourseScore: floatcourseGrade: char[10]
31
Step 2, AnalysisStep 2, AnalysisStep 2, AnalysisStep 2, AnalysisLearning Goal 2 – Developing an OODBLearning Goal 2 – Developing an OODBLearning Goal 2 – Developing an OODBLearning Goal 2 – Developing an OODB
Object ModelObject Model Add associations and refine the model
Weight
midtermWeight: floatfinalWeight: floatpresentationWeight: floatgroupProjectWeight: floatindividualProjectWeight: floatcourseID: char[10]
TeacherStudent
fName: char[50]mName: char[50]lName: char[50]midterm: floatfinal: floatpresentation: floatgroupProject: floatindividualProject: floatcourseScore: floatcourseGrade: char[10]weightTable: os_Collection<Weights *>
Person
userID: char[10] password: char[10]
32
Step 2, AnalysisStep 2, AnalysisStep 2, AnalysisStep 2, AnalysisLearning Goal 2 – Developing an OODBLearning Goal 2 – Developing an OODBLearning Goal 2 – Developing an OODBLearning Goal 2 – Developing an OODB
Object Model NotationObject Model NotationClass
Association
Multiplicity
Inheritance
Attributes
Weight
midtermWeight: floatfinalWeight: floatpresentationWeight: floatgroupProjectWeight: floatindividualProjectWeight: floatcourseID: char[50]
TeacherStudent
fName: char[50]mName: char[50]lName: char[50]midterm: floatfinal: floatpresentation: floatgroupProject: floatindividualProject: floatcourseScore: floatcourseGrade: char[10]weightTable: os_Collection<Weights *>
Person
userID: char[10] password: char[10]
33
Step 2, AnalysisStep 2, AnalysisStep 2, AnalysisStep 2, AnalysisLearning Goal 2 – Developing an OODBLearning Goal 2 – Developing an OODBLearning Goal 2 – Developing an OODBLearning Goal 2 – Developing an OODB
Functional ModelFunctional Model
Start with the use cases1. View grades2. 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
34
Step 2, AnalysisStep 2, AnalysisStep 2, AnalysisStep 2, AnalysisLearning Goal 2 – Developing an OODBLearning Goal 2 – Developing an OODBLearning Goal 2 – Developing an OODBLearning Goal 2 – Developing an OODB
Functional ModelFunctional ModelUse 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::setFinal ( finalGrade )self.final := finalGrade;self#setCourseScore( );return;
Student::setCourseScore ( )score := 0;score += self.midterm * self.weightTable.midtermWeight;score += self.final * self.weightTable.finalWeight;score += self.presentation * self.weightTable.presentationWeight;score += self.groupProject * self.weightTable.groupProjectWeight;score += self.individualProject * self.weightTable.individualProjectWeight;self.courseScore := score;self#setCourseGrade( );return;
35
Step 2, AnalysisStep 2, AnalysisStep 2, AnalysisStep 2, AnalysisLearning Goal 2 – Developing an OODBLearning Goal 2 – Developing an OODBLearning Goal 2 – Developing an OODBLearning Goal 2 – Developing an OODB
Functional ModelFunctional Model(Use Case 2 cont.)
Student::setCourseGrade ( )if self.courseScore >= 93 then self.courseGrade := “A”;else if self.courseScore >= 90 then self.courseGrade := “A-”;else if self.courseScore >= 87 then self.courseGrade := “B+”;else if self.courseScore >= 83 then self.courseGrade := “B”;else if self.courseScore >= 80 then self.courseGrade := “B-”;else if self.courseScore >= 77 then self.courseGrade := “C+”;else if self.courseScore >= 73 then self.courseGrade := “C”;else if self.courseScore >= 70 then self.courseGrade := “C-”;else self.courseGrade := “F”;end ifreturn;
36
Step 2, AnalysisStep 2, AnalysisStep 2, AnalysisStep 2, AnalysisLearning Goal 2 – Developing an OODBLearning Goal 2 – Developing an OODBLearning Goal 2 – Developing an OODBLearning Goal 2 – Developing an OODB
Navigational FlowNavigational 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
37
Step 2, AnalysisStep 2, AnalysisStep 2, AnalysisStep 2, AnalysisLearning Goal 2 – Developing an OODBLearning Goal 2 – Developing an OODBLearning Goal 2 – Developing an OODBLearning Goal 2 – Developing an OODB
Navigational FlowNavigational Flow
Change
AdminChange Dialog OK or Cancel
Logout
AdminAdd Student Dialog
AdminGrade Weight Dialog
Add A New Student Edit Grade Weights
Admin Log InAdministrator Log In
Admin?
OK
Y
N
AdminGrade Report
Delete
Enter Student ID
Found?
StudentGrade Report
OK
Y
N
38
Step 2, AnalysisStep 2, AnalysisStep 2, AnalysisStep 2, AnalysisLearning Goal 2 – Developing an OODBLearning Goal 2 – Developing an OODBLearning Goal 2 – Developing an OODBLearning Goal 2 – Developing an OODB
Web Page LayoutsWeb Page Layouts
39
Learning Goal 2 – Developing an OODBLearning Goal 2 – Developing an OODBLearning Goal 2 – Developing an OODBLearning Goal 2 – Developing an OODB
Step 2, AnalysisStep 2, Analysis
Analysis Report1 NAVIGATIONAL FLOW BETWEEN WEB PAGES
2 WEB I/O COMPONENTSA list of the forms, buttons, and links for each Web page
3 WEB PAGE LAYOUTSThe 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
40
Learning Goal 2 – Developing an OODBLearning Goal 2 – Developing an OODBLearning Goal 2 – Developing an OODBLearning Goal 2 – Developing an OODB
OMT Process StepsOMT 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
41
Learning Goal 2 – Developing an OODBLearning Goal 2 – Developing an OODBLearning Goal 2 – Developing an OODBLearning Goal 2 – Developing an OODB
Created bythe developer
Step 3, System DesignStep 3, System Design
HTTP
:oodb server:personal computer
ObjectStoreApplicationPackages
Web ServerClient
Browser
*.DLL
TemplateFiles
*.OFT *.DB
CallbackFunctions
(e.g., the WebConnect CGI programand the Template Processor)
PersistentObjects
42
Learning Goal 2 – Developing an OODBLearning Goal 2 – Developing an OODBLearning Goal 2 – Developing an OODBLearning Goal 2 – Developing an OODB
OMT Process Steps (Cont.)OMT Process Steps (Cont.)
4. Detailed Design• Adjustments to simplify implementation
and improve execution
43
Learning Goal 2 – Developing an OODBLearning Goal 2 – Developing an OODBLearning Goal 2 – Developing an OODBLearning Goal 2 – Developing an OODB
Step 4, Detailed DesignStep 4, Detailed Design
Simplify the object model
Weight
courseID: char[10]midtermWeight: floatfinalWeight: floatpresentationWeight: floatgroupProjectWeight: floatindividualProjectWeight: float
Teacher
Person
userID: char[10]password: char[10]
Student
fName: char[50]mName: char[50]lName: char[50]midterm: floatfinal: floatpresentation: floatgroupProject: floatindividualProject: floatcourseScore: floatcourseGrade: char[10]weightTable: os_Collection<Weights *>
Analysis Object Model Detailed Design Object Model
Weight
midtermWeight: char[50]finalWeight: char[50]presentationWeight: char[50]groupProjectWeight: char[50]individualProjectWeight: char[50]courseID: char[50]
Person
userID: char[50]password: char[50]fName: char[50]mName: char[50]lName: char[50]midterm: char[50]final: char[50]presentation: char[50]groupProject: char[50]individualProject: char[50]courseScore: char[50]courseGrade: char[10]courseID: char[50]admin: char[10]
44
Step 4, Detailed DesignStep 4, Detailed DesignStep 4, Detailed DesignStep 4, Detailed DesignLearning Goal 2 – Developing an OODBLearning Goal 2 – Developing an OODBLearning Goal 2 – Developing an OODBLearning Goal 2 – Developing an OODB
Database DesignerDatabase Designer GUI-based ObjectStore program Used to draw the “Detailed Design” object model Saves the database schema in a *.dbs file
45
Step 4, Detailed DesignStep 4, Detailed DesignStep 4, Detailed DesignStep 4, Detailed DesignLearning Goal 2 – Developing an OODBLearning Goal 2 – Developing an OODBLearning Goal 2 – Developing an OODBLearning Goal 2 – Developing an OODB
Database DesignerDatabase Designer Create the classes and save as gradebook.dbs
46
Step 4, Detailed DesignStep 4, Detailed DesignStep 4, Detailed DesignStep 4, Detailed DesignLearning Goal 2 – Developing an OODBLearning Goal 2 – Developing an OODBLearning Goal 2 – Developing an OODBLearning Goal 2 – Developing an OODB
Database DesignerDatabase Designer Create the classes and save as gradebook.dbs
47
Step 4, Detailed DesignStep 4, Detailed DesignStep 4, Detailed DesignStep 4, Detailed DesignLearning Goal 2 – Developing an OODBLearning Goal 2 – Developing an OODBLearning Goal 2 – Developing an OODBLearning Goal 2 – Developing an OODB
Database DesignerDatabase Designer Create the classes and save as gradebook.dbs
48
Learning Goal 2 – Developing an OODBLearning Goal 2 – Developing an OODBLearning Goal 2 – Developing an OODBLearning Goal 2 – Developing an OODB
OMT Process Steps (Cont.)OMT Process Steps (Cont.)
4. Detailed Design• Adjustments to simplify implementation
and improve execution
5. Implementation• Translate the design into code
49
Learning Goal 2 – Developing an OODBLearning Goal 2 – Developing an OODBLearning Goal 2 – Developing an OODBLearning Goal 2 – Developing an OODB
Step 5, ImplementationStep 5, Implementation
ObjectStore tools for implementation• Visual C++ Wizards (e.g., Component Wizard)• Inspector• Publisher• Mini Server
MS Visual C++• Run the ObjectStore Wizards• Write the methods from the functional model• Write the callback functions for adding,
deleting, and editing items in the database
50
Step 5, ImplementationStep 5, ImplementationStep 5, ImplementationStep 5, ImplementationLearning Goal 2 – Developing an OODBLearning Goal 2 – Developing an OODBLearning Goal 2 – Developing an OODBLearning Goal 2 – Developing an OODB
Component WizardComponent 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
51
Step 5, ImplementationStep 5, ImplementationStep 5, ImplementationStep 5, ImplementationLearning Goal 2 – Developing an OODBLearning Goal 2 – Developing an OODBLearning Goal 2 – Developing an OODBLearning Goal 2 – Developing an OODB
Component WizardComponent Wizard Begin by starting MS Visual C++ In the File menu, select New In Projects, select “ObjectStore Component Wizard”
52
Step 5, ImplementationStep 5, ImplementationStep 5, ImplementationStep 5, ImplementationLearning Goal 2 – Developing an OODBLearning Goal 2 – Developing an OODBLearning Goal 2 – Developing an OODBLearning Goal 2 – Developing an OODB
Component WizardComponent Wizard In the Wizard, open the gradebook.dbs created by
Database Designer Then skip to the third Wizard screen, and select
“Console Application”
53
Step 5, ImplementationStep 5, ImplementationStep 5, ImplementationStep 5, ImplementationLearning Goal 2 – Developing an OODBLearning Goal 2 – Developing an OODBLearning Goal 2 – Developing an OODBLearning Goal 2 – Developing an OODB
Component WizardComponent Wizard After clicking “Finish,” a complete ObjectStore 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
54
Step 5, ImplementationStep 5, ImplementationStep 5, ImplementationStep 5, ImplementationLearning Goal 2 – Developing an OODBLearning Goal 2 – Developing an OODBLearning Goal 2 – Developing an OODBLearning Goal 2 – Developing an OODB
Visual C++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
void Student::set_CourseGrade(char *value){if(value) {
int len = strlen(value);if(len < 10)
strcpy(CourseGrade, value);else {
strncpy(CourseGrade, value, 9);CourseGrade[9]=0;
}}else
CourseGrade[0]=0;}
Generated by the Wizard:void set_CourseGrade(double score) {
if( score >= 93.0 ) {strcpy(CourseGrade, "A");
}else if( score >= 90.0 ){
strcpy(CourseGrade, "A-");}
/* … */else {
strcpy(CourseGrade, "F");}
};
Added by the developer:
55
Step 5, ImplementationStep 5, ImplementationStep 5, ImplementationStep 5, ImplementationLearning Goal 2 – Developing an OODBLearning Goal 2 – Developing an OODBLearning Goal 2 – Developing an OODBLearning Goal 2 – Developing an OODB
Visual C++Visual C++ Create the DLL—Compile the ObjectStore 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
• Compile and execute the Console project
//os_database * db = os_database::open("", 0, 0666);//db->close( );
os_database * db = os_database::open(“gradebook.db", 0, 0666);db->close( );
56
Step 5, ImplementationStep 5, ImplementationStep 5, ImplementationStep 5, ImplementationLearning Goal 2 – Developing an OODBLearning Goal 2 – Developing an OODBLearning Goal 2 – Developing an OODBLearning Goal 2 – Developing an OODB
OS_BEGIN_TXN (tx_transaction_number_0, 0, os_transaction::update)
OS_END_TXN(tx_transaction_number_0)
Weight *aNewWeight = new(db,Weight_type) Weight(25, 25, 15, 15, 20, "2002fa5433");WeightColl->insert(aNewWeight);
os_collection* WeightColl = (os_collection*)WeightRoot->get_value();if(!WeightColl) {
WeightColl = &os_collection::create(db);WeightRoot->set_value(WeightColl);
}
os_database_root *WeightRoot = db->find_root("Weight_root");if(!WeightRoot) {
WeightRoot = db->create_root("Weight_root");}
Visual C++Visual C++ If desired, additional code can be added to main.cpp to
populate the gradebook.db file with some objects
Recompile and execute the Console project
57
Step 5, ImplementationStep 5, ImplementationStep 5, ImplementationStep 5, ImplementationLearning Goal 2 – Developing an OODBLearning Goal 2 – Developing an OODBLearning Goal 2 – Developing an OODBLearning Goal 2 – Developing an OODB
Visual C++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- addItem.cpp- deleteItem.cpp- editItem.cpp
• Added to the DLL when compiled
• “ObjectForms AppWizard” generates a skeleton C++ source file that can be modified
58
Step 5, ImplementationStep 5, ImplementationStep 5, ImplementationStep 5, ImplementationLearning Goal 2 – Developing an OODBLearning Goal 2 – Developing an OODBLearning Goal 2 – Developing an OODBLearning Goal 2 – Developing an OODB
Visual C++ CallbacksVisual C++ Callbacks In the File menu, select New In Projects, select “ObjectForms AppWizard”
59
Step 5, ImplementationStep 5, ImplementationStep 5, ImplementationStep 5, ImplementationLearning Goal 2 – Developing an OODBLearning Goal 2 – Developing an OODBLearning Goal 2 – Developing an OODBLearning Goal 2 – Developing an OODB
Visual C++ CallbacksVisual C++ Callbacks Select “Publisher callback DLL” Enter “3” because we need three callback functions (for
adding, deleting, and editing) Use meaningful names (e.g., addItem, deleteItem)
60
Step 5, ImplementationStep 5, ImplementationStep 5, ImplementationStep 5, ImplementationLearning Goal 2 – Developing an OODBLearning Goal 2 – Developing an OODBLearning Goal 2 – Developing an OODBLearning Goal 2 – Developing an OODB
Visual C++ CallbacksVisual C++ Callbacks Edit the skeleton callbacks in Visual C++
os_database* theDB = SyncOpenWriteDB(dbName, b_wasOpenMVCC);bError = (theDB == NULL);if(!bError) {
TIX_HANDLE(err_objectstore) {OS_BEGIN_TXN(AddItem_txn, 0, os_transaction::update) {
/************************************************** * TODO: Add transaction code *************************************************/}
OS_END_TXN(AddItem_txn);}
TIX_EXCEPTION {bError=TRUE;/****************************************************** * TODO: Add exception handling code *****************************************************/
} TIX_END_HANDLE;
}SyncCloseWriteDB(theDB, b_wasOpenMVCC);
61
Step 5, ImplementationStep 5, ImplementationStep 5, ImplementationStep 5, ImplementationLearning Goal 2 – Developing an OODBLearning Goal 2 – Developing an OODBLearning Goal 2 – Developing an OODBLearning Goal 2 – Developing an OODB
Visual C++ CallbacksVisual C++ Callbacks // TODO: Add transaction code
//Get the person root and the person collectionos_database_root *PersonRoot = theDB->find_root("Person_root");if(! PersonRoot) {
bError = TRUE;sprintf(errorStr,"<p>Error looking for root.</p>");
}else {
os_collection* PersonColl = (os_collection*) PersonRoot->get_value();if( ! PersonColl ) {
bError = TRUE;sprintf(errorStr,"<p>Error looking for root value.</p>");
}else {
//Create a new student from the dataPerson *newPerson =
new(theDB,&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 collectionPersonColl->insert(newPerson);
}}
62
Step 5, ImplementationStep 5, ImplementationStep 5, ImplementationStep 5, ImplementationLearning Goal 2 – Developing an OODBLearning Goal 2 – Developing an OODBLearning Goal 2 – Developing an OODBLearning Goal 2 – Developing an OODB
OFT TemplatesOFT Templates
Create the Web pages
HTML with special ObjectForms tags• Server-side code that generates HTML• Used to publish OODB data on a Web page
Created by ObjectForms Publisher
OFT files can be modified• Any text editor• Add formatting to change the page appearance• Refine the code by adding ObjectForms tags
63
Step 5, ImplementationStep 5, ImplementationStep 5, ImplementationStep 5, ImplementationLearning Goal 2 – Developing an OODBLearning Goal 2 – Developing an OODBLearning Goal 2 – Developing an OODBLearning Goal 2 – Developing an OODB
PublisherPublisher
Uses gradebook.db to publish data on the Web page
Creates the *.oft template files in the Publish Wizard
64
Step 5, ImplementationStep 5, ImplementationStep 5, ImplementationStep 5, ImplementationLearning Goal 2 – Developing an OODBLearning Goal 2 – Developing an OODBLearning Goal 2 – Developing an OODBLearning Goal 2 – Developing an OODB
OFT TemplatesOFT Templates
<%include "Headers\GradeBookHeader.html"%><%osdatabase=“C:\gradebook\gradebook_console\gradebook.db"%><%QUERY NAME="query1" OSFUNCTION="osiquery"%><%if query1.Status EQ 0%><TABLE BORDER=0 CELLPADDING=7 CELLSPACING=0 width="745"><!-- table title and headers go here --><%BEGINDETAIL NAME="query1"%>
<TR><TD ALIGN="left" BGCOLOR=#FFFFFF><%CourseID%></TD><TD ALIGN="center" BGCOLOR=#FFFFFF><%MidTermWeight%> %</TD><TD ALIGN="center" BGCOLOR=#FFFFFF><%FinalWeight%> %</TD><TD ALIGN="center" BGCOLOR=#FFFFFF><%PresentationWeight%> %</TD><TD ALIGN="center" BGCOLOR=#FFFFFF><%GroupProjectWeight%> %</TD><TD ALIGN="center" BGCOLOR=#FFFFFF><%IndividualProjectWeight%> %</TD></TR>
<%ENDDETAIL%></TABLE><%else%><%query1.ErrorMsg%><p><%endif%></body></html>
65
Step 5, ImplementationStep 5, ImplementationStep 5, ImplementationStep 5, ImplementationLearning Goal 2 – Developing an OODBLearning Goal 2 – Developing an OODBLearning Goal 2 – Developing an OODBLearning Goal 2 – Developing an OODB
OFT TemplatesOFT Templates
66
Step 5, ImplementationStep 5, ImplementationStep 5, ImplementationStep 5, ImplementationLearning Goal 2 – Developing an OODBLearning Goal 2 – Developing an OODBLearning Goal 2 – Developing an OODBLearning Goal 2 – Developing an OODB
Local TestingLocal Testing Publisher Runtime Service
• An ObjectForms service that provides the callback functions• Set the configuration by adding gradebook.DLL• Start the service—runs in a separate console window
Start the MiniServer• An ObjectStore 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
67
Step 5, ImplementationStep 5, ImplementationStep 5, ImplementationStep 5, ImplementationLearning Goal 2 – Developing an OODBLearning Goal 2 – Developing an OODBLearning Goal 2 – Developing an OODBLearning Goal 2 – Developing an OODB
Implementation StepsImplementation Steps
ObjectStoreComponent Wizard
ObjectStoreComponent Wizard
gradebook Projectgradebook Project
gradebook_consoleProject
gradebook_consoleProject gradebook.dbgradebook.db
gradebook.DLLgradebook.DLL
Creates
When compiled,creates
To create andpopulate initially
The OO database
The classes
1. Implement the classes drawn with Database Designer and create the database.
ObjectFormsAppWizard
ObjectFormsAppWizard
Skeletoncallback functions
Skeletoncallback functions
MS Visual C++MS Visual C++
Creates Callback functionsin DLL
Callback functionsin DLL
Modify and compile
When compiled,creates
To add, delete, oredit the data
2. Create the callback functions.
ObjectFormsPublisher
ObjectFormsPublisher
Queries and initial*.OFT templates
Queries and initial*.OFT templates
Formatted*.OFT templates
Formatted*.OFT templates
Text editorText editor
Modify
CreatesModifications
added
The Web pages
3. Create the Web pages.
4. Test with the MiniServer, then make any necessary revisions.
68
Step 5, ImplementationStep 5, ImplementationStep 5, ImplementationStep 5, ImplementationLearning Goal 2 – Developing an OODBLearning Goal 2 – Developing an OODBLearning Goal 2 – Developing an OODBLearning Goal 2 – Developing an OODB
Completed ProjectCompleted Project The student ID is used to retrieve the grades
Grades_submit.html
Grades_submit.oft
HTML response displays the grades if the student ID is valid, else an error message says to try again
69
Step 5, ImplementationStep 5, ImplementationStep 5, ImplementationStep 5, ImplementationLearning Goal 2 – Developing an OODBLearning Goal 2 – Developing an OODBLearning Goal 2 – Developing an OODBLearning Goal 2 – Developing an OODB
Completed ProjectCompleted Project By clicking on “Administrator Login,” the teacher can
go the admin login page
Grades_admin.html
The grades of all students are displayed to the teacher
Grades.oft
70
Step 5, ImplementationStep 5, ImplementationStep 5, ImplementationStep 5, ImplementationLearning Goal 2 – Developing an OODBLearning Goal 2 – Developing an OODBLearning Goal 2 – Developing an OODBLearning Goal 2 – Developing an OODB
Completed ProjectCompleted Project Clicking on “Add A New Student” lets the teacher enter
student data, which is added after clicking “Add”
Grades_add_user.oft Grades_add_commit_user.oftAdd
Clicking on “Edit” lets the teacher change student data
Grades_edit_user.oft
Grades_edit_commit_user.oftEdit
71
Step 5, ImplementationStep 5, ImplementationStep 5, ImplementationStep 5, ImplementationLearning Goal 2 – Developing an OODBLearning Goal 2 – Developing an OODBLearning Goal 2 – Developing an OODBLearning Goal 2 – Developing an OODB
Completed ProjectCompleted Project By clicking on “View Grade Weights,” the teacher can
view the weight for calculating the course score
Weights.oft
By clicking on “Edit Grade Weights,” the weights can be changed
Weights_edit_user.oft
Weights_edit_commit.oftEdit
72
Learning Goal 2 – Developing an OODBLearning Goal 2 – Developing an OODBLearning Goal 2 – Developing an OODBLearning Goal 2 – Developing an OODB
Step 5, ImplementationStep 5, Implementation
Project Report1 SPECIAL FEATURES
A list of any unique features
2 LESSONS LEARNEDProblems 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
73
ConclusionConclusion
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
74
Thank You Thank You
Any questions?