Visual FoxPro 6.0 Seminar - dFPUG

Download Report

Transcript Visual FoxPro 6.0 Seminar - dFPUG

Visual FoxPro 6.0
Seminar
Presented by
Jim Booth
Email: [email protected]
In cooperation with Rainer Becker and the
German FoxPro User’s Group (dFPUG)
Visual FoxPro™ Seminar
General Issues Related to
Development


Understanding the costs
Lowering the costs
The Value of Conventions and
Standards
 The Value of Object Oriented
Design
 The Development Cycle
 Managing Risks

Visual FoxPro™ Seminar
Database Design


Characteristics of a “Relational
Database Management System”
Normalization of Data Design
Visual FoxPro™ Seminar
Normalization
Visual FoxPro™ Seminar
Why bother with
Normalization




Reduce the possibility of data
inconsistencies
Reduce the space required for
storing data
Reduce possible update and
delete anomalies
Increase the stability of the data
design
Visual FoxPro™ Seminar
First Normal Form
Reduce entities to first
normal form (1NF) by
removing repeating or
multi-valued attributes
to another, child, entity.
Visual FoxPro™ Seminar
First Customer Pass
Customers
Customer #
Company Name
Address
Contact 1
Contact 2
Phone 1
Phone 2
Visual FoxPro™ Seminar
Removing the
Repeating Groups
Contacts
Customers
Customer #
Contact #
Customer #
Name
Address
Phone Code
Company Name
Address
Contact 1
Contact 2
Phone 1
Phone 2
Phones
Customer #
Phone Code
Area Code
Phone Number
Visual FoxPro™ Seminar
2nd Normal Form
Reduce 1NF entities to second
normal form (2NF) by removing
attributes that are not dependent
on the whole primary key.
Visual FoxPro™ Seminar
Invoice Line Item File
Invoice Number
Line Number
Customer ID
Product ID
Visual FoxPro™ Seminar
Remove the NonDependent Fields
Line Item
Customer ID
Invoice
Visual FoxPro™ Seminar
3rd Normal Form
Reduce 2NF entities to third normal form
(3NF) by removing attributes that depend
on other, non-key attributes (other than
alternate keys).
Visual FoxPro™ Seminar
Purchase Order
Order Number
Vendor ID
Vendor City
Visual FoxPro™ Seminar
Remove Fields
Depending on Non-key
attributes
Purchase Order
Vendor City
Vendor
Visual FoxPro™ Seminar
Boyce/Codd Normal
Form
Reduce 3NF entities to Boyce/Codd
normal form (BCNF) by ensuring that they
are in 3NF for any feasible choice of
candidate key as primary key.
Visual FoxPro™ Seminar
An Employee Table
EmpId
Employee Number
Clock Number
Visual FoxPro™ Seminar
An Employee Table
Clock Number
Employee Number
EmpId
Visual FoxPro™ Seminar
An Employee Table
Employee Number
Clock Number
EmpId
Visual FoxPro™ Seminar
Fourth Normal Form
Reduce BCNF entities to Fourth normal
form (4NF) by removing any
independently multi-valued components
of the primary key to two new parent
entities.
Visual FoxPro™ Seminar
Employee - Skill - Objective
Table
Name
Skill - Name
Objective - Text
Jones
Jones
accounting
accounting
more money
prestige
Jones
public speaking
more money
Jones
public speaking
prestige
Visual FoxPro™ Seminar
Fourth Normal Form
Employee - Skill
Name
Skill - Name
Employee - Objective
Name
Objective - Text
Visual FoxPro™ Seminar
Fifth Normal Form
Reduce 4NF entities to fifth normal form
(5NF) by removing pair-wise cyclic
dependencies (appearing within composite
primary keys with three or more component
attributes) to three or more new parent
entities.
Visual FoxPro™ Seminar
Retail Store Buyers
Buying
Buyer
Vendor
Product
Mary
Mary
Sally
Mary
Sally
Suppose Liz Claiborne adds jeans to
their list of products. We need to add
two updates to our table because both
Mary and Sally buy jeans and buy from
Liz Claiborne.
Jordache
Jordache
Jordache
Liz Claiborne
Liz Claiborne
Visual FoxPro™ Seminar
Jeans
Sneakers
Jeans
Blouses
Blouses
Fifth Normal Form
Buy-Vend
Vend-Prod
Buy-Prod
Buyer
Vendor
Vendor
Product
Buyer
Product
Visual FoxPro™ Seminar
Denormalization
Normalized
Name
Address
Postal Code
Postal Code
Denormalized
Name
Address
City
Country
Postal Code
Visual FoxPro™ Seminar
Postal Code
City
Country
Want to read more?
Relational Database
Selected Writings
C. J. Date
Addison-Wesley Publishing Company
ISBN: 0-201-14196-5
Handbook of Relational Database Design
Candace C. Fleming and Barbara von Halle
Addison-Wesley Publishing Company
ISBN: 0-201-11434-8
Visual FoxPro™ Seminar
Visual FoxPro Database
Container







Data dictionary
Relationships
Field level domains (Field Rule)
Table level domains (Table Rule)
Referential Integrity
Stored Procedures
DbGetProp() and DbSetProp()
Visual FoxPro™ Seminar
View Designer

Updateable


The Update Tab in the view
designer
Joins
Inner
 Outer
 Left, Right, and Full


Top N
Visual FoxPro™ Seminar
Using SQL in the Visual
FoxPro Language


Why use SQL at all?
The SQL Commands in Visual
FoxPro
SELECT
 UPDATE
 DELETE
 CREATE
 INSERT INTO

Visual FoxPro™ Seminar
Designing User
Interfaces
Visual FoxPro™ Seminar
Principle 1
The User Is
In Control
Visual FoxPro™ Seminar
Principle 2
Follow The
Object-Action
Paradigm
Visual FoxPro™ Seminar
Principle 3
Be Consistent
Visual FoxPro™ Seminar
Principle 4
Make Things
Self Evident
Visual FoxPro™ Seminar
Principle 5
Pay Attention To
Aesthetics
Visual FoxPro™ Seminar
Principle 6
Give The User
Feedback
Visual FoxPro™ Seminar
Principle 7
Be Forgiving
Visual FoxPro™ Seminar
Object Oriented
Development
Visual FoxPro™ Seminar
OO Terminology







Class
Object
Abstraction
Polymorphism
Inheritance
Messaging
Containership
Visual FoxPro™ Seminar
Analysis and Design in an
OO world

The Iterative Approach
Inception
 Elaboration
 Construction
 Analysis, Design, Coding,
Testing, Implementation,
Training, Maintenance/Evolution
 Transition

Visual FoxPro™ Seminar
Analysis and Design in an
OO world
There is a constant looping back in
this OO development cycle.
New requirements discovered
during coding or implementation
feed back into the design phase.
New functional requirements
discovered alter future iterations
Visual FoxPro™ Seminar
The Visual FoxPro Class
Designer





Save As Class menu option
Adding properties and methods
to a class
Specifying an Include file for a
class
Creating subclasses
Adding controls to the form
designer’s toolbar from your
Classes
Visual FoxPro™ Seminar
The Application Framework



What is a framework?
The overview of the architecture
of the framework
Strategies for maximizing
maintainability
Visual FoxPro™ Seminar
The Framework In Detail







The Application Manager
The form class
The startup program
Building an application using the
framework
The form
The Menu
Enhancing your framework
Visual FoxPro™ Seminar
Form and Class Design




Coding methods in a reusable
way
Using THISFORM, THIS, and the
Parent property
Using WITH/ENDWITH
Using collections to address the
contents of a container
Visual FoxPro™ Seminar
Simple Base Classes
Label, Textbox, EditBox, CheckBox,
Option Button, Option Group
Command Button, Command Group
Spinner, Image, Line, Shape, Timer
Container, and Separator
Visual FoxPro™ Seminar
Complex Base Classes
ComboBox, ListBox, and Grids
PageFrames
Custom, Container, and Control
Form, Formset, and Toolbar
Visual FoxPro™ Seminar
Using Builders

The Visual Foxpro Builders


Make it easier to setup the complex
controls
Building your own builders
Builder.dbf and Builder.app
 ASELOBJ()
 Using the special Builder property
of a class

Visual FoxPro™ Seminar
OLE Base Classes

OLEBoundControl


Bound to a General Field in a DBF
file
OLEControl

Predefined contents at design
time.
Visual FoxPro™ Seminar
ActiveX Automation



Structure of ActiveX
Direct Manipulation of an
ActiveX server
Automation of an Object Inside
of an OLEControl
Visual FoxPro™ Seminar
Multi-user Issues


What is the multi-user problem?
Two strategies (Philosophies)
Optimistic
 It is unlikely that there will be a
problem when I try to save.
 Pessimistic
 It is very likely there will be a
problem when I try to save.

Visual FoxPro™ Seminar
Data Buffering





How did we do this before?
What’s new and different now?
Row versus Table buffering
Pessimistic versus Optimistic
buffering
Choosing the correct buffering
mode
Visual FoxPro™ Seminar
Setting the Buffering Mode
 CursorSetProp()
(CursorGetProp())
 Using
a Cursor’s
BufferModeOverride property
Visual FoxPro™ Seminar
Saving Buffered Edits




TableUpdate()
TableRevert()
GetFldState()
GetNextModified()
Visual FoxPro™ Seminar
Transaction Processing
The all or none approach
BEGIN TRANSACTION, END TRANSACTION, and
ROLLBACK
Resolving conflicts using CURVAL() and
OLDVAL()
Visual FoxPro™ Seminar
Client/Server - Is It For
You?

When does Client/Server make
sense?
Security
 Scalability
 Central Control of Data

Visual FoxPro™ Seminar
Remote Data Sources




Setting up data sources under
Windows (95, NT,98)
Connections in Visual FoxPro
Using Remote Views
Using SQL Passthrough
functions
Visual FoxPro™ Seminar
Designing Client/Server
Applications

User Interface Design


No more BROWSE of the customer
table
Awareness that your code does
not have absolute control over
the data updates.
Visual FoxPro™ Seminar
Using Visual FoxPro to
Create an ActiveX Server


OLEPublic classes
Designing the Server
Visual FoxPro™ Seminar
Creating Your Own ActiveX
Automation Servers

In-Process versus Out of
process servers




DLL versus EXE
Compiling the server
Registering the server
Using the server
Visual FoxPro™ Seminar
The Visual FoxPro Debugger




The debugger as a developer’s
tool
Choosing a FoxPro frame or the
debugger frame
Saving and restoring debugger
settings
Hot Keys in the debugger
Visual FoxPro™ Seminar
The Debugger Windows
Trace
 Watch
 Locals
 Call Stack
 Output
 SET DEBUGOUT TO
 Event Tracking
 Setting Breakpoints

Visual FoxPro™ Seminar
Coverage Analysis/
Application profiling



SET COVERAGE TO <FileName>
Turning coverage on and off
Using the Coverage Profiler
Visual FoxPro™ Seminar
Using Assertions


The ASSERT command
SET ASSERTS ON/OFF
Visual FoxPro™ Seminar
Using The DebugOut
Command


Does not mess up your
application screen
Does not introduce extra window
focus events to your application
Visual FoxPro™ Seminar
Visual FoxPro and the
Internet





What is HTML?
How does the Internet work?
The Internet Search Wizard
Accessing the search wizard
page
The Web Publishing Wizard
Visual FoxPro™ Seminar
Advanced Class Design
Concepts

Inheritance Hierarchy


Containership Hierarchy


The is-a relationship
The has-a relationship
Design Patterns
Visual FoxPro™ Seminar
Accessing the Windows
API from Visual FoxPro



What is the API?
DECLARE command
Calling an API function
Visual FoxPro™ Seminar