XDAPrevalenceEnglish

Download Report

Transcript XDAPrevalenceEnglish

Delphi 7 Prevalence
Wanderlan Santos dos Anjos
System Architect
Cartão BRB
[email protected]
Brasil
The Problem
FatClient
SQL
Database
Server
Brasil
The Problem
•
•
•
•
•
•
•
Client/Server Development with RAD
Quick construction for simple applications
Chaotic maintenance and evolution
Complicated deployment (Fat-Client)
High TCO
Low scalability
Inadequate for Web
Brasil
A Solution
ThinClient
Remotin
g
Application
Server
SQL
Database
Server
Brasil
A Solution
• Development N-tier with OO
• More productivity for bigger and more complex
applications (reuse)
• Maintenance and evolution more controlled by the
division of tasks
• High scalability
• Easy deployment
• Web-Enabled
Brasil
Hidden Issues
•
•
•
•
•
•
•
Requires more team knowledge
More expensive professionals
Requires better management
Low productivity
Object/Relational Mapping (Impedance)
Complex Framewoks
Technology in constant evolution, strong
obsolescence
• Blown up budgets and planning
Brasil
Impedance: Option 1
Account
Current
Account
One big table
Saving
Account
Account
Investment
Account
Account
Account
Current
Account
Saving
Account
Current Investment
Account
Account
Brasil
Impedance: option 2
Account
Current
Account
Investment
Account
Saving
Account
Three
tables
Account
Account
Current
Account
Account
Saving
Account
Current Invest.
Account Account
Brasil
Impedance: option 3
Joins
Account
Current
Account
Investment
Account
Saving
Account
Account
Current
Account
Saving
Account
Investment
Account
Brasil
An Evolution
Persistence layer
ThinClient
Remotin
g
Application
Pers
Server
SQL
Database
Server
Brasil
A Revolution
Prevalence layer
ThinClient
Remotin
g
Application
Prev
Server
Brasil
Prevalence
• A new term in our area (plus one) to define the direct
writing of the object state without use of:
– Relational database,
– Persistence layer and
– Data access layer (BDE, ADO, etc).
• A software layer that keeps all the objects in volatile
memory and registers all the transactions carried
through in these objects in not volatile memory, allowing
to the total recovery of objects in volatile memory after
an energy interruption or hardware fail.
Brasil
Advantages
• Performance profits with 1 or 2 orders of magnitude
• Reduction of servers sizing
• Code source simplification
– No SQL or OCL
• Elimination of the Persistence Layer
– No Object/Relational mapping
– No marshaling between:
• Primitive types of the language 
• Objectware types of the persistence layer 
• Database types
• Low footprint of the executables (~50Kb)
Brasil
Advantages II
• Bigger productivity by biggest use easiness
• Database elimination
– No server or farm of database
– No database client in application server or
interface layer
– No DBAs
– No data model approval
– Elimination and simplification of the database
production processes
• Easiness in the creation of scenarios:
production, development, Q&A and tests
• Low TCO
Brasil
Prevayler
Command
Class
Serialize
Method
Log
Execute
Snapshot
Brasil
Prevayler
The Java Prevalence
•
•
•
•
•
Based in transactions serialization
First serialize, later executes (Clock problem)
Allows to use any collection of Java API
Each transaction must be a class with a Execute method
Does not standardize or imposes any constraint of the class
model
Brasil
XDAPrevalence
Execute
Method
Serialize
Properties
Log
Snapshot
Brasil
XDAPrevalence
The Prevalence with Delphi 7
• Based in object serialization (RTTI)
• First executes, later serialize (Redo Log)
• Uses a specific list (StringList like) of high performance
and low memory consumption.
• The programmer is not worried about this (bigger
abstraction)
• The transactions are methods of the business classes
(more natural and little code)
• Imposes "all" the rules and constraints of the class
model automatically as MDA
• More performance by use of native code
Brasil
XDAPrevalence
The Prevalence with Delphi 7
• Implements primary, secondary and temporary keys with
filters
• Implements keys with autoincrement attribute
• Implements associations and aggregations with cascade
deletion
• Controls multiplicity of the relationships
• Implements EvolveModel, model evolution in standardized
way without the manual writing of migration programs
• Implements RollBack
• Implements Import and Export
• Implements optimizations for batch processing
• Implements FindNear
Brasil
Recover
Snapshot
Read
Snapshot
Prevalence
(Object Space)
Log
Read
Log
Brasil
Constraints for Application
• 65.536 business classes
• 536.870.911 objects by business class
• The volatile memory limitation can be
contouring increasing the size of the
operational system Swap file
Brasil
XDA Overview
Object
Browser
WebServices
Object Server
State
Machine
Prevalence
Job
Scheduler
Generator
Brasil
XDA Roadmap
•
•
•
•
•
Code generation from the class diagram (XMI) (version 0.5)
Business rules generation from state machines (XMI) (v. 0.6)
Evolve Model generation from two XMIs (v. 0.7)
Security and audit layers (v. 0.8)
Integration with RemObjects. (v. 0.9)
– Load balance
– Fault tolerance
– Object Server versus Database Server
– Objects publication with WebServices and other protocols
• Polymorphic Object Browser (v. 1.0)
• Linux version and better documentation (v. 2.0)
Brasil
Creating an Application
CASE
PIM
(XMI)
XDAGenerator
PSM
(PAS)
Delphi
ObjectServer
Brasil
Creating an application with
XDAPrevalence
(All this operations are automatically realized by XDAGenerator)
•
•
•
•
•
•
Declare business classes inheriting from TPrevalent.
Ex: TCustomer = class(TPrevalent)
For each business class declare a list in the form “T” + <business class
name> + “List” and inheriting from TPrevalentList.
Ex: TCustomerList = class(TPrevalentList)
For each association or aggregation declare a list with the same
relationship rule name (UML) and inheriting from TAssociation.
Ex: TAccountHolderList = class(TAssociation)
Declare lists.
Ex:
AccountList : TAccountList;
CustomerList : TCustomerList;
Write code of Prevalence initialization.
Write business methods using Prevalence methods (Add, Delete,
Update, etc) (this point will be generated from v.0.6).
Brasil
1. Business Classes
(All this operations are automatically realized by XDAGenerator)
• Uses Borland code rules:
– Declare attributes as private prefixing with “F”
– Redeclare same attributes as published using property
• Declare business methods as published
• Declare a method published named PrimaryKey
• Declare others methods published for secondary and temporary keys
and filters, if to exist
• The function prototype for a key is: function : type;
• Prefers keys of the type integer instead of keys string
• The types of keys are more efficient in the following order: integer >
int64 > currency > double or TDateTime > string
• The function prototype for a filter : function : boolean;
• Declare a method protected procedure New; override; for class
initialization
Brasil
2. Lists for Business Classes
(All this operations are automatically realized by XDAGenerator)
• In order to do the list strongly typed, do
typecasts for:
– Methods: Add, Delete, Find and
FindNear
– Default property Objects
Brasil
3. Associations and Aggregations
(All this operations are automatically realized by XDAGenerator)
• Do the same typecasts of Lists for
business classes
• Call Create for each
association/aggregation in New method of
each business class.
• Do override in class methods (static
methods) Composition if is aggregation
and MaxConstraint and MinConstraint for
relationship multiplicity control
Brasil
4. Declare Lists
(All this operations are automatically realized by XDAGenerator)
Ex:
var
AccountList : TAccountList;
CustomerList : TCustomerList;
Brasil
5. Prevalence Initialization
(All this operations are automatically realized by XDAGenerator)
•
•
•
•
Instance the prevalence
Instance primary and secondary lists
Call Prevalence.Recover
Ex:
– Prevalence := TPrevalence.Create('C:\temp\XDA');
– AccountList := TAccountList.Create(TAccount);
– PostList := TPostList.Create(TPost);
– Customer := TCustomer.Create(TCustomer, 'PrimaryKey',
ltInteger, '', ‘SSN');
– VIPCustomerList:= TCustomer.Create(TCustomer, ‘ByAddress',
‘IsVIPCustomer');
– Prevalence.Recover;
Brasil
References
• www.sourceforge.net/projects/xda
• www.prevayler.org
• birrell.org/andrew/papers/024-DatabasesPaper.pdf
• www-106.ibm.com/developerworks/web/library/wa-objprev/index.html
Brasil