1 / 39

PHP Software Engineering

PHP Software Engineering . Programming Languages . Language Features & Paradigms. Paradigms. Imperative vs. Declarative Object Oriented Class / Inheritance Prototype based Procedural. Programming Languages. http://en.wikipedia.org/wiki/Programming_paradigms

matty
Download Presentation

PHP Software Engineering

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. PHP Software Engineering

  2. Programming Languages Language Features & Paradigms

  3. Paradigms Imperative vs. Declarative Object Oriented Class / Inheritance Prototype based Procedural Programming Languages http://en.wikipedia.org/wiki/Programming_paradigms http://en.wikipedia.org/wiki/Imperative_programming http://en.wikipedia.org/wiki/Declarative_programming http://en.wikipedia.org/wiki/Object-oriented_programming http://en.wikipedia.org/wiki/Class-based_programming http://en.wikipedia.org/wiki/Prototype-based_programming http://en.wikipedia.org/wiki/Procedural_programming

  4. Typing Static vs. Dynamic Strong vs. Weak Duck Typing Programming Languages http://en.wikipedia.org/wiki/Type_system

  5. Typing Static vs. Dynamic Strong vs. Weak Duck Typing Programming Languages http://en.wikipedia.org/wiki/Type_system

  6. Compiled vs. Scripting Compiled (machine code)‏ c, c++ Compiled (byte-code)‏ Java, C# (.net)‏ Scripting PHP, Ruby, Python, ECMAScript (Java / Action)‏ Programming Languages http://en.wikipedia.org/wiki/Scripting_language http://en.wikipedia.org/wiki/Compiled_language http://en.wikipedia.org/wiki/Virtual_machine http://en.wikipedia.org/wiki/Just-in-time_compilation

  7. PHP Scripting Language Virtual Machine: Zend Engine Written in C Multi-paradigm Imperative (procedural)‏ Object-oriented (inheritance)‏ Weak dynamic typing Programming Languages http://en.wikipedia.org/wiki/Zend_Engine http://en.wikipedia.org/wiki/PHP

  8. Design Patterns Building Blocks for Software

  9. Overview Applications Model 1 Model 2 Programming Patterns Architectural Patterns Design Patterns http://en.wikipedia.org/wiki/Model_1 http://en.wikipedia.org/wiki/Model_2 http://en.wikipedia.org/wiki/Design_pattern_(computer_science)‏ http://en.wikipedia.org/wiki/Architectural_pattern_(computer_science)‏

  10. Model 1 vs. Model 2 Coined in the Java world Model 1 apps are procedural applications Typically built as a series of scripts, original JSP pages Model 2 apps are tiered applications and/or applications that have separation of concerns Design Patterns http://en.wikipedia.org/wiki/Model_1 http://en.wikipedia.org/wiki/Model_2 http://en.wikipedia.org/wiki/Separation_of_concern http://en.wikipedia.org/wiki/Separation_of_presentation_and_content

  11. Programming Patterns Most notable source: Gang of Four Object oriented design patterns Design Patterns http://en.wikipedia.org/wiki/Design_Patterns_(book)‏ http://www.amazon.com/Design-Patterns-Object-Oriented-Addison-Wesley-Professional/dp/0201633612/ http://en.wikipedia.org/wiki/Design_pattern_(computer_science)‏

  12. Example: Factory Design Patterns / Software Patterns http://en.wikipedia.org/wiki/Factory_method_pattern http://en.wikipedia.org/wiki/Creational_pattern

  13. Example: Lazy Loading Design Patterns / Software Patterns http://en.wikipedia.org/wiki/Lazy_initialization_pattern

  14. Example: Singleton Design Patterns / Software Patterns http://en.wikipedia.org/wiki/Singleton_pattern

  15. Example: Composite Design Patterns / Software Patterns http://en.wikipedia.org/wiki/Composite_pattern http://devzone.zend.com/node/view/id/7

  16. Example: Adapter Design Patterns / Software Patterns http://en.wikipedia.org/wiki/Adapter_pattern

  17. Example: Observer Design Patterns / Software Patterns http://en.wikipedia.org/wiki/Observer_pattern http://www.php.net/~helly/php/ext/spl/

  18. Programming Patterns Most notable source: Martin Fowler PoEAA: Patterns of Enterprise Application Architecture Design Patterns http://en.wikipedia.org/wiki/Architectural_pattern_(computer_science)‏ http://martinfowler.com/eaaCatalog/ http://www.amazon.com/Enterprise-Application-Architecture-Addison-Wesley-Signature/dp/0321127420/

  19. Non-PoEAA Presentation-abstraction-control Service-oriented architecture (distributed)‏ Mulit/Three-Tier Peer-to-Peer (distributed)‏ Design Patterns / Architectural Patterns http://en.wikipedia.org/wiki/Presentation-abstraction-control http://en.wikipedia.org/wiki/Service-oriented_architecture http://en.wikipedia.org/wiki/Three-tier_(computing)‏ http://en.wikipedia.org/wiki/Peer-to-peer

  20. PoEAA Logical: Domain Model & Table Module Data: Table Row & Row Data Gateway, ActiveRecord, Data Mapper Other: Repository, Registry, Plugin Model-View-Controller, Front Controller, Two-step View Design Patterns / Architectural Patterns http://martinfowler.com/eaaCatalog/ http://en.wikipedia.org/wiki/Active_record_pattern

  21. Example: Domain Model Design Patterns / Architectural Patterns http://en.wikipedia.org/wiki/Domain_Model http://martinfowler.com/eaaCatalog/domainModel.html

  22. Example: Table Module Design Patterns / Architectural Patterns http://martinfowler.com/eaaCatalog/tableModule.html

  23. Example: Table Gateway Design Patterns / Architectural Patterns http://martinfowler.com/eaaCatalog/tableDataGateway.html

  24. Example: Row Gateway Design Patterns / Architectural Patterns http://martinfowler.com/eaaCatalog/rowDataGateway.html

  25. Example: Active Record Design Patterns / Architectural Patterns http://martinfowler.com/eaaCatalog/activeRecord.html http://en.wikipedia.org/wiki/Active_record_pattern

  26. Example: Active Record Design Patterns / Architectural Patterns http://martinfowler.com/eaaCatalog/activeRecord.html http://en.wikipedia.org/wiki/Active_record_pattern

  27. Example: MVC Design Patterns / Architectural Patterns http://en.wikipedia.org/wiki/Model-view-controller http://martinfowler.com/eaaCatalog/modelViewController.html

  28. Example: Registry Design Patterns / Architectural Patterns http://martinfowler.com/eaaCatalog/registry.html

  29. Software Development Process Best Practices for Building Software

  30. Development Process Overview • Unit Testing • Source Control • Coding Standards • Continuous Integration • Documentation http://en.wikipedia.org/wiki/Programming_style http://martinfowler.com/articles/continuousIntegration.html http://en.wikipedia.org/wiki/Unit_testing http://en.wikipedia.org/wiki/Revision_control

  31. Development Process Unit Testing • Why write unit tests? • prevent regressions • ensure software meets requirements • tests help document what the software does • XUnit pattern • unit testing framework with equivalents in PHP, Java, Ruby, C#, and more • XUnit is one of the most popular ways to test code http://en.wikipedia.org/wiki/XUnit

  32. Development Process Source Control • Why use source control? • Keep track of changes you made • Light-weight backup • Great for collaboration, even if there is only one of you now • Common SCM (Source Code Management) tools • Subversion (SVN)‏ • widely used, well-supported by tools • client-server model, integrates well with Apache • Git • distributed model, trendy • somewhat high learning curve, especially if you’re used to SVN or CVS http://subversion.tigris.org/ http://git-scm.com/ http://www.github.com http://en.wikipedia.org/wiki/Distributed_revision_control

  33. Development Process Coding Standards • Why have coding standards?readability for yourself and colleaguesprevents mistakes, syntax errorsPear Coding Standardsdon't write your own standards, its not worth your timePear standards are commonly accepted, and align with other languages as well • don't write your own standards, its not worth your timePear standards are commonly accepted, and align with other languages as well • don't write your own standards, its not worth your timePear standards are commonly accepted, and align with other languages as well • don't write your own standards, its not worth your timePear standards are commonly accepted, and align with other languages as well http://pear.php.net/pepr/pepr-proposal-show.php?id=426 http://pear.php.net/manual/en/standards.php http://framework.zend.com/manual/en/coding-standard.html

  34. Development Process Build & Deploy • Create a testable and repeatable deployment process • Run some functional testsdocument your application • Code comments • API Docs • automate - take the human out of it • continuous integration • find the right level of process • find the right level of process http://cruisecontrol.sourceforge.net/ http://code.google.com/p/xinc/ http://www.atlassian.com/software/bamboo/

  35. PHP Ecosystem Software & Tools

  36. PHP Ecosystem Application Frameworks • Application Framework • Zend Framework • toolkit / glue style: use what you want or use it all • CakePHP & CodeIgnitor • lightweight MVC frameworks with data models • SymfonyMVC, more admin and configuration features • MVC, more admin and configuration features http://framework.zend.com/ http://codeigniter.com/ http://cakephp.org/ http://www.symfony-project.org/ http://en.wikipedia.org/wiki/Web_application_framework

  37. PHP Ecosystem Unit Testing Frameworks • PHPUnit • Most popular, derived from NUnit patternSimpletest • phpt • phpt http://www.simpletest.org/ http://phpt.info/ http://en.wikipedia.org/wiki/Unit_testing http://www.phpunit.de/

  38. PHP Ecosystem IDEs & Editors • Editors • pattern matched syntax highlighting & code foldingtypically multi-languageespecially good at text & code manipulationIDEsLanguage introspection (code completion)Errors / Warnings / Syntax CheckDebugging capabilities (breakpoints, watches, profiling)‏ • Language introspection (code completion)Errors / Warnings / Syntax CheckDebugging capabilities (breakpoints, watches, profiling)‏ • Language introspection (code completion)Errors / Warnings / Syntax CheckDebugging capabilities (breakpoints, watches, profiling)‏ http://en.wikipedia.org/wiki/Comparison_of_text_editors http://en.wikipedia.org/wiki/Integrated_development_environment http://www.xdebug.org/

  39. PHP Ecosystem IDEs & Editors • Eclipse-based IDEsZend Studio (paid) / PDT (open source)‏ • great PHP editing and debugging • Aptana • javascript & css editing & code completion is excellentdebugging with xdebugText Editors • Ultraedit on WindowsTextmate on Mac • “E” is Textmate on Windows • “E” is Textmate on Windows • “E” is Textmate on Windows http://www.zend.com/en/products/studio/ http://www.eclipse.org/pdt/ http://www.ultraedit.com/ http://www.aptana.com http://www.macromates.com

More Related