SlideShare uma empresa Scribd logo
1 de 14
Quynh Le, PHP Developer swiss IT bridge gmbh www.swissITbridge.ch An approach to implement Model classes in Zend Framework
Agenda ,[object Object],[object Object],[object Object]
Overview ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Patterns ,[object Object],[object Object],[object Object]
Patterns (cont.) ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Patterns (cont.) 2. Active Record class Employee extends ActiveRecord {      //Storage logic methods      public function insert(){}      //Business logic methods      public function calculateAge()      {      } } Pros : - Simple and easy to implement Cons : - Hard to test without database connection - Tight-coupling with Zend_Db_Table - Hard to change data source (Oracle, XML, SOAP, ...)
Patterns (cont.) 3.  Data Mapper (Highly recommended) Separate Business logic & storage logic
Patterns (cont.) 3. Data Mapper (cont.) Patterns: - Lazy loading: Huge data fields, or relation objects - Identity map: Avoid to load the same object twice - Dependency injection: Initialize mapper objects
Patterns (cont.) 3. Data Mapper (cont.) Service Layer:  - Place on the top of Domain Model and Data Mapper - Extend business logic - Forwards calls to Domain Model or Data Mapper
Patterns (cont.) 3. Data Mapper (cont.) Service Layer: 
Patterns (cont.) 3. Data Mapper (cont.) Pros: - Can handle very complex business logic - Parallel implementation - Complete decoupling - Model is not aware of storage - Clean storage interface (implement different storages) - Can test without Database connection Cons: -  Quite much code to write
Patterns (cont.) 3. Data Mapper (cont.) Sample code:
Reference Book: Patterns of Enterprise Application Architecture (Martin Fowler, 2002)
  Thank you

Mais conteúdo relacionado

Destaque

Client Satisfaction as engine of the continuous improvement
Client Satisfaction as engine of the continuous improvementClient Satisfaction as engine of the continuous improvement
Client Satisfaction as engine of the continuous improvementswiss IT bridge
 
Soft factors - Prerequisites of Scrum
Soft factors - Prerequisites of ScrumSoft factors - Prerequisites of Scrum
Soft factors - Prerequisites of Scrumswiss IT bridge
 
Mf Group Rev03
Mf Group Rev03Mf Group Rev03
Mf Group Rev03usagus
 
Dossier de prensa miradas de ciudad
Dossier de prensa miradas de ciudadDossier de prensa miradas de ciudad
Dossier de prensa miradas de ciudadfax2003
 
SIB Microblogging with Yammer
SIB Microblogging with YammerSIB Microblogging with Yammer
SIB Microblogging with Yammerswiss IT bridge
 
Offshoring von Softwareprojekten
Offshoring von SoftwareprojektenOffshoring von Softwareprojekten
Offshoring von Softwareprojektenswiss IT bridge
 
The Challenging Transition of Traditional Roles on the Journey to Scrum
The Challenging Transition of Traditional Roles on the Journey to ScrumThe Challenging Transition of Traditional Roles on the Journey to Scrum
The Challenging Transition of Traditional Roles on the Journey to Scrumswiss IT bridge
 
Nota de prensa exposición "Miradas de Ciudad"
Nota de prensa exposición "Miradas de Ciudad"Nota de prensa exposición "Miradas de Ciudad"
Nota de prensa exposición "Miradas de Ciudad"fax2003
 
Improving your driveway, path or patio.
Improving  your driveway, path or patio.Improving  your driveway, path or patio.
Improving your driveway, path or patio.WrexhamConcreteDesign
 
Fb Nnew Pps
Fb Nnew PpsFb Nnew Pps
Fb Nnew PpsDear CD
 

Destaque (20)

Introduction into GIT
Introduction into GITIntroduction into GIT
Introduction into GIT
 
Client Satisfaction as engine of the continuous improvement
Client Satisfaction as engine of the continuous improvementClient Satisfaction as engine of the continuous improvement
Client Satisfaction as engine of the continuous improvement
 
Soft factors - Prerequisites of Scrum
Soft factors - Prerequisites of ScrumSoft factors - Prerequisites of Scrum
Soft factors - Prerequisites of Scrum
 
Mf Group Rev03
Mf Group Rev03Mf Group Rev03
Mf Group Rev03
 
Dossier de prensa miradas de ciudad
Dossier de prensa miradas de ciudadDossier de prensa miradas de ciudad
Dossier de prensa miradas de ciudad
 
Augmented Reality
Augmented RealityAugmented Reality
Augmented Reality
 
Mobile Project Overview
Mobile Project OverviewMobile Project Overview
Mobile Project Overview
 
SIB Microblogging with Yammer
SIB Microblogging with YammerSIB Microblogging with Yammer
SIB Microblogging with Yammer
 
Offshoring von Softwareprojekten
Offshoring von SoftwareprojektenOffshoring von Softwareprojekten
Offshoring von Softwareprojekten
 
The Challenging Transition of Traditional Roles on the Journey to Scrum
The Challenging Transition of Traditional Roles on the Journey to ScrumThe Challenging Transition of Traditional Roles on the Journey to Scrum
The Challenging Transition of Traditional Roles on the Journey to Scrum
 
Nota de prensa exposición "Miradas de Ciudad"
Nota de prensa exposición "Miradas de Ciudad"Nota de prensa exposición "Miradas de Ciudad"
Nota de prensa exposición "Miradas de Ciudad"
 
Tech tut
Tech tutTech tut
Tech tut
 
Michaelpritchard
MichaelpritchardMichaelpritchard
Michaelpritchard
 
VPN
VPNVPN
VPN
 
Wc Holiday Magazine
Wc Holiday MagazineWc Holiday Magazine
Wc Holiday Magazine
 
Logical vectors
Logical vectorsLogical vectors
Logical vectors
 
Improving your driveway, path or patio.
Improving  your driveway, path or patio.Improving  your driveway, path or patio.
Improving your driveway, path or patio.
 
Lec1
Lec1Lec1
Lec1
 
Fb Nnew Pps
Fb Nnew PpsFb Nnew Pps
Fb Nnew Pps
 
Wc Magazine
Wc MagazineWc Magazine
Wc Magazine
 

Semelhante a An approach to implement model classes in zend

Java Developers, make the database work for you (NLJUG JFall 2010)
Java Developers, make the database work for you (NLJUG JFall 2010)Java Developers, make the database work for you (NLJUG JFall 2010)
Java Developers, make the database work for you (NLJUG JFall 2010)Lucas Jellema
 
Frustration-Reduced Spark: DataFrames and the Spark Time-Series Library
Frustration-Reduced Spark: DataFrames and the Spark Time-Series LibraryFrustration-Reduced Spark: DataFrames and the Spark Time-Series Library
Frustration-Reduced Spark: DataFrames and the Spark Time-Series LibraryIlya Ganelin
 
The two faces of sql parameter sniffing
The two faces of sql parameter sniffingThe two faces of sql parameter sniffing
The two faces of sql parameter sniffingIvo Andreev
 
[DSC Europe 22] Smart approach in development and deployment process for vari...
[DSC Europe 22] Smart approach in development and deployment process for vari...[DSC Europe 22] Smart approach in development and deployment process for vari...
[DSC Europe 22] Smart approach in development and deployment process for vari...DataScienceConferenc1
 
Challenges of Building a First Class SQL-on-Hadoop Engine
Challenges of Building a First Class SQL-on-Hadoop EngineChallenges of Building a First Class SQL-on-Hadoop Engine
Challenges of Building a First Class SQL-on-Hadoop EngineNicolas Morales
 
Why is dev ops for machine learning so different
Why is dev ops for machine learning so differentWhy is dev ops for machine learning so different
Why is dev ops for machine learning so differentRyan Dawson
 
Why is dev ops for machine learning so different - dataxdays
Why is dev ops for machine learning so different  - dataxdaysWhy is dev ops for machine learning so different  - dataxdays
Why is dev ops for machine learning so different - dataxdaysRyan Dawson
 
Quick Guide to Refresh Spark skills
Quick Guide to Refresh Spark skillsQuick Guide to Refresh Spark skills
Quick Guide to Refresh Spark skillsRavindra kumar
 
The way from DB-driven development to DDD
The way from DB-driven development to DDDThe way from DB-driven development to DDD
The way from DB-driven development to DDDProvectus
 
Ado.net & data persistence frameworks
Ado.net & data persistence frameworksAdo.net & data persistence frameworks
Ado.net & data persistence frameworksLuis Goldster
 
Front Range PHP NoSQL Databases
Front Range PHP NoSQL DatabasesFront Range PHP NoSQL Databases
Front Range PHP NoSQL DatabasesJon Meredith
 
Struts 2-overview2
Struts 2-overview2Struts 2-overview2
Struts 2-overview2divzi1913
 
Challenges of Implementing an Advanced SQL Engine on Hadoop
Challenges of Implementing an Advanced SQL Engine on HadoopChallenges of Implementing an Advanced SQL Engine on Hadoop
Challenges of Implementing an Advanced SQL Engine on HadoopDataWorks Summit
 
Open Source Data Services for Strategic SOA utilising WSO2 Data Services Server
Open Source Data Services for Strategic SOA  utilising WSO2 Data Services ServerOpen Source Data Services for Strategic SOA  utilising WSO2 Data Services Server
Open Source Data Services for Strategic SOA utilising WSO2 Data Services Serversumedha.r
 
Open Source Data Services for Strategic SOA utilising WSO2 Data Services Server
Open Source Data Services for Strategic SOA utilising WSO2 Data Services ServerOpen Source Data Services for Strategic SOA utilising WSO2 Data Services Server
Open Source Data Services for Strategic SOA utilising WSO2 Data Services ServerWSO2
 
Frustration-Reduced PySpark: Data engineering with DataFrames
Frustration-Reduced PySpark: Data engineering with DataFramesFrustration-Reduced PySpark: Data engineering with DataFrames
Frustration-Reduced PySpark: Data engineering with DataFramesIlya Ganelin
 

Semelhante a An approach to implement model classes in zend (20)

Java Developers, make the database work for you (NLJUG JFall 2010)
Java Developers, make the database work for you (NLJUG JFall 2010)Java Developers, make the database work for you (NLJUG JFall 2010)
Java Developers, make the database work for you (NLJUG JFall 2010)
 
Frustration-Reduced Spark: DataFrames and the Spark Time-Series Library
Frustration-Reduced Spark: DataFrames and the Spark Time-Series LibraryFrustration-Reduced Spark: DataFrames and the Spark Time-Series Library
Frustration-Reduced Spark: DataFrames and the Spark Time-Series Library
 
The two faces of sql parameter sniffing
The two faces of sql parameter sniffingThe two faces of sql parameter sniffing
The two faces of sql parameter sniffing
 
[DSC Europe 22] Smart approach in development and deployment process for vari...
[DSC Europe 22] Smart approach in development and deployment process for vari...[DSC Europe 22] Smart approach in development and deployment process for vari...
[DSC Europe 22] Smart approach in development and deployment process for vari...
 
L15 Data Source Layer
L15 Data Source LayerL15 Data Source Layer
L15 Data Source Layer
 
L17 Data Source Layer
L17 Data Source LayerL17 Data Source Layer
L17 Data Source Layer
 
Challenges of Building a First Class SQL-on-Hadoop Engine
Challenges of Building a First Class SQL-on-Hadoop EngineChallenges of Building a First Class SQL-on-Hadoop Engine
Challenges of Building a First Class SQL-on-Hadoop Engine
 
Why is dev ops for machine learning so different
Why is dev ops for machine learning so differentWhy is dev ops for machine learning so different
Why is dev ops for machine learning so different
 
Why is dev ops for machine learning so different - dataxdays
Why is dev ops for machine learning so different  - dataxdaysWhy is dev ops for machine learning so different  - dataxdays
Why is dev ops for machine learning so different - dataxdays
 
Quick Guide to Refresh Spark skills
Quick Guide to Refresh Spark skillsQuick Guide to Refresh Spark skills
Quick Guide to Refresh Spark skills
 
The way from DB-driven development to DDD
The way from DB-driven development to DDDThe way from DB-driven development to DDD
The way from DB-driven development to DDD
 
Ado.net & data persistence frameworks
Ado.net & data persistence frameworksAdo.net & data persistence frameworks
Ado.net & data persistence frameworks
 
L11 Application Architecture
L11 Application ArchitectureL11 Application Architecture
L11 Application Architecture
 
Front Range PHP NoSQL Databases
Front Range PHP NoSQL DatabasesFront Range PHP NoSQL Databases
Front Range PHP NoSQL Databases
 
Struts 2-overview2
Struts 2-overview2Struts 2-overview2
Struts 2-overview2
 
Day5
Day5Day5
Day5
 
Challenges of Implementing an Advanced SQL Engine on Hadoop
Challenges of Implementing an Advanced SQL Engine on HadoopChallenges of Implementing an Advanced SQL Engine on Hadoop
Challenges of Implementing an Advanced SQL Engine on Hadoop
 
Open Source Data Services for Strategic SOA utilising WSO2 Data Services Server
Open Source Data Services for Strategic SOA  utilising WSO2 Data Services ServerOpen Source Data Services for Strategic SOA  utilising WSO2 Data Services Server
Open Source Data Services for Strategic SOA utilising WSO2 Data Services Server
 
Open Source Data Services for Strategic SOA utilising WSO2 Data Services Server
Open Source Data Services for Strategic SOA utilising WSO2 Data Services ServerOpen Source Data Services for Strategic SOA utilising WSO2 Data Services Server
Open Source Data Services for Strategic SOA utilising WSO2 Data Services Server
 
Frustration-Reduced PySpark: Data engineering with DataFrames
Frustration-Reduced PySpark: Data engineering with DataFramesFrustration-Reduced PySpark: Data engineering with DataFrames
Frustration-Reduced PySpark: Data engineering with DataFrames
 

Mais de swiss IT bridge

How to apply Agile in Marketing
How to apply Agile in MarketingHow to apply Agile in Marketing
How to apply Agile in Marketingswiss IT bridge
 
Kooperationsmodelle im Software-Offshoring
Kooperationsmodelle im Software-OffshoringKooperationsmodelle im Software-Offshoring
Kooperationsmodelle im Software-Offshoringswiss IT bridge
 
Kundenzufriedenheit als Motor des kontinuierlichen Verbesserungsprozesses
Kundenzufriedenheit als Motor des kontinuierlichen VerbesserungsprozessesKundenzufriedenheit als Motor des kontinuierlichen Verbesserungsprozesses
Kundenzufriedenheit als Motor des kontinuierlichen Verbesserungsprozessesswiss IT bridge
 
Effective technical presentation
Effective technical presentationEffective technical presentation
Effective technical presentationswiss IT bridge
 
The Evolution of Offshoring
The Evolution of OffshoringThe Evolution of Offshoring
The Evolution of Offshoringswiss IT bridge
 
Software-Entwicklung im interkulturellen Kontext
Software-Entwicklung im interkulturellen KontextSoftware-Entwicklung im interkulturellen Kontext
Software-Entwicklung im interkulturellen Kontextswiss IT bridge
 

Mais de swiss IT bridge (6)

How to apply Agile in Marketing
How to apply Agile in MarketingHow to apply Agile in Marketing
How to apply Agile in Marketing
 
Kooperationsmodelle im Software-Offshoring
Kooperationsmodelle im Software-OffshoringKooperationsmodelle im Software-Offshoring
Kooperationsmodelle im Software-Offshoring
 
Kundenzufriedenheit als Motor des kontinuierlichen Verbesserungsprozesses
Kundenzufriedenheit als Motor des kontinuierlichen VerbesserungsprozessesKundenzufriedenheit als Motor des kontinuierlichen Verbesserungsprozesses
Kundenzufriedenheit als Motor des kontinuierlichen Verbesserungsprozesses
 
Effective technical presentation
Effective technical presentationEffective technical presentation
Effective technical presentation
 
The Evolution of Offshoring
The Evolution of OffshoringThe Evolution of Offshoring
The Evolution of Offshoring
 
Software-Entwicklung im interkulturellen Kontext
Software-Entwicklung im interkulturellen KontextSoftware-Entwicklung im interkulturellen Kontext
Software-Entwicklung im interkulturellen Kontext
 

Último

Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 

Último (20)

Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 

An approach to implement model classes in zend

  • 1. Quynh Le, PHP Developer swiss IT bridge gmbh www.swissITbridge.ch An approach to implement Model classes in Zend Framework
  • 2.
  • 3.
  • 4.
  • 5.
  • 6. Patterns (cont.) 2. Active Record class Employee extends ActiveRecord {     //Storage logic methods     public function insert(){}     //Business logic methods     public function calculateAge()     {      } } Pros : - Simple and easy to implement Cons : - Hard to test without database connection - Tight-coupling with Zend_Db_Table - Hard to change data source (Oracle, XML, SOAP, ...)
  • 7. Patterns (cont.) 3. Data Mapper (Highly recommended) Separate Business logic & storage logic
  • 8. Patterns (cont.) 3. Data Mapper (cont.) Patterns: - Lazy loading: Huge data fields, or relation objects - Identity map: Avoid to load the same object twice - Dependency injection: Initialize mapper objects
  • 9. Patterns (cont.) 3. Data Mapper (cont.) Service Layer:  - Place on the top of Domain Model and Data Mapper - Extend business logic - Forwards calls to Domain Model or Data Mapper
  • 10. Patterns (cont.) 3. Data Mapper (cont.) Service Layer: 
  • 11. Patterns (cont.) 3. Data Mapper (cont.) Pros: - Can handle very complex business logic - Parallel implementation - Complete decoupling - Model is not aware of storage - Clean storage interface (implement different storages) - Can test without Database connection Cons: -  Quite much code to write
  • 12. Patterns (cont.) 3. Data Mapper (cont.) Sample code:
  • 13. Reference Book: Patterns of Enterprise Application Architecture (Martin Fowler, 2002)

Notas do Editor

  1. what would you like to discuss
  2. what would you like to discuss
  3. what would you like to discuss
  4. what would you like to discuss
  5. what would you like to discuss
  6. what would you like to discuss
  7. what would you like to discuss
  8. what would you like to discuss
  9. what would you like to discuss
  10. what would you like to discuss
  11. what would you like to discuss
  12. what would you like to discuss
  13. what would you like to discuss