SlideShare a Scribd company logo
1 of 20
Developing Easily Deployable PHP Applications John Mertic @2011 SugarCRM Inc. All rights reserved.
Who Am I? John Mertic Contact Info http://jmertic.wordpress.com Twitter: @jmertic jmertic@sugarcrm.com ( Sugar ) jmertic@php.net ( PHP ) I am the Community Manager for SugarCRM http://www.sugarcrm.com http://developers.sugarcrm.com Learn more about working with the SugarCRM platform during tomorrow’s session “SugarCRM: Your Next Business Application” 3/24/2011 @2011 SugarCRM Inc. All rights reserved. 2 Buy my book! http://amzn.to/enioPV
Why deployable apps still matter 3/24/2011 @2011 SugarCRM Inc. All rights reserved. 3 Source: http://www.flickr.com/photos/sarchi/220539933
What I’ll cover Writing portable code ( or at least trying to ) Enabling configuration and customization ( for users and developers ) Strategies for testing and QA Making your code perform (reasonably) well @2011 SugarCRM Inc. All rights reserved. 3/24/2011 4
Writing portable code 3/24/2011 @2011 SugarCRM Inc. All rights reserved. 5 Source: http://www.flickr.com/photos/25339258@N05/2389910825/
Define your support matrix Operating System Any Linux, UNIX, OS X Windows Web Server Apache 1.3, 2.0, 2.2 IIS 6/7 using FastCGI Database MySQL 5.x SQL Server 2005, 2008 Oracle 10g, 11g PHP 5.2.x, 5.3.x Support most common configurations options mbstring.func_overload error_reporting = E_ALL Require only the most mainline extensions, plus Mbstrings ( i18n support ) Imap ( mail support ) Specific database extension ( mysql, mysqli, oci8, mssql, sqlsrv ) 3/24/2011 @2011 SugarCRM Inc. All rights reserved. 6
Design code that works for these platforms Avoid writing code directly talking to the bare metal; Abstract like mad!  Use a DB abstraction layer or ORM Make sure PHP features you are using are supported across support matrix or provide an alternate implementation. Detect what else the server has for you to use, have abstraction layer to talk to them. Example: User cache  ( APC, Memcache, Wincache, etc) Assume very little about the underlying system Example: Treat file system as case-sensitive, and file writes are only in one area. 3/24/2011 @2011 SugarCRM Inc. All rights reserved. 7
Example of what we have to work around Fetching a record from a database Mysql - mysql_fetch_assoc() Mysqli - mysqli_fetch_assoc() Mssql - mssql_fetch_assoc() Oci8 - oci_fetch_array() Sqlsrv - sqlsrv_fetch_array() Problems we run into Each has different input parameters What gets returned if no rows available? Mysql– bool false Mysqli - null Mssql– bool false Oci8 – bool false Sqlsrv– null ( bool false if error ) 3/24/2011 @2011 SugarCRM Inc. All rights reserved. 8
Build and deploy! We build all 3 editions of SugarCRM from 1 codebase We add code tags around sections specific to a certain version. To test under each different edition, developers can run the build locally We also can tag in or out features on a per edition basis. 3/24/2011 @2011 SugarCRM Inc. All rights reserved. 9 Source: http://www.flickr.com/photos/eastcapital/4554220770/
Enabling configuration and customization 3/24/2011 @2011 SugarCRM Inc. All rights reserved. 10 Source: http://www.flickr.com/photos/miskypig/400004362/
Making it simple yet powerful for end users Expose configuration options thru multiple channels Remember, not everyone has source access Allow users to customize their UI interface easily Make what should be simple, simple 3/24/2011 @2011 SugarCRM Inc. All rights reserved. 11
Making it simple yet powerful for developers Create a safe place to make customizations Avoid painful upgrades Create an easy to use API Well defined and documented. Don’t break it! Create easy to use hooks for modifying / adding functionality Examples from SugarCRM include: Metadata driven views Logic Hooks Allow for internationalization and localization 3/24/2011 @2011 SugarCRM Inc. All rights reserved. 12
Strategies for testing and QA 3/24/2011 @2011 SugarCRM Inc. All rights reserved. 13 Source: http://www.flickr.com/photos/cglock/386033158/
Automated Testing Tools Jenkins (http://jenkins-ci.org/) – Extensible CI Server Running on every checkin PHP lint ( php –l ) – Syntax checking for PHP source files PHPUnit (http://www.phpunit.de/) – Unit testing framework Runs once a day SODA – functional testing framework that leverages Watir SodaMachine – GUI tool for building SODA tests JMeter (http://jakarta.apache.org/jmeter/) - tool for testing a website under high load MeterMaid – XML language to write JMeter tests in SugarMMM (MeterMaid Maker) - utility to automate writing MeterMaid tests for SugarCRM TidBit – tool to make huge datasets for testing Learn more about SugarCRM’sopen source tools at http://developers.sugarcrm.com/opensource 3/24/2011 @2011 SugarCRM Inc. All rights reserved. 14
Non-automated testing You need to actually have people use your app. We do all of the following: Code reviews Design reviews Partner and customer demos Community previews Earlier the feedback, the better 3/24/2011 @2011 SugarCRM Inc. All rights reserved. 15
Making your code perform well 3/24/2011 @2011 SugarCRM Inc. All rights reserved. 16 Source: http://www.flickr.com/photos/tech1987/501427718/
What we do to help performance Try to do the basic stuff Avoid writing slow code Caching where appropriate Combine, minify, and version JS / CSS / images Keep SQL queries as simple as possible Leave the rest to the Sys Admin Provide configuration options to turn off heavy features Enable the application to take advantage of it’s environment Example: Using APC, memcache, Zend_Cache, wincache with little to no configuration Provide best practices for various environments 3/24/2011 @2011 SugarCRM Inc. All rights reserved. 17
How we gauge performance Formal testing Use Jmeter (http://jakarta.apache.org/jmeter/) on a load test cluster to test raw response speed. Instance analysis Monitor web server logs to look for non-cached items Track slow queries Ad-hoc testing Profile PHP execution with XDebug Use Firebug to measure CSS / JS / image payload 3/24/2011 @2011 SugarCRM Inc. All rights reserved. 18
What are the lessons we have learned? Define what you will support and to what extent Write your code to be as flexible as possible Make customizing, configuring, and extending your application not painful for users or developers Test across your support matrix, using automation when it makes sense Focus more on best                                          practices and general                                  performance, let admins                                        handle it from there. 3/24/2011 @2011 SugarCRM Inc. All rights reserved. 19 Source: http://www.flickr.com/photos/dlanod/126386070/
Questions? Slides available on SlideShare 3/24/2011 @2011 SugarCRM Inc. All rights reserved. 20

More Related Content

Recently uploaded

Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
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
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Google AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGGoogle AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGSujit Pal
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...gurkirankumar98700
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
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
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 

Recently uploaded (20)

Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
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
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Google AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAGGoogle AI Hackathon: LLM based Evaluator for RAG
Google AI Hackathon: LLM based Evaluator for RAG
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
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
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 

Featured

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by HubspotMarius Sescu
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTExpeed Software
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsPixeldarts
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthThinkNow
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfmarketingartwork
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 

Featured (20)

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 

POSSCON 2011 - Developing Easily Deployable PHP Applications

  • 1. Developing Easily Deployable PHP Applications John Mertic @2011 SugarCRM Inc. All rights reserved.
  • 2. Who Am I? John Mertic Contact Info http://jmertic.wordpress.com Twitter: @jmertic jmertic@sugarcrm.com ( Sugar ) jmertic@php.net ( PHP ) I am the Community Manager for SugarCRM http://www.sugarcrm.com http://developers.sugarcrm.com Learn more about working with the SugarCRM platform during tomorrow’s session “SugarCRM: Your Next Business Application” 3/24/2011 @2011 SugarCRM Inc. All rights reserved. 2 Buy my book! http://amzn.to/enioPV
  • 3. Why deployable apps still matter 3/24/2011 @2011 SugarCRM Inc. All rights reserved. 3 Source: http://www.flickr.com/photos/sarchi/220539933
  • 4. What I’ll cover Writing portable code ( or at least trying to ) Enabling configuration and customization ( for users and developers ) Strategies for testing and QA Making your code perform (reasonably) well @2011 SugarCRM Inc. All rights reserved. 3/24/2011 4
  • 5. Writing portable code 3/24/2011 @2011 SugarCRM Inc. All rights reserved. 5 Source: http://www.flickr.com/photos/25339258@N05/2389910825/
  • 6. Define your support matrix Operating System Any Linux, UNIX, OS X Windows Web Server Apache 1.3, 2.0, 2.2 IIS 6/7 using FastCGI Database MySQL 5.x SQL Server 2005, 2008 Oracle 10g, 11g PHP 5.2.x, 5.3.x Support most common configurations options mbstring.func_overload error_reporting = E_ALL Require only the most mainline extensions, plus Mbstrings ( i18n support ) Imap ( mail support ) Specific database extension ( mysql, mysqli, oci8, mssql, sqlsrv ) 3/24/2011 @2011 SugarCRM Inc. All rights reserved. 6
  • 7. Design code that works for these platforms Avoid writing code directly talking to the bare metal; Abstract like mad! Use a DB abstraction layer or ORM Make sure PHP features you are using are supported across support matrix or provide an alternate implementation. Detect what else the server has for you to use, have abstraction layer to talk to them. Example: User cache ( APC, Memcache, Wincache, etc) Assume very little about the underlying system Example: Treat file system as case-sensitive, and file writes are only in one area. 3/24/2011 @2011 SugarCRM Inc. All rights reserved. 7
  • 8. Example of what we have to work around Fetching a record from a database Mysql - mysql_fetch_assoc() Mysqli - mysqli_fetch_assoc() Mssql - mssql_fetch_assoc() Oci8 - oci_fetch_array() Sqlsrv - sqlsrv_fetch_array() Problems we run into Each has different input parameters What gets returned if no rows available? Mysql– bool false Mysqli - null Mssql– bool false Oci8 – bool false Sqlsrv– null ( bool false if error ) 3/24/2011 @2011 SugarCRM Inc. All rights reserved. 8
  • 9. Build and deploy! We build all 3 editions of SugarCRM from 1 codebase We add code tags around sections specific to a certain version. To test under each different edition, developers can run the build locally We also can tag in or out features on a per edition basis. 3/24/2011 @2011 SugarCRM Inc. All rights reserved. 9 Source: http://www.flickr.com/photos/eastcapital/4554220770/
  • 10. Enabling configuration and customization 3/24/2011 @2011 SugarCRM Inc. All rights reserved. 10 Source: http://www.flickr.com/photos/miskypig/400004362/
  • 11. Making it simple yet powerful for end users Expose configuration options thru multiple channels Remember, not everyone has source access Allow users to customize their UI interface easily Make what should be simple, simple 3/24/2011 @2011 SugarCRM Inc. All rights reserved. 11
  • 12. Making it simple yet powerful for developers Create a safe place to make customizations Avoid painful upgrades Create an easy to use API Well defined and documented. Don’t break it! Create easy to use hooks for modifying / adding functionality Examples from SugarCRM include: Metadata driven views Logic Hooks Allow for internationalization and localization 3/24/2011 @2011 SugarCRM Inc. All rights reserved. 12
  • 13. Strategies for testing and QA 3/24/2011 @2011 SugarCRM Inc. All rights reserved. 13 Source: http://www.flickr.com/photos/cglock/386033158/
  • 14. Automated Testing Tools Jenkins (http://jenkins-ci.org/) – Extensible CI Server Running on every checkin PHP lint ( php –l ) – Syntax checking for PHP source files PHPUnit (http://www.phpunit.de/) – Unit testing framework Runs once a day SODA – functional testing framework that leverages Watir SodaMachine – GUI tool for building SODA tests JMeter (http://jakarta.apache.org/jmeter/) - tool for testing a website under high load MeterMaid – XML language to write JMeter tests in SugarMMM (MeterMaid Maker) - utility to automate writing MeterMaid tests for SugarCRM TidBit – tool to make huge datasets for testing Learn more about SugarCRM’sopen source tools at http://developers.sugarcrm.com/opensource 3/24/2011 @2011 SugarCRM Inc. All rights reserved. 14
  • 15. Non-automated testing You need to actually have people use your app. We do all of the following: Code reviews Design reviews Partner and customer demos Community previews Earlier the feedback, the better 3/24/2011 @2011 SugarCRM Inc. All rights reserved. 15
  • 16. Making your code perform well 3/24/2011 @2011 SugarCRM Inc. All rights reserved. 16 Source: http://www.flickr.com/photos/tech1987/501427718/
  • 17. What we do to help performance Try to do the basic stuff Avoid writing slow code Caching where appropriate Combine, minify, and version JS / CSS / images Keep SQL queries as simple as possible Leave the rest to the Sys Admin Provide configuration options to turn off heavy features Enable the application to take advantage of it’s environment Example: Using APC, memcache, Zend_Cache, wincache with little to no configuration Provide best practices for various environments 3/24/2011 @2011 SugarCRM Inc. All rights reserved. 17
  • 18. How we gauge performance Formal testing Use Jmeter (http://jakarta.apache.org/jmeter/) on a load test cluster to test raw response speed. Instance analysis Monitor web server logs to look for non-cached items Track slow queries Ad-hoc testing Profile PHP execution with XDebug Use Firebug to measure CSS / JS / image payload 3/24/2011 @2011 SugarCRM Inc. All rights reserved. 18
  • 19. What are the lessons we have learned? Define what you will support and to what extent Write your code to be as flexible as possible Make customizing, configuring, and extending your application not painful for users or developers Test across your support matrix, using automation when it makes sense Focus more on best practices and general performance, let admins handle it from there. 3/24/2011 @2011 SugarCRM Inc. All rights reserved. 19 Source: http://www.flickr.com/photos/dlanod/126386070/
  • 20. Questions? Slides available on SlideShare 3/24/2011 @2011 SugarCRM Inc. All rights reserved. 20

Editor's Notes

  1. People fear the cloudPeople can’t use the cloudPeople want to use different cloudsOur customer base reflects this ( 1/3 sugar cloud, 1/3 on site, 1/3 on other clouds )
  2. User base is diverse, likes different offerings, and will move between them.Lots of choices ( Web Servers / OSes / Databases / PHP versions ) as well as config possibilitiesHave to cover lots of platforms; can rely on particular hardware or software being available.
  3. Relate in picture, mention about balance for needed control and simplicity.Talk about how we made this a big deal in Sugar 6
  4. Types of testing we useTesting is hard
  5. Performance story about GNs; very particular to make go fastNeed to balance performance and configurability; make the performance choices that make the most difference, and enable ways for those working with your software to make more.
  6. Try to avoid subqueries as much as possible.