KEMBAR78
Software Engineering in PHP | PPT
M A Hossain Tonu http://mahtonu.wordpress.com <mahtonu@gmail.com> an industry perspective
OBJECTIVE Adopting some engineering into your PHP Development Quick view on enterprise PHP development process Will give you concept, not complete set of details  
CONTENTS Engineering Approach Design Patterns Architectural Patterns PHP Development Methodology PHP Development Process Best Practices Successful PHP Projects Open source Revenue Model User Documentation Commercial Support
ENGINEERING APPROACH
DESIGN PATTERNS A general reusability solution Shows relationships and interactions between classes or objects Four common design patterns Strategy Pattern Singleton Pattern Factory Pattern Adapter Pattern
DESIGN PATTERNS : STRATEGY PATTERN Enables us to make decisions on different cases Example: User notification system class.emailnotifier.php class.faxnotifier.php class.smsnotifier.php interface.Notifier.php
DESIGN PATTERNS : SINGLETON PATTERN Delivers a single instance of an object no matter how many times you instantiate it. Example: Self refers to current class and $this refers to current object
ARCHITECTURAL PATTERNS An image of a system Describes software behavior Common Example: MVC (Model-View-Controller) SOA (Service Oriented Architecture) Multi-tier (Frontend, Application, Data)
ARCHITECTURAL PATTERNS: MVC Model–View–Controller Model  is responsible to manage the data;  it stores and retrieves entities used by an application, i.e. from a database contains the logic implemented by the application.  View (presentation)   is responsible to display the data provided by the model  similar usage with the template modules present in some popular web applications, like wordpress, joomla, …  Controller  Perform as glue between Model and View Helps to persist data from Model to View
PHP DEVELOPMENT METHODOLOGY Defines development infrastructure Provides a framework that is used to structure, plan, and control the process of developing  Common Example:  Water Fall Agile(SCRUM, XP ) RAD
DEVELOPMENT METHODOLOGY: WATER FALL Classical method
DEVELOPMENT METHODOLOGY: AGILE Mostly used agile philosophy are XP and SCRUM Generic Agile development process:
PHP DEVELOPMENT PROCESS
FOUNDATION Start with a foundation Use a framework Provides guidelines Off the shelf components   Examples Code Igniter http://www.codeigniter.com/ CakePHP http://cakephp.org/ Zend Framework http://framework.zend.com/ Symfony http://www.symfony-project.org/
SECURITY Not a language feature It is you who writes secure PHP application Common security check list: User input/From validation XSS SQL/Code Injection  Session hijacking Error reporting
TESTING More testing = less debugging Unit Testing Verify the functionality of a specific section of code Integration testing Verify the interfaces between components against a software design Acceptance Testing Verify customer acceptance Tools: PHPUnit http://www.phpunit.de Selenium http://seleniumhq.org/
DEBUGGING If you don’t have bugs in your code, you are not smart enough to debug Checklist: function call flow  error notification  variable values with a given scope  Debugger/Profiler Tools: Xdebug http://www.xdebug.org
OPTIMIZATION Caching Op-code caching {Page|Database|Module|…} caching Optimized Database Design Database Indexing strategy Writing good SQL
DEPLOYMENT Always automate your deployment Deploy to  Develop env Test env LIVE LIVE = Shared server/Cloud server/… Use SVN Code is just a part, don’t forget the database Create a “Deployment and Release” Profile
PERFORMANCE Consider you have bought the product worth $1k$ How fast system performs under a particular work load Tests scalability, reliability and resource usage.
REFACTORING Cleaning up code Without changing behavior Not adding new feature Use unit test you ensure you don’t break anything
BEST PRACTICES Don’t re-invent the wheel Follow coding standards Write reusable code Use components/frameworks Good communication and collaboration Commitment (On time – On mark) Document your application ( code comments & API docs )
SUCCESSFUL PHP PRODUCT
OPENSOURCE WWW.OPENSOURCE.ORG Access to code Freedom to change Freedom to distribute Freedom to use Doesn’t mean free of cost, but may be. Collaborative software engineering Open source enabled business Famous Examples:
REVENUE MODEL ( EARNING MONEY    ) Not traditional BUY & SELL method Describes the way of business Typically an online business Monetizes its services Example: Freemium: &quot;free&quot; and &quot;premium&quot; Subscription Affiliate marketing Ad-funded Online shopping
USER DOCUMENTATION Describes how to use the software As product documentation to User Way of documentation Tutorials Thematic List of reference
COMMERCIAL SUPPORT Maintain support system i.e. ticketing system Maintain user forum Maintain product blog Maintain email newsletter (inform user inside scoop)
QUESTIONS?

Software Engineering in PHP

  • 1.
    M A HossainTonu http://mahtonu.wordpress.com <mahtonu@gmail.com> an industry perspective
  • 2.
    OBJECTIVE Adopting someengineering into your PHP Development Quick view on enterprise PHP development process Will give you concept, not complete set of details 
  • 3.
    CONTENTS Engineering ApproachDesign Patterns Architectural Patterns PHP Development Methodology PHP Development Process Best Practices Successful PHP Projects Open source Revenue Model User Documentation Commercial Support
  • 4.
  • 5.
    DESIGN PATTERNS Ageneral reusability solution Shows relationships and interactions between classes or objects Four common design patterns Strategy Pattern Singleton Pattern Factory Pattern Adapter Pattern
  • 6.
    DESIGN PATTERNS :STRATEGY PATTERN Enables us to make decisions on different cases Example: User notification system class.emailnotifier.php class.faxnotifier.php class.smsnotifier.php interface.Notifier.php
  • 7.
    DESIGN PATTERNS :SINGLETON PATTERN Delivers a single instance of an object no matter how many times you instantiate it. Example: Self refers to current class and $this refers to current object
  • 8.
    ARCHITECTURAL PATTERNS Animage of a system Describes software behavior Common Example: MVC (Model-View-Controller) SOA (Service Oriented Architecture) Multi-tier (Frontend, Application, Data)
  • 9.
    ARCHITECTURAL PATTERNS: MVCModel–View–Controller Model is responsible to manage the data; it stores and retrieves entities used by an application, i.e. from a database contains the logic implemented by the application. View (presentation) is responsible to display the data provided by the model similar usage with the template modules present in some popular web applications, like wordpress, joomla, … Controller Perform as glue between Model and View Helps to persist data from Model to View
  • 10.
    PHP DEVELOPMENT METHODOLOGYDefines development infrastructure Provides a framework that is used to structure, plan, and control the process of developing Common Example: Water Fall Agile(SCRUM, XP ) RAD
  • 11.
    DEVELOPMENT METHODOLOGY: WATERFALL Classical method
  • 12.
    DEVELOPMENT METHODOLOGY: AGILEMostly used agile philosophy are XP and SCRUM Generic Agile development process:
  • 13.
  • 14.
    FOUNDATION Start witha foundation Use a framework Provides guidelines Off the shelf components  Examples Code Igniter http://www.codeigniter.com/ CakePHP http://cakephp.org/ Zend Framework http://framework.zend.com/ Symfony http://www.symfony-project.org/
  • 15.
    SECURITY Not alanguage feature It is you who writes secure PHP application Common security check list: User input/From validation XSS SQL/Code Injection Session hijacking Error reporting
  • 16.
    TESTING More testing= less debugging Unit Testing Verify the functionality of a specific section of code Integration testing Verify the interfaces between components against a software design Acceptance Testing Verify customer acceptance Tools: PHPUnit http://www.phpunit.de Selenium http://seleniumhq.org/
  • 17.
    DEBUGGING If youdon’t have bugs in your code, you are not smart enough to debug Checklist: function call flow error notification variable values with a given scope Debugger/Profiler Tools: Xdebug http://www.xdebug.org
  • 18.
    OPTIMIZATION Caching Op-codecaching {Page|Database|Module|…} caching Optimized Database Design Database Indexing strategy Writing good SQL
  • 19.
    DEPLOYMENT Always automateyour deployment Deploy to Develop env Test env LIVE LIVE = Shared server/Cloud server/… Use SVN Code is just a part, don’t forget the database Create a “Deployment and Release” Profile
  • 20.
    PERFORMANCE Consider youhave bought the product worth $1k$ How fast system performs under a particular work load Tests scalability, reliability and resource usage.
  • 21.
    REFACTORING Cleaning upcode Without changing behavior Not adding new feature Use unit test you ensure you don’t break anything
  • 22.
    BEST PRACTICES Don’tre-invent the wheel Follow coding standards Write reusable code Use components/frameworks Good communication and collaboration Commitment (On time – On mark) Document your application ( code comments & API docs )
  • 23.
  • 24.
    OPENSOURCE WWW.OPENSOURCE.ORG Accessto code Freedom to change Freedom to distribute Freedom to use Doesn’t mean free of cost, but may be. Collaborative software engineering Open source enabled business Famous Examples:
  • 25.
    REVENUE MODEL (EARNING MONEY  ) Not traditional BUY & SELL method Describes the way of business Typically an online business Monetizes its services Example: Freemium: &quot;free&quot; and &quot;premium&quot; Subscription Affiliate marketing Ad-funded Online shopping
  • 26.
    USER DOCUMENTATION Describeshow to use the software As product documentation to User Way of documentation Tutorials Thematic List of reference
  • 27.
    COMMERCIAL SUPPORT Maintainsupport system i.e. ticketing system Maintain user forum Maintain product blog Maintain email newsletter (inform user inside scoop)
  • 28.