Software Engineering in PHP

2,616 views
2,541 views

Published on

Software Engineering in PHP - M A Hossain Tonu

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
2,616
On SlideShare
0
From Embeds
0
Number of Embeds
806
Actions
Shares
0
Downloads
46
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Software Engineering in PHP

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

×