31
Brasil Delphi 7 Prevalence Wanderlan Santos dos Anjos System Architect Cartão BRB [email protected]

Brasil Delphi 7 Prevalence Wanderlan Santos dos Anjos System Architect Cartão BRB

Embed Size (px)

DESCRIPTION

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

Citation preview

Page 1: Brasil Delphi 7 Prevalence Wanderlan Santos dos Anjos System Architect Cartão BRB

Brasil

Delphi 7 Prevalence

Wanderlan Santos dos AnjosSystem Architect

Cartão [email protected]

Page 2: Brasil Delphi 7 Prevalence Wanderlan Santos dos Anjos System Architect Cartão BRB

Brasil

The Problem

FatClient DatabaseServer

SQL

Page 3: Brasil Delphi 7 Prevalence Wanderlan Santos dos Anjos System Architect Cartão BRB

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

Page 4: Brasil Delphi 7 Prevalence Wanderlan Santos dos Anjos System Architect Cartão BRB

Brasil

A Solution

ThinClient

DatabaseServer

SQL

ApplicationServerRemoting

Page 5: Brasil Delphi 7 Prevalence Wanderlan Santos dos Anjos System Architect Cartão BRB

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

Page 6: Brasil Delphi 7 Prevalence Wanderlan Santos dos Anjos System Architect Cartão BRB

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

Page 7: Brasil Delphi 7 Prevalence Wanderlan Santos dos Anjos System Architect Cartão BRB

Brasil

Impedance: Option 1

Account

CurrentAccount

InvestmentAccount

InvestmentAccount

CurrentAccountSaving

AccountCurrentAccount

Account

Account

Account

SavingAccount

One big table

Page 8: Brasil Delphi 7 Prevalence Wanderlan Santos dos Anjos System Architect Cartão BRB

Brasil

Impedance: option 2Account

CurrentAccount

InvestmentAccount

SavingAccount

CurrentAccountAccount

SavingAccountAccount

Invest.Account

CurrentAccountAccount

Three

tables

Page 9: Brasil Delphi 7 Prevalence Wanderlan Santos dos Anjos System Architect Cartão BRB

Brasil

Impedance: option 3Account

CurrentAccount

InvestmentAccount

SavingAccount

Account

CurrentAccount

InvestmentAccount

SavingAccount

Joins

Page 10: Brasil Delphi 7 Prevalence Wanderlan Santos dos Anjos System Architect Cartão BRB

Brasil

Pers

An Evolution

ThinClient

DatabaseServer

SQL

ApplicationServerRemoting

Persistence layer

Page 11: Brasil Delphi 7 Prevalence Wanderlan Santos dos Anjos System Architect Cartão BRB

Brasil

A Revolution

PrevThinClientApplication

ServerRemoting

Prevalence layer

Page 12: Brasil Delphi 7 Prevalence Wanderlan Santos dos Anjos System Architect Cartão BRB

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.

Page 13: Brasil Delphi 7 Prevalence Wanderlan Santos dos Anjos System Architect Cartão BRB

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)

Page 14: Brasil Delphi 7 Prevalence Wanderlan Santos dos Anjos System Architect Cartão BRB

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

Page 15: Brasil Delphi 7 Prevalence Wanderlan Santos dos Anjos System Architect Cartão BRB

Brasil

Prevayler

CommandClass

SerializeMethod Log

Execute

Snapshot

SerializeAttributes

Page 16: Brasil Delphi 7 Prevalence Wanderlan Santos dos Anjos System Architect Cartão BRB

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

Page 17: Brasil Delphi 7 Prevalence Wanderlan Santos dos Anjos System Architect Cartão BRB

Brasil

XDAPrevalence

Method SerializeProperties Log

Execute

Snapshot

SerializeProperties

Page 18: Brasil Delphi 7 Prevalence Wanderlan Santos dos Anjos System Architect Cartão BRB

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

Page 19: Brasil Delphi 7 Prevalence Wanderlan Santos dos Anjos System Architect Cartão BRB

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

Page 20: Brasil Delphi 7 Prevalence Wanderlan Santos dos Anjos System Architect Cartão BRB

Brasil

Recover

Prevalence(Object Space)

ReadSnapshot

Log

Snapshot

ReadLog

Page 21: Brasil Delphi 7 Prevalence Wanderlan Santos dos Anjos System Architect Cartão BRB

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

Page 22: Brasil Delphi 7 Prevalence Wanderlan Santos dos Anjos System Architect Cartão BRB

Brasil

Object Server

XDA Overview

PrevalenceStateMachine

ObjectBrowser

JobScheduler

WebServices

Generator

Page 23: Brasil Delphi 7 Prevalence Wanderlan Santos dos Anjos System Architect Cartão BRB

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

Page 24: Brasil Delphi 7 Prevalence Wanderlan Santos dos Anjos System Architect Cartão BRB

Brasil

Creating an Application

CASE XDAGenerator Delphi

ObjectServer

PIM(XMI)

EXE

PSM(PAS)

Page 25: Brasil Delphi 7 Prevalence Wanderlan Santos dos Anjos System Architect Cartão BRB

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).

Page 26: Brasil Delphi 7 Prevalence Wanderlan Santos dos Anjos System Architect Cartão BRB

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

Page 27: Brasil Delphi 7 Prevalence Wanderlan Santos dos Anjos System Architect Cartão BRB

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

Page 28: Brasil Delphi 7 Prevalence Wanderlan Santos dos Anjos System Architect Cartão BRB

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

Page 29: Brasil Delphi 7 Prevalence Wanderlan Santos dos Anjos System Architect Cartão BRB

Brasil

4. Declare Lists(All this operations are automatically realized by XDAGenerator)

Ex:var

AccountList : TAccountList;CustomerList : TCustomerList;

Page 30: Brasil Delphi 7 Prevalence Wanderlan Santos dos Anjos System Architect Cartão BRB

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;

Page 31: Brasil Delphi 7 Prevalence Wanderlan Santos dos Anjos System Architect Cartão BRB

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