SlideShare une entreprise Scribd logo
1  sur  31
Achieve the norm with Idiorm
Stipe Predanić
University of Applied sciences, Zagreb
Old school (Beginner)
Beginner+
Mysqli (native extension)
● PRO
– Fast
● CON
– Hand written queries
– Rewriting all DB calls when changing database
– Not OO friendly
– Manual track of inserts and updates
Beginner++
PDO
● PRO
– Lightweight, consistent
– Can connect to different databases
– Prepared statements
– Better security through named parameters (escaped by PDO)
● CON
– still hand written SQL (different vendors have different dialects)
– still no good OO support
What about OO?
Yes, really, what about OO?
ORM
● Object relation mapping
– Object properties and their relationships are preserved
when saving to database and on load back from DB
● In short:
– Data from database table(s) are mapped to a class
– Data from classes are mapped to database table
ORM
● ORM does all the heavy lifting when working with databases
– Programmer just uses objects
● Searching, updating, deleting are done by simple commands
instead of using SQL
● ORM gives persistency to objects.
● Most PHP ORMs use PDO in the background
ORM OO patterns
● Active Record
– In-memory object carries both data and the functions
needed to work with database
● Data Mapper
– In-memory object just represents data
– Additional Mapper is used to separate database and
objects, and connects them
● One Mapper can work with several classes
ORM OO patterns
Active Records Data Mapper
ORM OO patterns use
● Active record
– Mostly used when object represents one or a few tables
in DB
● Database mindset
● CRUD
● Data mapper
– Mostly used when object is scattered in several tables
in DB
PHP ORMs
● Active Record
– Eloquent (Laravel)
– Doctrine 1
– DataMapper ORM library (CodeIgniter)
– Propel
● Data Mapper
– Doctrine 2
Eloquent
Direct examples from Eloquent documentation: http://laravel.com/docs/5.1/eloquent
Eloquent
● Eloquent supports relationships and can query according
to them
Eloquent & Laravel
● Neatly coupled
● Schema Builder
– Migrations
Doctrine 2
Direct examples from Doctrine documentation: http://doctrine-orm.readthedocs.org/
Doctrine 2
Direct examples from Doctrine documentation: http://doctrine-orm.readthedocs.org/
Doctrine 2
● Has relationships and way more
● Slightly higher learning curve
● But blazing fast for an ORM
Idiorm
● Idiorm is a deliberetely simple ORM
– Micro-ORM
– Pareto Principle
● 80% of the effects come from 20% of the causes
● Idiorm has only one class called ORM
● Uses PDO
● IS NOT A FULL ACTIVE RECORD ORM
Idiorm
Example of simple select, update, insert and delete
Idiorm configuration
Idiorm querying
Idiorm ORM object
Idiorm – how to get data out
Idiorm querying cont.
Taken from documentation: https://idiorm.readthedocs.org/en/latest/querying.html
Getting many in an array
Getting many in ORM objects
Idiorm - joins
● Joins are ... clunky
From documentation
Idiorm – Active Record
● There is an Active Record implementation based on Idiorm
called Paris
From documentation
Conclusion
● Use ORM
– Any ORM
● Just use it
● If a programmer is experienced and uses a framework –
that framework probably uses some kind of an ORM
● Almost all of them are great!
Conclusion
● Idiorm is great for
– Beginners who are used to think about tables and joins
through SQL
● Usually brainwashed students
– Small projects where no special set-up is wanted or
needed
– For old projects which still uses MySQL statements, as
Idiorm is a simple drop-in solution

Contenu connexe

Tendances

Object Oriented Programming Principles
Object Oriented Programming PrinciplesObject Oriented Programming Principles
Object Oriented Programming PrinciplesAndrew Ferlitsch
 
CS4443 - Modern Programming Language I
CS4443 - Modern Programming Language ICS4443 - Modern Programming Language I
CS4443 - Modern Programming Language IDilawar Khan
 
Java Memory (Consistency) Model - Polish JUG One Beer Talk #2
Java Memory (Consistency) Model - Polish JUG One Beer Talk #2Java Memory (Consistency) Model - Polish JUG One Beer Talk #2
Java Memory (Consistency) Model - Polish JUG One Beer Talk #2Tomek Borek
 
Paython courses in pune ppt
Paython courses in pune pptPaython courses in pune ppt
Paython courses in pune pptsambhajimeher
 

Tendances (7)

Object Oriented Programming Principles
Object Oriented Programming PrinciplesObject Oriented Programming Principles
Object Oriented Programming Principles
 
OOP Java
OOP JavaOOP Java
OOP Java
 
ANTLR4 in depth
ANTLR4 in depthANTLR4 in depth
ANTLR4 in depth
 
CS4443 - Modern Programming Language I
CS4443 - Modern Programming Language ICS4443 - Modern Programming Language I
CS4443 - Modern Programming Language I
 
Java Memory (Consistency) Model - Polish JUG One Beer Talk #2
Java Memory (Consistency) Model - Polish JUG One Beer Talk #2Java Memory (Consistency) Model - Polish JUG One Beer Talk #2
Java Memory (Consistency) Model - Polish JUG One Beer Talk #2
 
Introduction to oop
Introduction to oopIntroduction to oop
Introduction to oop
 
Paython courses in pune ppt
Paython courses in pune pptPaython courses in pune ppt
Paython courses in pune ppt
 

Similaire à Achieve the norm with Idiorm

Object Relational Mapping with Dapper (Micro ORM)
Object Relational Mapping with Dapper (Micro ORM)Object Relational Mapping with Dapper (Micro ORM)
Object Relational Mapping with Dapper (Micro ORM)Muhammad Umar
 
Introduction to SQL Alchemy - SyPy June 2013
Introduction to SQL Alchemy - SyPy June 2013Introduction to SQL Alchemy - SyPy June 2013
Introduction to SQL Alchemy - SyPy June 2013Roger Barnes
 
Doctrine 2 - Enterprise Persistence Layer For PHP
Doctrine 2 - Enterprise Persistence Layer For PHPDoctrine 2 - Enterprise Persistence Layer For PHP
Doctrine 2 - Enterprise Persistence Layer For PHPJonathan Wage
 
Introduction to Object-Relational Mapping
Introduction to Object-Relational MappingIntroduction to Object-Relational Mapping
Introduction to Object-Relational MappingAli Shakiba
 
Doctrine Project
Doctrine ProjectDoctrine Project
Doctrine ProjectDaniel Lima
 
Graph databases in computational bioloby: case of neo4j and TitanDB
Graph databases in computational bioloby: case of neo4j and TitanDBGraph databases in computational bioloby: case of neo4j and TitanDB
Graph databases in computational bioloby: case of neo4j and TitanDBAndrei KUCHARAVY
 
Hashicorp-Terraform-Deep-Dive-with-no-Fear-Victor-Turbinsky-Texuna.pdf
Hashicorp-Terraform-Deep-Dive-with-no-Fear-Victor-Turbinsky-Texuna.pdfHashicorp-Terraform-Deep-Dive-with-no-Fear-Victor-Turbinsky-Texuna.pdf
Hashicorp-Terraform-Deep-Dive-with-no-Fear-Victor-Turbinsky-Texuna.pdfssuser705051
 
Repeating History...On Purpose...with Elixir
Repeating History...On Purpose...with ElixirRepeating History...On Purpose...with Elixir
Repeating History...On Purpose...with ElixirBarry Jones
 
Interop 2015: Hardly Enough Theory, Barley Enough Code
Interop 2015: Hardly Enough Theory, Barley Enough CodeInterop 2015: Hardly Enough Theory, Barley Enough Code
Interop 2015: Hardly Enough Theory, Barley Enough CodeJeremy Schulman
 
Reactive Software Systems
Reactive Software SystemsReactive Software Systems
Reactive Software SystemsBehrad Zari
 
New Persistence Features in Spring Roo 1.1
New Persistence Features in Spring Roo 1.1New Persistence Features in Spring Roo 1.1
New Persistence Features in Spring Roo 1.1Stefan Schmidt
 
Entity framework introduction sesion-1
Entity framework introduction   sesion-1Entity framework introduction   sesion-1
Entity framework introduction sesion-1Usama Nada
 

Similaire à Achieve the norm with Idiorm (20)

Object Relational Mapping with Dapper (Micro ORM)
Object Relational Mapping with Dapper (Micro ORM)Object Relational Mapping with Dapper (Micro ORM)
Object Relational Mapping with Dapper (Micro ORM)
 
Introduction to SQL Alchemy - SyPy June 2013
Introduction to SQL Alchemy - SyPy June 2013Introduction to SQL Alchemy - SyPy June 2013
Introduction to SQL Alchemy - SyPy June 2013
 
Doctrine2
Doctrine2Doctrine2
Doctrine2
 
Doctrine2 enterpice
Doctrine2 enterpiceDoctrine2 enterpice
Doctrine2 enterpice
 
Doctrine 2 - Enterprise Persistence Layer For PHP
Doctrine 2 - Enterprise Persistence Layer For PHPDoctrine 2 - Enterprise Persistence Layer For PHP
Doctrine 2 - Enterprise Persistence Layer For PHP
 
Introduction to Object-Relational Mapping
Introduction to Object-Relational MappingIntroduction to Object-Relational Mapping
Introduction to Object-Relational Mapping
 
Protocol buffers
Protocol buffersProtocol buffers
Protocol buffers
 
Doctrine Project
Doctrine ProjectDoctrine Project
Doctrine Project
 
Graph databases in computational bioloby: case of neo4j and TitanDB
Graph databases in computational bioloby: case of neo4j and TitanDBGraph databases in computational bioloby: case of neo4j and TitanDB
Graph databases in computational bioloby: case of neo4j and TitanDB
 
Hashicorp-Terraform-Deep-Dive-with-no-Fear-Victor-Turbinsky-Texuna.pdf
Hashicorp-Terraform-Deep-Dive-with-no-Fear-Victor-Turbinsky-Texuna.pdfHashicorp-Terraform-Deep-Dive-with-no-Fear-Victor-Turbinsky-Texuna.pdf
Hashicorp-Terraform-Deep-Dive-with-no-Fear-Victor-Turbinsky-Texuna.pdf
 
Terraform-2.pdf
Terraform-2.pdfTerraform-2.pdf
Terraform-2.pdf
 
Introduction To Pentaho Kettle
Introduction To Pentaho KettleIntroduction To Pentaho Kettle
Introduction To Pentaho Kettle
 
Repeating History...On Purpose...with Elixir
Repeating History...On Purpose...with ElixirRepeating History...On Purpose...with Elixir
Repeating History...On Purpose...with Elixir
 
Interop 2015: Hardly Enough Theory, Barley Enough Code
Interop 2015: Hardly Enough Theory, Barley Enough CodeInterop 2015: Hardly Enough Theory, Barley Enough Code
Interop 2015: Hardly Enough Theory, Barley Enough Code
 
Reactive Software Systems
Reactive Software SystemsReactive Software Systems
Reactive Software Systems
 
Tori ORM for PyCon 2014
Tori ORM for PyCon 2014Tori ORM for PyCon 2014
Tori ORM for PyCon 2014
 
New Persistence Features in Spring Roo 1.1
New Persistence Features in Spring Roo 1.1New Persistence Features in Spring Roo 1.1
New Persistence Features in Spring Roo 1.1
 
Are we there yet?
Are we there yet?Are we there yet?
Are we there yet?
 
Entity framework introduction sesion-1
Entity framework introduction   sesion-1Entity framework introduction   sesion-1
Entity framework introduction sesion-1
 
ORMs Meet SQL
ORMs Meet SQLORMs Meet SQL
ORMs Meet SQL
 

Plus de Stipe Predanic

Osnove bežičnih mreža - Predavanje: Topologije
Osnove bežičnih mreža - Predavanje: TopologijeOsnove bežičnih mreža - Predavanje: Topologije
Osnove bežičnih mreža - Predavanje: TopologijeStipe Predanic
 
Osnove bežičnih mreža - Predavanje 4: 802.11 protokoli
Osnove bežičnih mreža - Predavanje 4: 802.11 protokoli Osnove bežičnih mreža - Predavanje 4: 802.11 protokoli
Osnove bežičnih mreža - Predavanje 4: 802.11 protokoli Stipe Predanic
 
Osnove bežičnih mreža - Predavanje: Antene
Osnove bežičnih mreža - Predavanje: AnteneOsnove bežičnih mreža - Predavanje: Antene
Osnove bežičnih mreža - Predavanje: AnteneStipe Predanic
 
Osnove bežičnih mreža - Predavanje Bežične radiokomunikacije
Osnove bežičnih mreža - Predavanje Bežične radiokomunikacijeOsnove bežičnih mreža - Predavanje Bežične radiokomunikacije
Osnove bežičnih mreža - Predavanje Bežične radiokomunikacijeStipe Predanic
 
[ERRO] Predavanje: FPGA 12.1.2017
[ERRO] Predavanje: FPGA 12.1.2017 [ERRO] Predavanje: FPGA 12.1.2017
[ERRO] Predavanje: FPGA 12.1.2017 Stipe Predanic
 
[ERRO] Predavanje: 8 i 32 bitni mikroupravljači/mikroprocesori 15.12.2016
[ERRO] Predavanje: 8 i 32 bitni mikroupravljači/mikroprocesori 15.12.2016 [ERRO] Predavanje: 8 i 32 bitni mikroupravljači/mikroprocesori 15.12.2016
[ERRO] Predavanje: 8 i 32 bitni mikroupravljači/mikroprocesori 15.12.2016 Stipe Predanic
 
[ERRO] Predavanje: Komunikacija s mikroupravljačem 8.12.2016
[ERRO] Predavanje: Komunikacija s mikroupravljačem 8.12.2016 [ERRO] Predavanje: Komunikacija s mikroupravljačem 8.12.2016
[ERRO] Predavanje: Komunikacija s mikroupravljačem 8.12.2016 Stipe Predanic
 
[ERRO] Predavanje: Napajanje uređaja 8.12.2016
[ERRO] Predavanje: Napajanje uređaja 8.12.2016 [ERRO] Predavanje: Napajanje uređaja 8.12.2016
[ERRO] Predavanje: Napajanje uređaja 8.12.2016 Stipe Predanic
 
[ERRO] Predavanje: Prikaz podataka 1.12.2016
[ERRO] Predavanje: Prikaz podataka 1.12.2016 [ERRO] Predavanje: Prikaz podataka 1.12.2016
[ERRO] Predavanje: Prikaz podataka 1.12.2016 Stipe Predanic
 
[ERRO] Predavanje: RTOS
[ERRO] Predavanje: RTOS[ERRO] Predavanje: RTOS
[ERRO] Predavanje: RTOSStipe Predanic
 
[ERRO] Predavanje: Porodice mikroupravljača
[ERRO] Predavanje: Porodice mikroupravljača[ERRO] Predavanje: Porodice mikroupravljača
[ERRO] Predavanje: Porodice mikroupravljačaStipe Predanic
 
[ERRO] Predavanje: 8051
[ERRO] Predavanje: 8051 [ERRO] Predavanje: 8051
[ERRO] Predavanje: 8051 Stipe Predanic
 
[ERRO] Predavanje: ulazi/izlazi na mikroupravljač (27.10.2016)
[ERRO] Predavanje: ulazi/izlazi na mikroupravljač (27.10.2016) [ERRO] Predavanje: ulazi/izlazi na mikroupravljač (27.10.2016)
[ERRO] Predavanje: ulazi/izlazi na mikroupravljač (27.10.2016) Stipe Predanic
 
[ERRO] Predavanje: MARIE model procesora
[ERRO] Predavanje: MARIE model procesora [ERRO] Predavanje: MARIE model procesora
[ERRO] Predavanje: MARIE model procesora Stipe Predanic
 
[ERRO] Predavanje: Ponavljanje digitalnih sklopova
[ERRO] Predavanje: Ponavljanje digitalnih sklopova [ERRO] Predavanje: Ponavljanje digitalnih sklopova
[ERRO] Predavanje: Ponavljanje digitalnih sklopova Stipe Predanic
 
[ERRO] Uvodno predavanje (pravila polaganja ispita)
[ERRO] Uvodno predavanje (pravila polaganja ispita) [ERRO] Uvodno predavanje (pravila polaganja ispita)
[ERRO] Uvodno predavanje (pravila polaganja ispita) Stipe Predanic
 
[TVZ računarstvo] Dinamičke web aplikacije, predavanje 12.
[TVZ računarstvo] Dinamičke web aplikacije, predavanje 12. [TVZ računarstvo] Dinamičke web aplikacije, predavanje 12.
[TVZ računarstvo] Dinamičke web aplikacije, predavanje 12. Stipe Predanic
 
[TVZ računarstvo] Dinamičke web aplikacije, predavanje 11.
[TVZ računarstvo] Dinamičke web aplikacije, predavanje 11. [TVZ računarstvo] Dinamičke web aplikacije, predavanje 11.
[TVZ računarstvo] Dinamičke web aplikacije, predavanje 11. Stipe Predanic
 
[TVZ računarstvo] Dinamičke web aplikacije, predavanje 10.
[TVZ računarstvo] Dinamičke web aplikacije, predavanje 10. [TVZ računarstvo] Dinamičke web aplikacije, predavanje 10.
[TVZ računarstvo] Dinamičke web aplikacije, predavanje 10. Stipe Predanic
 
[TVZ računarstvo] Dinamičke web aplikacije, predavanje 9.
[TVZ računarstvo] Dinamičke web aplikacije, predavanje 9. [TVZ računarstvo] Dinamičke web aplikacije, predavanje 9.
[TVZ računarstvo] Dinamičke web aplikacije, predavanje 9. Stipe Predanic
 

Plus de Stipe Predanic (20)

Osnove bežičnih mreža - Predavanje: Topologije
Osnove bežičnih mreža - Predavanje: TopologijeOsnove bežičnih mreža - Predavanje: Topologije
Osnove bežičnih mreža - Predavanje: Topologije
 
Osnove bežičnih mreža - Predavanje 4: 802.11 protokoli
Osnove bežičnih mreža - Predavanje 4: 802.11 protokoli Osnove bežičnih mreža - Predavanje 4: 802.11 protokoli
Osnove bežičnih mreža - Predavanje 4: 802.11 protokoli
 
Osnove bežičnih mreža - Predavanje: Antene
Osnove bežičnih mreža - Predavanje: AnteneOsnove bežičnih mreža - Predavanje: Antene
Osnove bežičnih mreža - Predavanje: Antene
 
Osnove bežičnih mreža - Predavanje Bežične radiokomunikacije
Osnove bežičnih mreža - Predavanje Bežične radiokomunikacijeOsnove bežičnih mreža - Predavanje Bežične radiokomunikacije
Osnove bežičnih mreža - Predavanje Bežične radiokomunikacije
 
[ERRO] Predavanje: FPGA 12.1.2017
[ERRO] Predavanje: FPGA 12.1.2017 [ERRO] Predavanje: FPGA 12.1.2017
[ERRO] Predavanje: FPGA 12.1.2017
 
[ERRO] Predavanje: 8 i 32 bitni mikroupravljači/mikroprocesori 15.12.2016
[ERRO] Predavanje: 8 i 32 bitni mikroupravljači/mikroprocesori 15.12.2016 [ERRO] Predavanje: 8 i 32 bitni mikroupravljači/mikroprocesori 15.12.2016
[ERRO] Predavanje: 8 i 32 bitni mikroupravljači/mikroprocesori 15.12.2016
 
[ERRO] Predavanje: Komunikacija s mikroupravljačem 8.12.2016
[ERRO] Predavanje: Komunikacija s mikroupravljačem 8.12.2016 [ERRO] Predavanje: Komunikacija s mikroupravljačem 8.12.2016
[ERRO] Predavanje: Komunikacija s mikroupravljačem 8.12.2016
 
[ERRO] Predavanje: Napajanje uređaja 8.12.2016
[ERRO] Predavanje: Napajanje uređaja 8.12.2016 [ERRO] Predavanje: Napajanje uređaja 8.12.2016
[ERRO] Predavanje: Napajanje uređaja 8.12.2016
 
[ERRO] Predavanje: Prikaz podataka 1.12.2016
[ERRO] Predavanje: Prikaz podataka 1.12.2016 [ERRO] Predavanje: Prikaz podataka 1.12.2016
[ERRO] Predavanje: Prikaz podataka 1.12.2016
 
[ERRO] Predavanje: RTOS
[ERRO] Predavanje: RTOS[ERRO] Predavanje: RTOS
[ERRO] Predavanje: RTOS
 
[ERRO] Predavanje: Porodice mikroupravljača
[ERRO] Predavanje: Porodice mikroupravljača[ERRO] Predavanje: Porodice mikroupravljača
[ERRO] Predavanje: Porodice mikroupravljača
 
[ERRO] Predavanje: 8051
[ERRO] Predavanje: 8051 [ERRO] Predavanje: 8051
[ERRO] Predavanje: 8051
 
[ERRO] Predavanje: ulazi/izlazi na mikroupravljač (27.10.2016)
[ERRO] Predavanje: ulazi/izlazi na mikroupravljač (27.10.2016) [ERRO] Predavanje: ulazi/izlazi na mikroupravljač (27.10.2016)
[ERRO] Predavanje: ulazi/izlazi na mikroupravljač (27.10.2016)
 
[ERRO] Predavanje: MARIE model procesora
[ERRO] Predavanje: MARIE model procesora [ERRO] Predavanje: MARIE model procesora
[ERRO] Predavanje: MARIE model procesora
 
[ERRO] Predavanje: Ponavljanje digitalnih sklopova
[ERRO] Predavanje: Ponavljanje digitalnih sklopova [ERRO] Predavanje: Ponavljanje digitalnih sklopova
[ERRO] Predavanje: Ponavljanje digitalnih sklopova
 
[ERRO] Uvodno predavanje (pravila polaganja ispita)
[ERRO] Uvodno predavanje (pravila polaganja ispita) [ERRO] Uvodno predavanje (pravila polaganja ispita)
[ERRO] Uvodno predavanje (pravila polaganja ispita)
 
[TVZ računarstvo] Dinamičke web aplikacije, predavanje 12.
[TVZ računarstvo] Dinamičke web aplikacije, predavanje 12. [TVZ računarstvo] Dinamičke web aplikacije, predavanje 12.
[TVZ računarstvo] Dinamičke web aplikacije, predavanje 12.
 
[TVZ računarstvo] Dinamičke web aplikacije, predavanje 11.
[TVZ računarstvo] Dinamičke web aplikacije, predavanje 11. [TVZ računarstvo] Dinamičke web aplikacije, predavanje 11.
[TVZ računarstvo] Dinamičke web aplikacije, predavanje 11.
 
[TVZ računarstvo] Dinamičke web aplikacije, predavanje 10.
[TVZ računarstvo] Dinamičke web aplikacije, predavanje 10. [TVZ računarstvo] Dinamičke web aplikacije, predavanje 10.
[TVZ računarstvo] Dinamičke web aplikacije, predavanje 10.
 
[TVZ računarstvo] Dinamičke web aplikacije, predavanje 9.
[TVZ računarstvo] Dinamičke web aplikacije, predavanje 9. [TVZ računarstvo] Dinamičke web aplikacije, predavanje 9.
[TVZ računarstvo] Dinamičke web aplikacije, predavanje 9.
 

Dernier

Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionDilum Bandara
 
What is Artificial Intelligence?????????
What is Artificial Intelligence?????????What is Artificial Intelligence?????????
What is Artificial Intelligence?????????blackmambaettijean
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxLoriGlavin3
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxLoriGlavin3
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxLoriGlavin3
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfMounikaPolabathina
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxLoriGlavin3
 
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demoHarshalMandlekar2
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxBkGupta21
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 

Dernier (20)

Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An Introduction
 
What is Artificial Intelligence?????????
What is Artificial Intelligence?????????What is Artificial Intelligence?????????
What is Artificial Intelligence?????????
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptxA Deep Dive on Passkeys: FIDO Paris Seminar.pptx
A Deep Dive on Passkeys: FIDO Paris Seminar.pptx
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdf
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
 
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demo
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
unit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptxunit 4 immunoblotting technique complete.pptx
unit 4 immunoblotting technique complete.pptx
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 

Achieve the norm with Idiorm

  • 1. Achieve the norm with Idiorm Stipe Predanić University of Applied sciences, Zagreb
  • 4. Mysqli (native extension) ● PRO – Fast ● CON – Hand written queries – Rewriting all DB calls when changing database – Not OO friendly – Manual track of inserts and updates
  • 6. PDO ● PRO – Lightweight, consistent – Can connect to different databases – Prepared statements – Better security through named parameters (escaped by PDO) ● CON – still hand written SQL (different vendors have different dialects) – still no good OO support
  • 8. Yes, really, what about OO?
  • 9. ORM ● Object relation mapping – Object properties and their relationships are preserved when saving to database and on load back from DB ● In short: – Data from database table(s) are mapped to a class – Data from classes are mapped to database table
  • 10. ORM ● ORM does all the heavy lifting when working with databases – Programmer just uses objects ● Searching, updating, deleting are done by simple commands instead of using SQL ● ORM gives persistency to objects. ● Most PHP ORMs use PDO in the background
  • 11. ORM OO patterns ● Active Record – In-memory object carries both data and the functions needed to work with database ● Data Mapper – In-memory object just represents data – Additional Mapper is used to separate database and objects, and connects them ● One Mapper can work with several classes
  • 12. ORM OO patterns Active Records Data Mapper
  • 13. ORM OO patterns use ● Active record – Mostly used when object represents one or a few tables in DB ● Database mindset ● CRUD ● Data mapper – Mostly used when object is scattered in several tables in DB
  • 14. PHP ORMs ● Active Record – Eloquent (Laravel) – Doctrine 1 – DataMapper ORM library (CodeIgniter) – Propel ● Data Mapper – Doctrine 2
  • 15. Eloquent Direct examples from Eloquent documentation: http://laravel.com/docs/5.1/eloquent
  • 16. Eloquent ● Eloquent supports relationships and can query according to them
  • 17. Eloquent & Laravel ● Neatly coupled ● Schema Builder – Migrations
  • 18. Doctrine 2 Direct examples from Doctrine documentation: http://doctrine-orm.readthedocs.org/
  • 19. Doctrine 2 Direct examples from Doctrine documentation: http://doctrine-orm.readthedocs.org/
  • 20. Doctrine 2 ● Has relationships and way more ● Slightly higher learning curve ● But blazing fast for an ORM
  • 21. Idiorm ● Idiorm is a deliberetely simple ORM – Micro-ORM – Pareto Principle ● 80% of the effects come from 20% of the causes ● Idiorm has only one class called ORM ● Uses PDO ● IS NOT A FULL ACTIVE RECORD ORM
  • 22. Idiorm Example of simple select, update, insert and delete
  • 26. Idiorm – how to get data out
  • 27. Idiorm querying cont. Taken from documentation: https://idiorm.readthedocs.org/en/latest/querying.html Getting many in an array Getting many in ORM objects
  • 28. Idiorm - joins ● Joins are ... clunky From documentation
  • 29. Idiorm – Active Record ● There is an Active Record implementation based on Idiorm called Paris From documentation
  • 30. Conclusion ● Use ORM – Any ORM ● Just use it ● If a programmer is experienced and uses a framework – that framework probably uses some kind of an ORM ● Almost all of them are great!
  • 31. Conclusion ● Idiorm is great for – Beginners who are used to think about tables and joins through SQL ● Usually brainwashed students – Small projects where no special set-up is wanted or needed – For old projects which still uses MySQL statements, as Idiorm is a simple drop-in solution

Notes de l'éditeur

  1. Martin Fowler "Patterns of Enterprise Application Architecture", 2003