30
Selecting Objects An OO Architecture of the Relational Model Polina Cherkasova Saint-Petersburg, 2005

Selecting Objects An OO Architecture of the Relational Model Polina Cherkasova Saint-Petersburg, 2005

  • View
    215

  • Download
    0

Embed Size (px)

Citation preview

Selecting ObjectsAn OO Architecture of the

Relational ModelPolina Cherkasova

Saint-Petersburg, 2005

The Relational and OO models

• OO designing

• Relational performance

? Impedance Mismatch

Logical Levels

• User Interface

• Business Functionality

• Data Structures

Logical Levels

• User Interface

• Business Functionality

• Data Structures– Relations– Attributes of objects– XML structures

Logical Levels

• User Interface

• Business Functionality– Functions, Procedures, Views, Triggers– Object methods– Middle tier in the Three-Tier mofdel

• Data Structures

Logical Levels

• User Interface– Web Applications– Stand-Alone Application– Web Service

• Business Functionality

• Data Structures

N

S

N

S

One by one

StartTime +

S + ln(N)

+ S (

StartTime +

ln(N) +

UpdateTime

)

_______

ln(N) ∙ S

Together

StartTime +

S + ln(N) +

S ∙ UpdateTime

_______

ln(N) + S

Bulk Operations

• Delete

• Move

• Copy

• Template objects

• Import and export

• Explicit multiplicity

Commonly used approaches• OO interface• Call-back from the Data Structures level• Various data sources

• OO interface------- ---- -------- ---- --- --- ---- --- -- ----- ------- ---------

• Call-back from the Data Structures level• Various data sources

Commonly used approaches

A

getA()

setA()

Commonly used approaches• OO interface• Call-back from the Data Structures level

• Various data sources

БФ

Структуры

БФ

Структуры

OnUpdate

OnCreate

OnDelete

Commonly used approaches

• OO interface• Call-back from the Data Structures level• Various data sources

Create object

OK Cancel

CreateObject(int a, string b)

CreateObject(string sourceName)

Selecting Objects:entities and data sets

Selecting Objects:entities and data sets

Restrictions:

OO interface

Encapsulation of data

Data Set

The query is not executed – The query can be

modified– Data are not accessible

The query is executed – Data can be used– To obtain other data

new one more call to the database is needed

– If redundant data was requested, spent resources can not be recovered

Selecting Objects• OO interface• Call-back from the Data Structures level• Various data sources

• OO interface------- ---- -------- ---- --- --- ---- --- -- ----- ------- ---------

• Call-back from the Data Structures level• Various data sources

Selecting Objects

A

UpdateA

Selecting Objects• OO interface• Call-back from the Data Structures level

• Various data sources

БФ

Структуры

БФ

Структуры

OnUpdate

OnCreate

OnDelete

Commonly used approaches

• OO interface• Call-back from the Data Structures level• Various data sources

Create object

OK Cancel

CreateObject(DataQry qry)

Data set types

• List of field names

• Base query

Detailing

NewCityQryCityName

CityQryCity_IDCityName

NewSupplierQrySupplierNameCityNameForNewSupplier

SupplierQrySupplier_IDCity_IDSupplierName

SupplierExtQrySupplier_IDCity_IDSupplierNameCityName

Selection

SupplierQry qry = new SupplierQry();

qry.Where.And(SupplierQry.Fields.SupplierName + " like 'A%'");

int count = qry.ExecuteCount();

Updating

Methods of the class Entity:

• InsertRows

• UpdateRows

• DeleteRows

Triggersprivate void ProcessNewData(SupplierQry inserted){ SupplierQry wrongSuppliers = new SupplierQry(inserted); wrongSuppliers.Where.And(String.Format("not IsValidSupplierName({0})",

SupplierQry.Fields.SupplierName)); string expr = String.Format("CorrectSupplierName({0})",

SupplierQry.Fields.SupplierName); this.UpdateRowsById(wrongSuppliers,

Assign.Expression(SupplierQry.Fields.SupplierName, expr));

}

Designing

Does the truncated object-oriented model still make sense?

Polymorphism and Call-Back Projects

Suppliers

Сity …

Supplier …

Project …

Part …

Project_Part …

IProjectForSupplier

Inheritance and Reuse

Security

Suppliers

SecureEntity ActionQry ListActions(memberID, entityID) …

Supplier …

Projects

Encapsulation of Data and Complex Calculations

Projects

Project …

Part …

Project_Part …

SupplierPricingData SupplierPricingValue(int supplierID, DataSet prices) int PredictPrice(int partID, DateTime date)

Open Issues

• Obtaining and analysis of the practical results

• Atomic parts of an SQL query and their nature.

• Questions of casting of data set types.• Rules of interaction with application and

the structure of interface level of Business Functionality

• How to mitigate risk of low concurrency [15] due to encapsulated data behavior?