SlideShare una empresa de Scribd logo
1 de 155
Descargar para leer sin conexión
mORMot & Friends
Arnaud Bouchez
Opinions
Ahead
Great times for us
Great times for us
Delphi is Hype
Delphi + Pascal > Ruby
If you say Delphi is dead,
YOU are dead!
Two Languages In One
Application Language
like Java C# Ruby Python
System Language
like C C++
Dual Memory Management
Automatic Memory Management
COW and refcount
Manual Memory Management
Uses much less CPU/RAM
Server stability
Dual Memory Management
Automatic Memory Management
COW and refcount
Manual Memory Management
Uses much less CPU/RAM
Server stability
ARC
New opportunities
New platforms
New compilers
Great communities
Third parties
Open Source
Unleash your power
Decades of experience
Business knowledge
Productive tools
Unleash your power
Decades of experience
Business knowledge
Productive tools
Innovative concepts
mORMot & Friends
Open Source
Architecture & Design
Cross-Cutting features
DB Layer
ORM/ODM/SOA/MVC
Cross platform
Q&A
mORMot & Friends
Open Source
Architecture & Design
Cross-Cutting features
DB Layer
ORM/ODM/SOA/MVC
Cross platform
Q&A
Open Source
Started in 2008
5769 checkins since 2010
77 COCOMO years
Open Source
Started in 2008
6215 checkins since 2010
86 COCOMO years
($ 4,746,754)
http://synopse.info/fossil
http://github.com/synopse/mORMot
http://openhub.net/p/mormot
LOC
Code 324,415
Comments 75,913
Blanks 34,197
Total 434,525
http://synopse.info/fossil
http://github.com/synopse/mORMot
http://openhub.net/p/mormot
Doc as Specs
Exhaustive
Maintained
Open Source
http://synopse.info/files/html
2100 pages of pdf
SynProject powered
Test Driven
27,019,014 tests
Write the test
Fail the test
Write the implementation
Pass the test
Test Driven
27,019,014 tests
Regression
Performance
Thread safety
Cross platform – Cross compiler
Test Driven
27,019,014
http://synopse.info/forum
Feedback and support
Topics 3,603
Posts 22,112
Registered users 1,662
Hall of fame
Alexander (sha)
Alexander (volax)
AlexPirate
Alfred Glaenzer (alf)
Arnaud Bouchez
Aweste
Bas Schouten
BigStar
Cheemeng
CoMPi
Damien (ddemars)
Daniel Kuettner
David Mead (MDW)
Delphinium (louisyeow)
DigDiver
EgorovAlex
Emanuele (lele9)
Eric Grange
Esmond
Esteban Martin (EMartin)
EvaF
Goran Despalatovic (gigo)
Joe (jokusoft)
Jordi Tudela
Leon Oosthuizen
Maciej Izak (hnb)
Mario Moretti
Marius Maximus (mariuszekpl)
Martin Suer
Mazinsw
MChaos
Miab3
Michael (EgonHugeist)
MilesYou
Mingda
Ondrej (reddwarf)
Pavel (mpv)
Pierre le Riche
RalfS
Richard6688
Sabbiolina
Sanyin
Sinisa (sinisav)
Sllimr7139
Stefan (itSDS)
Vadim Orel
Win2014
Wloochacz
Wolfgang Ehrhardt
Zed
Hall of fame
Alexander (sha)
Alexander (volax)
AlexPirate
Alfred Glaenzer (alf)
Arnaud Bouchez
Aweste
Bas Schouten
BigStar
Cheemeng
CoMPi
Damien (ddemars)
Daniel Kuettner
David Mead (MDW)
Delphinium (louisyeow)
DigDiver
EgorovAlex
Emanuele (lele9)
Eric Grange
Esmond
Esteban Martin (EMartin)
EvaF
Goran Despalatovic (gigo)
Joe (jokusoft)
Jordi Tudela
Leon Oosthuizen
Maciej Izak (hnb)
Mario Moretti
Marius Maximus (mariuszekpl)
Martin Suer
Mazinsw
MChaos
Miab3
Michael (EgonHugeist)
MilesYou
Mingda
Ondrej (reddwarf)
Pavel (mpv)
Pierre le Riche
RalfS
Richard6688
Sabbiolina
Sanyin
Sinisa (sinisav)
Sllimr7139
Stefan (itSDS)
Vadim Orel
Win2014
Wloochacz
Wolfgang Ehrhardt
Zed
… YOUR NAME ?
mORMot & Friends
Open Source
Architecture & Design
Cross-Cutting features
DB Layer
ORM/ODM/SOA/MVC
Cross platform
Q&A
Architecture Switch
BBM → Clean
nTier → SOA
SOAP → REST
RAD → MVC/MVVM
SQL → ORM
NoSQL → ODM
OOP → SOLID
Architecture Switch
### → ###
… see corresponding
set of Slides
Design with Interfaces
What, not how
A type that comprises
abstract virtual methods
Rely on abstraction
rather than implementation
Design with Interfaces
Abstraction is your health
Publish classes as services
Test, mock
Write SOLID code
Design with Interfaces
Abstraction is your health
Publish classes as services
Test, mock
Write SOLID code
and manage memory for you
Design with Interfaces
Abstraction is your health
Publish classes as services
Test, mock
Write SOLID code
and manage memory for you
unless zeroing weak pointers
SOLID Principles
Single responsibility
Open/closed
Liskov substitution
Interface segregation
Dependency inversion
.. unleash interfaces!
mORMot & Friends
Open Source
Architecture & Design
Cross-Cutting features
DB Layer
ORM/ODM/SOA/MVC
Cross platform
Q&A
Cross Cutting Features
UTF-8 JSON
TDynArray
TDocVariant
Logging
Testing
Compression
Crypto ECC
PDF
Mustache
SpiderMonkey
Uncoupled features: could be used
without the ORM/SOA/MVC framework
SynCommons
UTF-8 JSON
From the ground up
With objects, records,
dynamic arrays, variants, any value
Performance and integration
SynCommons
TDynArray
Wrapper to an existing dynamic array
TList<> on steroids
e.g. sorting, search,
binary or JSON serialization
using enhanced RTTI if available
SynCommons
TDynArray
In conjunction with records and variants:
value objects
data transfer objects (DTO)
SynCommons
TDocVariant
Stores documents
objects, arrays, variants
with low overhead
natively JSON
with late-binding support
SynCommons
TDocVariant
var V: variant; // stored as any variant
...
TDocVariant.New(V);
// or slightly slower V := TDocVariant.New;
V.name := 'John';
// property accessed via late-binding
V.year := 1972;
// now V contains {"name":"john","year":1972}
SynCommons
TDocVariant
V.name := 'Mark'; // overwrite a property value
writeln(V.name); // will write 'Mark'
V.age := 12; // add a property to the object
writeln(V.age); // will write '12'
writeln(V); // implicit conversion to JSON string
// i.e. '{"name":"Mark","age":12}'
writeln(VariantSaveJSON(V1)); // as RawUTF8
SynCommons
TDocVariant + mORMot.pas
TSQLRecordData = class(TSQLRecord)
private
fName: RawUTF8;
fData: variant;
public
published
property Name: RawUTF8 read fTest write fTest
stored AS_UNIQUE;
property Data: variant read fData write fData;
end;
TDocVariant + mORMot.pas
property Data: variant read fData write fData;
We store a TDocVariant in Data
to mutate a SQL database
into a NoSQL engine
TDocVariant + mORMot.pas
property Data: variant read fData write fData;
We store a TDocVariant in Data
to mutate a SQL database
into a NoSQL engine
TDocVariant + mORMot.pas
var aRec: TSQLRecordData;
aID: integer;
begin
// initialization of one record
aRec := TSQLRecordData.Create;
aRec.Name := 'Joe’;
// create a TDocVariant
aRec.data := _JSONFast('{name:"Joe",age:30}');
// or we can use this overloaded constructor
aRec := TSQLRecordData.Create(
['Joe',_ObjFast(['name','Joe','age',30])]);
TDocVariant + mORMot.pas
// now we can play with the data, e.g. via late-binding:
writeln(aRec.Name); // will write 'Joe'
writeln(aRec.Data); // write '{"name":"Joe","age":30}
// one year older
aRec.Data.age := aRec.Data.age+1;
// add a property to the schema
aRec.Data.interests := 'football';
aID := aClient.Add(aRec);
// we stored {"name":"Joe","age":31,"interests":"footbal"}
aRec.Free;
// now we can retrieve the data e.g. via aID
end;
TDocVariant + mORMot.pas
property Data: variant read fData write fData;
Data will be stored as TEXT
in the underlying RDBMS
TDocVariant + mORMot.pas
property Data: variant read fData write fData;
Data will be stored as TEXT
in the underlying RDBMS
Of course, if the database is a MongoDB engine,
the data will be stored as a true BSON document
SynCommons
Logging
Low overhead
Local or remote
Fast viewer tool
Exception catch, stack trace
Used by the whole framework
SynCommons
Testing
Light and cross-platform
Convention over configuration
Stubs and mocks
Compression
SynZip
faster unzip
SynLZO
SynLZ
speed symmetric
SynCrtSock
Cross-platform Network library
Socket WinHTTP WinINet clients
Optimized HTTP server
IOCP driven
http.sys kernel-mode
WebSockets
SynCrypto
SHA 1 – 256
MD5 – RC4
AES 128 – 192 – 256
ECB – CBC – OFB – CTR
HMAC - PBKDF2
PRNG
Pascal and/or optimized asm
(AES-NI, SSE42)
SynECC
Certificate-based
public-key cryptography
using cutting edge ECC-secp256r1
For data signature,
content encryption
and safe transmission
SynPDF
From TCanvas to PDF
Unicode
Font embedding
Encryption
SynPDF
From TCanvas to PDF
Unicode
Font embedding
Encryption
Code-based report engine
SynMustache
Mustache template system
Data context as TDocVariant
UTF-8 JSON
With extensions
SynMustache
Data Context
{
"header": "Colors",
"items": [
{"name": "red", "first": true, "url": "#Red"},
{"name": "green", "link": true, "url": "#Green"},
{"name": "blue", "link": true, "url": "#Blue"}
],
"empty": true
}
SynMustache
Template
<h1>{{header}}</h1>
{{#items}}
{{#first}}
<li><strong>{{name}}</strong></li>
{{/first}}
{{#link}}
<li><a href="{{url}}">{{name}}</a></li>
{{/link}}
{{/items}}
{{#empty}}
<p>The list is empty.</p>
{{/empty}}
SynMustache
Result
<h1>Colors</h1>
<li><strong>red</strong></li>
<li><a href="#Green">green</a></li>
<li><a href="#Blue">blue</a></li>
<p>The list is empty.</p>
SynMustache
Data Context
{
"header": "Colors",
"items": [
{"name": "red", "first": true, "url": "#Red"},
{"name": "green", "link": true, "url": "#Green"},
{"name": "blue", "link": true, "url": "#Blue"}
],
"empty": true
}
SynMustache
Template
<h1>{{header}}</h1>
{{#items}}
{{#first}}
<li><strong>{{name}}</strong></li>
{{/first}}
{{#link}}
<li><a href="{{url}}">{{name}}</a></li>
{{/link}}
{{/items}}
{{#empty}}
<p>The list is empty.</p>
{{/empty}}
SynMustache
Result
<h1>Colors</h1>
<li><strong>red</strong></li>
<li><a href="#Green">green</a></li>
<li><a href="#Blue">blue</a></li>
<p>The list is empty.</p>
SynMustache
Data Context
{
"header": "Colors",
"items": [
{"name": "red", "first": true, "url": "#Red"},
{"name": "green", "link": true, "url": "#Green"},
{"name": "blue", "link": true, "url": "#Blue"}
],
"empty": true
}
SynMustache
Template
<h1>{{header}}</h1>
{{#items}}
{{#first}}
<li><strong>{{name}}</strong></li>
{{/first}}
{{#link}}
<li><a href="{{url}}">{{name}}</a></li>
{{/link}}
{{/items}}
{{#empty}}
<p>The list is empty.</p>
{{/empty}}
SynMustache
Result
<h1>Colors</h1>
<li><strong>red</strong></li>
<li><a href="#Green">green</a></li>
<li><a href="#Blue">blue</a></li>
<p>The list is empty.</p>
SynMustache
Data Context
{
"header": "Colors",
"items": [
{"name": "red", "first": true, "url": "#Red"},
{"name": "green", "link": true, "url": "#Green"},
{"name": "blue", "link": true, "url": "#Blue"}
],
"empty": true
}
SynMustache
Template
<h1>{{header}}</h1>
{{#items}}
{{#first}}
<li><strong>{{name}}</strong></li>
{{/first}}
{{#link}}
<li><a href="{{url}}">{{name}}</a></li>
{{/link}}
{{/items}}
{{#empty}}
<p>The list is empty.</p>
{{/empty}}
SynMustache
Result
<h1>Colors</h1>
<li><strong>red</strong></li>
<li><a href="#Green">green</a></li>
<li><a href="#Blue">blue</a></li>
<p>The list is empty.</p>
SynSM/SyNode
Latest Spidermonkey
Javascript JIT engine
Call JS from Delphi
TSMVariant for late binding
SynSM/SyNode
Latest Spidermonkey
Javascript JIT engine
Call JS from Delphi
TSMVariant for late binding
SynSM + mORMot = multi-threaded node.js
Sample 23
mORMot & Friends
Open Source
Architecture & Design
Cross-Cutting features
DB Layer
ORM/ODM/SOA/MVC
Cross platform
Q&A
DB Layer
SynMongoDB
NoSQL
SynDB
SQL
Uncoupled features: could be used
without the ORM/SOA/MVC framework
SynMongoDB
MongoDB native access
BSON types - TBSONVariant
TDocVariant
Extended JSON
Sample 24
SynDB
Direct RDBMS access layer
Not linked to DB.pas
Multi providers
UTF-8 JSON
Interface based
Knows SQL dialects
SynDBExplorer
SynDB
Not linked to DB.pas
Enter the 21th century
Less data types
By-pass slow TDataSet
Unicode even before Delphi 2009
Array binding
Native JSON support
Remote access
SynDB
Providers
SynDB
Connect to a DB
var Props: TSQLDBConnectionProperties;
...
Props := TOleDBMSSQLConnectionProperties.Create(
'.SQLEXPRESS','AdventureWorks2008R2','','');
try
UseProps(Props);
finally
Props.Free;
end;
SynDB
Execute statements
procedure UseProps(Props: TSQLDBConnectionProperties);
var I: ISQLDBRows;
begin
I := Props.Execute(
'select * from Sales.Customer '+
'where AccountNumber like ?',['AW000001%']);
while I.Step do
assert(Copy(I['AccountNumber'],1,8)='AW000001');
end;
SynDB
Late-binding
procedure UseProps(Props: TSQLDBConnectionProperties);
var Row: Variant;
begin
with Props.Execute(
'select * from Sales.Customer '+
'where AccountNumber like ?‘,['AW000001%'],@Row) do
while Step do
assert(Copy(Row.AccountNumber,1,8)='AW000001');
end;
SynDB
TQuery emulation
Q := TQuery.Create(aSQLDBConnection);
try
Q.SQL.Clear; // optional
Q.SQL.Add('select * from DOMAIN.TABLE');
Q.SQL.Add(' WHERE ID_DETAIL=:detail;');
Q.ParamByName('DETAIL').AsString := '1234';
Q.Open;
Q.First; // optional
while not Q.Eof do begin
assert(Q.FieldByName('id_detail').AsString='1234');
Q.Next;
end;
Q.Close; // optional
finally
Q.Free;
end;
SynDB
Fast read/only TDataSet
ds1.DataSet := ToDataSet(ds1,
aProps.Execute('select * from people',[]));
Read/write TClientDataSet
ds1.DataSet := ToClientDataSet(ds1,
aProps.Execute('select * from people',[]));
SynDB
Remote access via HTTP
SynDB
Remote access via HTTP
http.sys based server
SynLZ compression
Digital signature
Authentication
SynDB
Remote access via HTTP
Mutate SQLite3 into a
high performance Client-Server RDBMS
No library to deploy on Client side
Easy remote hosting on Server side
SynDB
Remote access via HTTP
Mutate SQLite3 into a
high performance Client-Server RDBMS
No library to deploy on Client side
Easy remote hosting on Server side
SynDBExplorer
Manage and request your DBs
Any supported database
High performance grid
Export to CSV or SQLite3
SQLite3 integrated
Remote server or client
SynDBExplorer
mORMot & Friends
Open Source
Architecture & Design
Cross-Cutting features
DB Layer
ORM/ODM/SOA/MVC
Cross platform
Q&A
ORM/ODM/SOA/MVC
ORM/ODM/SOA/MVC
RESTful
ORM/ODM
SOA
Real Time
MVC
RESTful ORM
Not an ORM
with a transmission layer
But a RESTful ORM
from the ground up
TSQLRest
RESTful access
Convention over configuration
CRUD methods - Cache
Authentication – Authorization
Services
On Client or Server side
TSQLRest
TSQLRest
TSQLRest
TSQLRest
TSQLRestServer
Server Storage
In-memory
SQLite3 local
External SQL
External NoSQL
Redirected
TSQLRestServer
TSQLRestServer
Per table redirection
TSQLRestClient
Client Access
In process
Library
HTTP
Named pipes
Windows messages
TSQLRest Cache
TSQLRecord
Convention over configuration
TSQLSampleRecord = class(TSQLRecord)
private
fQuestion: string;
fName: string;
fTime: TModTime;
published
property Time: TModTime read fTime write fTime;
property Name: string read fName write fName;
property Question: string read fQuestion write fQuestion;
end;
TSQLRecord
Convention over configuration
TSQLSampleRecord = class(TSQLRecord)
private
fQuestion: RawUTF8;
fName: RawUTF8;
fTime: TModTime;
published
property Time: TModTime read fTime write fTime;
property Name: RawUTF8 read fName write fName;
property Question: RawUTF8 read fQuestion write fQuestion;
end;
TSQLModel
Define your data model
function CreateSampleModel: TSQLModel;
begin
result := TSQLModel.Create([TSQLSampleRecord]);
end;
Shared on both Client and Server side
Database: TSQLRest
CRUD Operations
procedure TForm1.FindButtonClick(Sender: TObject);
var Rec: TSQLSampleRecord;
begin
Rec := TSQLSampleRecord.Create(
Database,'Name=?',[StringToUTF8(NameEdit.Text)]);
try
if Rec.ID=0 then
QuestionMemo.Text := 'Not found' else
QuestionMemo.Text := UTF8ToString(Rec.Question);
finally
Rec.Free;
end;
end;
Database: TSQLRest
CRUD Operations
procedure TForm1.AddButtonClick(Sender: TObject);
var Rec: TSQLSampleRecord;
begin
Rec := TSQLSampleRecord.Create;
try
Rec.Name := StringToUTF8(NameEdit.Text);
Rec.Question := StringToUTF8(QuestionMemo.Text);
if Database.Add(Rec,true)=0 then
ShowMessage('Error adding the data') else begin
NameEdit.Text := '';
QuestionMemo.Text := '';
NameEdit.SetFocus;
end;
finally
Rec.Free;
end;
end;
TSQLRestServer
var Model: TSQLModel;
Database: TSQLRestServerDB;
HTTPServer: TSQLHttpServer;
…
Model := CreateSampleModel;
Database := TSQLRestServerDB.Create(Model,'data.db3');
Database.CreateMissingTables;
HTTPServer := TSQLHttpServer.Create('8080',[Database]);
HTTPServer.AccessControlAllowOrigin := '*';
TSQLRestClient
var Model: TSQLModel;
Database: TSQLRest;
…
Model := CreateSampleModel;
Database := TSQLHttpClient.Create(ServerIP,'8080',Model);
Sample 04
Sample 04
http://localhost:8080/root
http://localhost:8080/root/samplerecord
disable authentication…
http://localhost:8080/root/samplerecord
http://localhost:8080/root/samplerecord/1
SynFile
TSQLRestServer
External SQL
var Model: TSQLModel;
Props: TSQLDBConnectionProperties;
Database: TSQLRestServerDB;
HTTPServer: TSQLHttpServer;
…
Model := CreateSampleModel;
Props := TODBCConnectionProperties.Create('',
'Driver=PostgreSQL Unicode';…','','');
VirtualTableExternalRegisterAll(Model,Props);
Database := TSQLRestServerDB.Create(Model,':memory:');
Database.CreateMissingTables;
HTTPServer := TSQLHttpServer.Create('8080',[Database]);
HTTPServer.AccessControlAllowOrigin := '*';
Sample 28
TSQLRecord
Mapping by Convention
TSQLRecordPeopleExt = class(TSQLRecord)
..
published
property FirstName: RawUTF8 index 40
property LastName: RawUTF8 index 40
property Data: TSQLRawBlob
property YearOfBirth: integer
property YearOfDeath: word
property LastChange: TModTime
property CreatedAt: TCreateTime
end;
TSQLRecord
Mapping by configuration
Model := TSQLModel.Create([TSQLRecordPeopleExt],'root');
VirtualTableExternalRegister(
Model,TSQLRecordPeopleExt,Props,'Test.People');
TSQLRecord
Mapping by configuration
Model := TSQLModel.Create([TSQLRecordPeopleExt],'root');
VirtualTableExternalRegister(
Model,TSQLRecordPeopleExt,Props,'Test.People');
Model.Props[TSQLRecordPeopleExt].ExternalDB.
MapField('ID','Key').
MapField('YearOfDeath','YOD');
TSQLRecord Change Tracking
Objects Time Machine
Database.TrackChanges([TSQLInvoice]);
TSQLRecord Change Tracking
Objects Time Machine
Database.TrackChanges([TSQLInvoice]);
aInvoice := TSQLInvoice.Create;
aHist := TSQLRecordHistory.CreateHistory(
aClient,TSQLInvoice,400);
try
writeln('History Count: ',aHist.HistoryCount);
for i := 0 to aHist.HistoryCount-1 do begin
aHist.HistoryGet(i,aEvent,aTimeStamp,aInvoice);
writeln;
writeln('Event: ',ord(aEvent))^);
writeln('TimeStamp: ',TTimeLogBits(aTimeStamp).ToText);
writeln('Identifier: ',aInvoice.Number);
end;
BATCH
Send all modifications at once
“Unit of Work” pattern
Array Binding or Multiple INSERT
Huge performance boost
Sample 15
SOA
Interface-based services
Design by contract
Factories
Instances live mode
REST UTF-8 JSON Security
Thread safety
SOA
Define the contract
type
ICalculator = interface(IInvokable)
['{9A60C8ED-CEB2-4E09-87D4-4A16F496E5FE}']
/// add two signed 32 bit integers
function Add(n1,n2: integer): integer;
end;
SOA
Implement the contract
type
TServiceCalculator = class(TInterfacedObject, ICalculator)
public
function Add(n1,n2: integer): integer;
end;
function TServiceCalculator.Add(n1, n2: integer): integer;
begin
result := n1+n2;
end;
SOA
Publish the contract on the Server Side
RestServer.ServiceRegister(
TServiceCalculator,[TypeInfo(ICalculator)],sicShared);
Define the contract on the Client Side
RestServer.ServiceRegister(
[TypeInfo(ICalculator)],sicShared);
SOA
Use the service
var I: ICalculator;
begin
I := Rest.Services<ICalculator>;
if I<>nil then
result := I.Add(10,20);
end;
var I: ICalculator; // for older versions of Delphi
begin
if Rest.Services['Calculator'].Get(I) then
result := I.Add(10,20);
end;
On both client and server sides
Sample 14
Real Time Features
Real Time Notifications
Via WebSockets
Real Time Features
Real Time Notifications
Via WebSockets
Data Replication
Master / Slave
Event-Driven
Asynchronous callbacks
Data Replication
On Demand Master / Slave
Master
Slave
MasterServer
(MasterModel)
master.db3
MasterClient
(MasterModel)
HTTP
SlaveServer
(SlaveModel)
On Demand
Replication
slave.db3
Data Replication
Real Time Master / Slave
Master
Slave
MasterServer
(MasterModel)
master.db3
MasterClient
(MasterModel)
WebSockets
TCP/IP
SlaveServer
(SlaveModel)
Replication
slave.db3
Data Replication
Multi Offices Synch
Main Office
Office A Office B
Main
Server
External DB
Local
Server A
HTTP
Local
Server B
HTTP
Client 1 Client 2 Client 3
local
network
Client 1 Client 2 Client 3 Client 4
local
network
Data Replication
Multi Offices Synch
Main Office
Office A Office B
Main
Server
Local Data A
Reference
Read Only
Local Data B
Reference
Read Only
Local Data A
Business
Read/Write
Replication
Local Data B
Business
Read Only
Local Data A
Business
Read Only
Replication
Local Data B
Business
Read/Write
Real Time Features
Event-Driven
Asynchronous callbacks
Interface-based services callbacks
Bi-directional connection via WebSockets
using application-level protocols
Security, frame gathering, REST emulation
Event-Driven
Asynchronous callbacks
Interface-based services callbacks
ILongWorkCallback = interface(IInvokable)
['{425BF199-19C7-4B2B-B1A4-A5BE7A9A4748}']
procedure WorkFinished(const workName: string; timeTaken: integer);
procedure WorkFailed(const workName, error: string);
end;
ILongWorkService = interface(IInvokable)
['{09FDFCEF-86E5-4077-80D8-661801A9224A}']
procedure StartWork(const workName: string; const onFinish: ILongWorkCallback);
function TotalWorkCount: Integer;
end;
Event-Driven
Asynchronous callbacks
Interface-based services callbacks
Publisher
Subscriber 1
Event
Subscriber 2
Event
Subscriber 3
Sample 31
MVC/MVVM
Auto Generated UI
Dynamic Web Sites
Web Apps
Classic MVC
Web Apps
Model
View
Controller
ORM
Mustache
IMVCApplication
Classic MVC
Web Apps
Model
View
Controller
MVCModel.pas
*.html
MVCViewModel.pas
Blog MVC Sample
Web Apps
Implement a Controller
method name → page name
var const params → URI params
var out params → Mustache context
Web Apps
Implement a Controller
procedure TBlogApplication.AuthorView(var ID: integer;
out Author: TSQLAuthor; out Articles: variant);
begin
RestModel.Retrieve(ID,Author);
Author.HashedPassword := ''; // no need to publish it
if Author.ID<>0 then
Articles := RestModel.RetrieveDocVariantArray(
TSQLArticle,'','Author=? order by RowId desc limit
50',[ID],ARTICLE_FIELDS) else
raise EMVCApplication.CreateGotoError(HTML_NOTFOUND);
End;
→ /blog/AuthorView?....
Web Apps
Implement a Controller
procedure TBlogApplication.AuthorView(var ID: integer;
out Author: TSQLAuthor; out Articles: variant);
http://localhost:8092/blog/mvc-info
→ /blog/AuthorView?ID=..[integer]..
{{Main}}: variant
{{ID}}: integer
{{Author}}: TSQLAuthor
{{Articles}}: variant
Web Apps
/blog/AuthorView?ID=123
procedure TBlogApplication.AuthorView(var ID: integer;
out Author: TSQLAuthor; out Articles: variant);
begin
→ ID = 123
RestModel.Retrieve(ID,Author);
Author.HashedPassword := ''; // no need to publish it
if Author.ID<>0 then
Articles := RestModel.RetrieveDocVariantArray(
TSQLArticle,'','Author=? order by RowId desc limit
50',[ID],ARTICLE_FIELDS) else
raise EMVCApplication.CreateGotoError(HTML_NOTFOUND);
end;
Web Apps
Mustache Data Context
procedure TBlogApplication.AuthorView(var ID: integer;
out Author: TSQLAuthor; out Articles: variant);
begin
RestModel.Retrieve(ID,Author);
Author.HashedPassword := ''; // no need to publish it
if Author.ID<>0 then
Articles := RestModel.RetrieveDocVariantArray(
TSQLArticle,'','Author=? order by RowId desc limit
50',[ID],ARTICLE_FIELDS) else
raise EMVCApplication.CreateGotoError(HTML_NOTFOUND);
end;
{{ID}} {{Author}} {{Articles}}
Sample 30
Web Apps
Sample 30
http://localhost:8092/blog/default
http://localhost:8092/blog/mvc-info
http://localhost:8092/blog/articleView?id=99
http://localhost:8092/blog/articleView/json?id=99
http://localhost:8092/blog/authorView?id=1
mORMot & Friends
Open Source
Architecture & Design
Cross-Cutting features
DB Layer
ORM/ODM/SOA/MVC
Cross platform
Q&A
Server
Delphi
Win32 Win64
10.2 10.1 XE8 XE7 XE6 XE5 XE4 XE3
XE2 XE 2010 2009 2007 2005 7 6
FPC
Win32 Linux-x86 Linux-ARM
3.0.x + 3.1.x (trunk)
Clients
Delphi
Win32 Win64 OSX Android iOS
10.2 10.1 XE8 XE7 XE6 XE5 XE4 XE3
XE2 XE 2010 2009 2007 2005 7 6 5
FPC
All platforms
2.6.x 3.x.x
Clients
Smart Mobile Studio 2.2
HTML5
Mobile / PhoneGap
any REST JSON Client
AJAX C# Java Python…
Sample 27
Sample 27
Project14ServerHttpWrapper
http://localhost:888/root/wrapper/
+ SMS Project14Client
RegressionTests + LogView server
RegressionTestsServer + SMS Sample 29
mORMot & Friends
Open Source
Architecture & Design
Cross-Cutting features
DB Layer
ORM/ODM/SOA/MVC
Cross platform
Q&A

Más contenido relacionado

La actualidad más candente

La actualidad más candente (20)

exposé en HTML
exposé en HTMLexposé en HTML
exposé en HTML
 
Support de cours technologie et application m.youssfi
Support de cours technologie et application m.youssfiSupport de cours technologie et application m.youssfi
Support de cours technologie et application m.youssfi
 
Spring mvc
Spring mvcSpring mvc
Spring mvc
 
Support de Cours JSF2 Première partie Intégration avec Spring
Support de Cours JSF2 Première partie Intégration avec SpringSupport de Cours JSF2 Première partie Intégration avec Spring
Support de Cours JSF2 Première partie Intégration avec Spring
 
Spring MVC Framework
Spring MVC FrameworkSpring MVC Framework
Spring MVC Framework
 
What Is Express JS?
What Is Express JS?What Is Express JS?
What Is Express JS?
 
Tp3 - Application SOA avec BPEL
Tp3 - Application SOA avec BPELTp3 - Application SOA avec BPEL
Tp3 - Application SOA avec BPEL
 
Présentation de JEE et de son écosysteme
Présentation de JEE et de son écosystemePrésentation de JEE et de son écosysteme
Présentation de JEE et de son écosysteme
 
Mohamed youssfi support architectures logicielles distribuées basées sue les ...
Mohamed youssfi support architectures logicielles distribuées basées sue les ...Mohamed youssfi support architectures logicielles distribuées basées sue les ...
Mohamed youssfi support architectures logicielles distribuées basées sue les ...
 
Support de cours entrepise java beans ejb m.youssfi
Support de cours entrepise java beans ejb m.youssfiSupport de cours entrepise java beans ejb m.youssfi
Support de cours entrepise java beans ejb m.youssfi
 
2. Introduction-to-MSSQL-Server.pptx
2. Introduction-to-MSSQL-Server.pptx2. Introduction-to-MSSQL-Server.pptx
2. Introduction-to-MSSQL-Server.pptx
 
Support Java Avancé Troisième Partie
Support Java Avancé Troisième PartieSupport Java Avancé Troisième Partie
Support Java Avancé Troisième Partie
 
patron de conception
patron de conception patron de conception
patron de conception
 
Cours design pattern m youssfi partie 5 adapter
Cours design pattern m youssfi partie 5 adapterCours design pattern m youssfi partie 5 adapter
Cours design pattern m youssfi partie 5 adapter
 
WEB SERVICE SOAP, JAVA, XML, JAXWS
WEB SERVICE SOAP, JAVA, XML, JAXWSWEB SERVICE SOAP, JAVA, XML, JAXWS
WEB SERVICE SOAP, JAVA, XML, JAXWS
 
Why is TDD so hard for Data Engineering and Analytics Projects?
Why is TDD so hard for Data Engineering and Analytics Projects?Why is TDD so hard for Data Engineering and Analytics Projects?
Why is TDD so hard for Data Engineering and Analytics Projects?
 
Base de données distribuée
Base de données distribuéeBase de données distribuée
Base de données distribuée
 
Soa & services web
Soa & services webSoa & services web
Soa & services web
 
Développement d'un site web jee de e commerce basé sur spring (m.youssfi)
Développement d'un site web jee de e commerce basé sur spring (m.youssfi)Développement d'un site web jee de e commerce basé sur spring (m.youssfi)
Développement d'un site web jee de e commerce basé sur spring (m.youssfi)
 
DDD with Behat
DDD with BehatDDD with Behat
DDD with Behat
 

Similar a 2016 mORMot

Web Development Environments: Choose the best or go with the rest
Web Development Environments:  Choose the best or go with the restWeb Development Environments:  Choose the best or go with the rest
Web Development Environments: Choose the best or go with the rest
george.james
 
Visual Studio .NET2010
Visual Studio .NET2010Visual Studio .NET2010
Visual Studio .NET2010
Satish Verma
 
SD, a P2P bug tracking system
SD, a P2P bug tracking systemSD, a P2P bug tracking system
SD, a P2P bug tracking system
Jesse Vincent
 
Dot netsupport in alpha five v11 coming soon
Dot netsupport in alpha five v11 coming soonDot netsupport in alpha five v11 coming soon
Dot netsupport in alpha five v11 coming soon
Richard Rabins
 

Similar a 2016 mORMot (20)

Delphi ORM SOA MVC SQL NoSQL JSON REST mORMot
Delphi ORM SOA MVC SQL NoSQL JSON REST mORMotDelphi ORM SOA MVC SQL NoSQL JSON REST mORMot
Delphi ORM SOA MVC SQL NoSQL JSON REST mORMot
 
Web Development Environments: Choose the best or go with the rest
Web Development Environments:  Choose the best or go with the restWeb Development Environments:  Choose the best or go with the rest
Web Development Environments: Choose the best or go with the rest
 
node.js: Javascript's in your backend
node.js: Javascript's in your backendnode.js: Javascript's in your backend
node.js: Javascript's in your backend
 
NDC Sydney 2019 - Microservices for building an IDE – The innards of JetBrain...
NDC Sydney 2019 - Microservices for building an IDE – The innards of JetBrain...NDC Sydney 2019 - Microservices for building an IDE – The innards of JetBrain...
NDC Sydney 2019 - Microservices for building an IDE – The innards of JetBrain...
 
ODF Mashups
ODF MashupsODF Mashups
ODF Mashups
 
ConFoo Montreal - Microservices for building an IDE - The innards of JetBrain...
ConFoo Montreal - Microservices for building an IDE - The innards of JetBrain...ConFoo Montreal - Microservices for building an IDE - The innards of JetBrain...
ConFoo Montreal - Microservices for building an IDE - The innards of JetBrain...
 
All aboard the NodeJS Express
All aboard the NodeJS ExpressAll aboard the NodeJS Express
All aboard the NodeJS Express
 
Visual Studio .NET2010
Visual Studio .NET2010Visual Studio .NET2010
Visual Studio .NET2010
 
Apidays Paris 2023 - Forget TypeScript, Choose Rust to build Robust, Fast and...
Apidays Paris 2023 - Forget TypeScript, Choose Rust to build Robust, Fast and...Apidays Paris 2023 - Forget TypeScript, Choose Rust to build Robust, Fast and...
Apidays Paris 2023 - Forget TypeScript, Choose Rust to build Robust, Fast and...
 
Bottom-Line Web Services
Bottom-Line Web ServicesBottom-Line Web Services
Bottom-Line Web Services
 
Node.js: The What, The How and The When
Node.js: The What, The How and The WhenNode.js: The What, The How and The When
Node.js: The What, The How and The When
 
Terraform
TerraformTerraform
Terraform
 
Works with persistent graphs using OrientDB
Works with persistent graphs using OrientDB Works with persistent graphs using OrientDB
Works with persistent graphs using OrientDB
 
Avro
AvroAvro
Avro
 
Distributed Systems: How to connect your real-time applications
Distributed Systems: How to connect your real-time applicationsDistributed Systems: How to connect your real-time applications
Distributed Systems: How to connect your real-time applications
 
SD, a P2P bug tracking system
SD, a P2P bug tracking systemSD, a P2P bug tracking system
SD, a P2P bug tracking system
 
Mark Rendle ".NET Is Dead. Long Live .NET!"
Mark Rendle ".NET Is Dead. Long Live .NET!"Mark Rendle ".NET Is Dead. Long Live .NET!"
Mark Rendle ".NET Is Dead. Long Live .NET!"
 
OrientDB for real & Web App development
OrientDB for real & Web App developmentOrientDB for real & Web App development
OrientDB for real & Web App development
 
Edge of the Web
Edge of the WebEdge of the Web
Edge of the Web
 
Dot netsupport in alpha five v11 coming soon
Dot netsupport in alpha five v11 coming soonDot netsupport in alpha five v11 coming soon
Dot netsupport in alpha five v11 coming soon
 

Más de Arnaud Bouchez

Más de Arnaud Bouchez (20)

EKON27-FrameworksTuning.pdf
EKON27-FrameworksTuning.pdfEKON27-FrameworksTuning.pdf
EKON27-FrameworksTuning.pdf
 
EKON27-FrameworksExpressiveness.pdf
EKON27-FrameworksExpressiveness.pdfEKON27-FrameworksExpressiveness.pdf
EKON27-FrameworksExpressiveness.pdf
 
Ekon25 mORMot 2 Server-Side Notifications
Ekon25 mORMot 2 Server-Side NotificationsEkon25 mORMot 2 Server-Side Notifications
Ekon25 mORMot 2 Server-Side Notifications
 
Ekon25 mORMot 2 Cryptography
Ekon25 mORMot 2 CryptographyEkon25 mORMot 2 Cryptography
Ekon25 mORMot 2 Cryptography
 
Ekon24 from Delphi to AVX2
Ekon24 from Delphi to AVX2Ekon24 from Delphi to AVX2
Ekon24 from Delphi to AVX2
 
Ekon24 mORMot 2
Ekon24 mORMot 2Ekon24 mORMot 2
Ekon24 mORMot 2
 
Ekon23 (2) Kingdom-Driven-Design applied to Social Media with mORMot
Ekon23 (2) Kingdom-Driven-Design applied to Social Media with mORMotEkon23 (2) Kingdom-Driven-Design applied to Social Media with mORMot
Ekon23 (2) Kingdom-Driven-Design applied to Social Media with mORMot
 
Ekon23 (1) Kingdom-Driven-Design
Ekon23 (1) Kingdom-Driven-DesignEkon23 (1) Kingdom-Driven-Design
Ekon23 (1) Kingdom-Driven-Design
 
High Performance Object Pascal Code on Servers (at EKON 22)
High Performance Object Pascal Code on Servers (at EKON 22)High Performance Object Pascal Code on Servers (at EKON 22)
High Performance Object Pascal Code on Servers (at EKON 22)
 
Object Pascal Clean Code Guidelines Proposal (at EKON 22)
Object Pascal Clean Code Guidelines Proposal (at EKON 22)Object Pascal Clean Code Guidelines Proposal (at EKON 22)
Object Pascal Clean Code Guidelines Proposal (at EKON 22)
 
Ekon21 Microservices - SOLID Meets SOA
Ekon21 Microservices - SOLID Meets SOAEkon21 Microservices - SOLID Meets SOA
Ekon21 Microservices - SOLID Meets SOA
 
Ekon21 Microservices - Event Driven Design
Ekon21 Microservices - Event Driven DesignEkon21 Microservices - Event Driven Design
Ekon21 Microservices - Event Driven Design
 
Ekon20 mORMot WorkShop Delphi
Ekon20 mORMot WorkShop DelphiEkon20 mORMot WorkShop Delphi
Ekon20 mORMot WorkShop Delphi
 
Ekon20 mORMot SOA Delphi Conference
Ekon20 mORMot SOA Delphi Conference Ekon20 mORMot SOA Delphi Conference
Ekon20 mORMot SOA Delphi Conference
 
Ekon20 mORMot Legacy Code Technical Debt Delphi Conference
Ekon20 mORMot Legacy Code Technical Debt Delphi Conference Ekon20 mORMot Legacy Code Technical Debt Delphi Conference
Ekon20 mORMot Legacy Code Technical Debt Delphi Conference
 
A1 from n tier to soa
A1 from n tier to soaA1 from n tier to soa
A1 from n tier to soa
 
D1 from interfaces to solid
D1 from interfaces to solidD1 from interfaces to solid
D1 from interfaces to solid
 
A3 from sql to orm
A3 from sql to ormA3 from sql to orm
A3 from sql to orm
 
A2 from soap to rest
A2 from soap to restA2 from soap to rest
A2 from soap to rest
 
D2 domain driven-design
D2 domain driven-designD2 domain driven-design
D2 domain driven-design
 

Último

Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
chiefasafspells
 
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
VictoriaMetrics
 

Último (20)

WSO2CON 2024 Slides - Open Source to SaaS
WSO2CON 2024 Slides - Open Source to SaaSWSO2CON 2024 Slides - Open Source to SaaS
WSO2CON 2024 Slides - Open Source to SaaS
 
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...
 
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
 
WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?
 
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
 
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
 
What Goes Wrong with Language Definitions and How to Improve the Situation
What Goes Wrong with Language Definitions and How to Improve the SituationWhat Goes Wrong with Language Definitions and How to Improve the Situation
What Goes Wrong with Language Definitions and How to Improve the Situation
 
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
 
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareAnnouncing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK Software
 
WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...
WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...
WSO2CON 2024 - Navigating API Complexity: REST, GraphQL, gRPC, Websocket, Web...
 
WSO2CON 2024 - How to Run a Security Program
WSO2CON 2024 - How to Run a Security ProgramWSO2CON 2024 - How to Run a Security Program
WSO2CON 2024 - How to Run a Security Program
 
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand
 
WSO2Con2024 - From Blueprint to Brilliance: WSO2's Guide to API-First Enginee...
WSO2Con2024 - From Blueprint to Brilliance: WSO2's Guide to API-First Enginee...WSO2Con2024 - From Blueprint to Brilliance: WSO2's Guide to API-First Enginee...
WSO2Con2024 - From Blueprint to Brilliance: WSO2's Guide to API-First Enginee...
 
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
 
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
%in Rustenburg+277-882-255-28 abortion pills for sale in Rustenburg
 
WSO2CON 2024 Slides - Unlocking Value with AI
WSO2CON 2024 Slides - Unlocking Value with AIWSO2CON 2024 Slides - Unlocking Value with AI
WSO2CON 2024 Slides - Unlocking Value with AI
 
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
 
BUS PASS MANGEMENT SYSTEM USING PHP.pptx
BUS PASS MANGEMENT SYSTEM USING PHP.pptxBUS PASS MANGEMENT SYSTEM USING PHP.pptx
BUS PASS MANGEMENT SYSTEM USING PHP.pptx
 
WSO2Con204 - Hard Rock Presentation - Keynote
WSO2Con204 - Hard Rock Presentation - KeynoteWSO2Con204 - Hard Rock Presentation - Keynote
WSO2Con204 - Hard Rock Presentation - Keynote
 

2016 mORMot