POLYTECHNIC INSTITUTE OF LEIRIA Maria dos Anjos Dixe – [email protected].
Brasil Delphi 7 Prevalence Wanderlan Santos dos Anjos System Architect Cartão BRB
-
Upload
lilian-stevenson -
Category
Documents
-
view
219 -
download
0
description
Transcript of Brasil Delphi 7 Prevalence Wanderlan Santos dos Anjos System Architect Cartão BRB
Brasil
The Problem
FatClient DatabaseServer
SQL
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
DatabaseServer
SQL
ApplicationServerRemoting
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
CurrentAccount
InvestmentAccount
InvestmentAccount
CurrentAccountSaving
AccountCurrentAccount
Account
Account
Account
SavingAccount
One big table
Brasil
Impedance: option 2Account
CurrentAccount
InvestmentAccount
SavingAccount
CurrentAccountAccount
SavingAccountAccount
Invest.Account
CurrentAccountAccount
Three
tables
Brasil
Impedance: option 3Account
CurrentAccount
InvestmentAccount
SavingAccount
Account
CurrentAccount
InvestmentAccount
SavingAccount
Joins
Brasil
Pers
An Evolution
ThinClient
DatabaseServer
SQL
ApplicationServerRemoting
Persistence layer
Brasil
A Revolution
PrevThinClientApplication
ServerRemoting
Prevalence layer
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
CommandClass
SerializeMethod Log
Execute
Snapshot
SerializeAttributes
Brasil
PrevaylerThe 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
Method SerializeProperties Log
Execute
Snapshot
SerializeProperties
Brasil
XDAPrevalenceThe 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
• 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
XDAPrevalence The Prevalence with Delphi 7
Brasil
Recover
Prevalence(Object Space)
ReadSnapshot
Log
Snapshot
ReadLog
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
Object Server
XDA Overview
PrevalenceStateMachine
ObjectBrowser
JobScheduler
WebServices
Generator
Brasil
• 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)
XDA Roadmap
Brasil
Creating an Application
CASE XDAGenerator Delphi
ObjectServer
PIM(XMI)
EXE
PSM(PAS)
Brasil
Creating an application withXDAPrevalence
(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