SlideShare una empresa de 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

Más contenido relacionado

Destacado

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
 

Destacado (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
 

Similar 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 ServerWSO2
 
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
 
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
 

Similar 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
 

Más 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
 

Más 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

SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostZilliz
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
"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
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DayH2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DaySri Ambati
 
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
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 

Último (20)

SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
"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
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo DayH2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
H2O.ai CEO/Founder: Sri Ambati Keynote at Wells Fargo Day
 
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)
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 

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 del 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