0
Software Engineering
                                In PHP
                            V1.0 - Prepared for Austin PHP
   ...
General Purpose
                   •      These slides are for:

                          •   Software “developers” with ...
Contents

                   • Programming Languages
                   • Design Patterns
                   • Software De...
Programming Languages
                          Language Features & Paradigms




Wednesday, May 13, 2009                 ...
Programming Languages

                                 Paradigms
                   • Imperative vs. Declarative
        ...
Programming Languages

                                    Typing

                   • Static vs. Dynamic
               ...
Programming Languages

                    Compiled vs. Scripting
                   • Compiled (machine code)
           ...
Programming Languages

                                             PHP
                          • Scripting Language
   ...
Design Patterns
                           Building Blocks for Software




Wednesday, May 13, 2009                       ...
Design Patterns

                                     Overview
                   • Applications
                    • Mod...
Design Patterns

                          Model 1 vs. Model 2
                   • Coined in the Java world
             ...
Design Patterns

                    Programming Patterns

                   • Most notable source: Gang
                ...
Design Patterns / Software Patterns

                          Example: Factory




                            http://en....
Design Patterns / Software Patterns

                    Example: Lazy Loading




                          http://en.wik...
Design Patterns / Software Patterns

                          Example: Singleton




                              http:/...
Design Patterns / Software Patterns

                          Example: Composite


                                     h...
Design Patterns / Software Patterns

                          Example: Adapter

                                        h...
Design Patterns / Software Patterns

                          Example: Observer
                                        h...
Design Patterns

                    Programming Patterns

                   • Most notable source:
                     ...
Design Patterns / Architectural Patterns

                             Non-PoEAA
                   • Presentation-abstrac...
Design Patterns / Architectural Patterns

                                           PoEAA
                   • Logical: D...
Design Patterns / Architectural Patterns

              Example: Domain Model
                                            ...
Design Patterns / Architectural Patterns

                   Example: Table Module

                                      ...
Design Patterns / Architectural Patterns

               Example: Table Gateway

                                http://ma...
Design Patterns / Architectural Patterns

                Example: Row Gateway

                                http://mar...
Design Patterns / Architectural Patterns

                Example: Active Record

                                http://m...
Design Patterns / Architectural Patterns

                Example: Active Record

                                http://m...
Design Patterns / Architectural Patterns

                          Example: MVC

                              http://en....
Design Patterns / Architectural Patterns

                          Example: Registry

                                   ...
Software Development
                        Process
                          Best Practices for Building Software




We...
Development Process

                                  Overview

               • Unit Testing
               • Source Con...
Development Process

                                 Unit Testing
               • Why write unit tests?
                ...
Development Process

                              Source Control
               • Why use source control?
               ...
Development Process

                            Coding Standards
               • Why have coding standards?
            ...
Development Process

                           Build & Deploy
               • Create a testable and repeatable deploymen...
PHP Ecosystem
                             Software & Tools




Wednesday, May 13, 2009                         36
PHP Ecosystem
                                        Application
                                        Frameworks
     ...
PHP Ecosystem
                          Unit Testing
                          Frameworks
               • PHPUnit
       ...
PHP Ecosystem

                                   IDEs & Editors
               •       Editors

                   •     ...
PHP Ecosystem

                                        IDEs & Editors
               •       Eclipse-based IDEs

         ...
Upcoming SlideShare
Loading in...5
×

Software Engineering In PHP

10,397

Published on

Software Engineering In PHP

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

No Downloads
Views
Total Views
10,397
On Slideshare
0
From Embeds
0
Number of Embeds
5
Actions
Shares
0
Downloads
422
Comments
0
Likes
16
Embeds 0
No embeds

No notes for slide

Transcript of "Software Engineering In PHP"

  1. 1. Software Engineering In PHP V1.0 - Prepared for Austin PHP http://php.meetup.com/42/ Ralph Schindler - Zend http://ralphschindler.com | http://zend.com Josh Butts - Vertive http://joshbutts.com | http://vertive.com Wednesday, May 13, 2009 1
  2. 2. General Purpose • These slides are for: • Software “developers” with an interest in becoming software “engineers” • Engineers in other disciplines (Java, .NET, C#) that want to draw parallels to PHP • These slides are: • An overview only, a means to pique interest • More information can be found in the linked provided with each slide Wednesday, May 13, 2009 2
  3. 3. Contents • Programming Languages • Design Patterns • Software Development & Best Practices • PHP Ecosystem Wednesday, May 13, 2009 3
  4. 4. Programming Languages Language Features & Paradigms Wednesday, May 13, 2009 4
  5. 5. Programming Languages Paradigms • Imperative vs. Declarative • Object Oriented • Class / Inheritance • Prototype based • Procedural 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 Wednesday, May 13, 2009 5
  6. 6. Programming Languages Typing • Static vs. Dynamic • Strong vs. Weak • Duck Typing http://en.wikipedia.org/wiki/Type_system Wednesday, May 13, 2009 6
  7. 7. Programming Languages Compiled vs. Scripting • Compiled (machine code) • c, c++ • Compiled (byte-code) • Java, C# (.net) • Scripting • PHP, Ruby, Python, ECMAScript (Java / Action) 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 Wednesday, May 13, 2009 7
  8. 8. Programming Languages PHP • Scripting Language • Virtual Machine: Zend Engine • Written in C • Multi-paradigm • Imperative (procedural) • Object-oriented (inheritance) • Weak dynamic typing http://en.wikipedia.org/wiki/Zend_Engine http://en.wikipedia.org/wiki/PHP Wednesday, May 13, 2009 8
  9. 9. Design Patterns Building Blocks for Software Wednesday, May 13, 2009 9
  10. 10. Design Patterns Overview • Applications • Model 1 • Model 2 • Programming Patterns • Architectural 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) Wednesday, May 13, 2009 10
  11. 11. Design Patterns Model 1 vs. Model 2 • Coined in the Java world • Model 1 apps are procedural applications • TypicallyJSP pagesa series of scripts, built as original • Model 2 apps arehave separation of and/or tiered applications applications that concerns 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 Wednesday, May 13, 2009 11
  12. 12. Design Patterns Programming Patterns • Most notable source: Gang of Four • Object oriented 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) Wednesday, May 13, 2009 12
  13. 13. Design Patterns / Software Patterns Example: Factory http://en.wikipedia.org/wiki/Factory_method_pattern http://en.wikipedia.org/wiki/Creational_pattern Wednesday, May 13, 2009 13
  14. 14. Design Patterns / Software Patterns Example: Lazy Loading http://en.wikipedia.org/wiki/Lazy_initialization_pattern Wednesday, May 13, 2009 14
  15. 15. Design Patterns / Software Patterns Example: Singleton http://en.wikipedia.org/wiki/Singleton_pattern Wednesday, May 13, 2009 15
  16. 16. Design Patterns / Software Patterns Example: Composite http://en.wikipedia.org/wiki/Composite_pattern http://devzone.zend.com/node/view/id/7 Wednesday, May 13, 2009 16
  17. 17. Design Patterns / Software Patterns Example: Adapter http://en.wikipedia.org/wiki/Adapter_pattern Wednesday, May 13, 2009 17
  18. 18. Design Patterns / Software Patterns Example: Observer http://en.wikipedia.org/wiki/Observer_pattern http://www.php.net/~helly/php/ext/spl/ Wednesday, May 13, 2009 18
  19. 19. Design Patterns Programming Patterns • Most notable source: Martin Fowler • PoEAA: Patterns of Enterprise Application Architecture 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/ Wednesday, May 13, 2009 19
  20. 20. Design Patterns / Architectural Patterns Non-PoEAA • Presentation-abstraction-control • Service-oriented architecture (distributed) • Mulit/Three-Tier • Peer-to-Peer (distributed) 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 Wednesday, May 13, 2009 20
  21. 21. Design Patterns / Architectural Patterns 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 http://martinfowler.com/eaaCatalog/ http://en.wikipedia.org/wiki/Active_record_pattern Wednesday, May 13, 2009 21
  22. 22. Design Patterns / Architectural Patterns Example: Domain Model http://en.wikipedia.org/wiki/Domain_Model http://martinfowler.com/eaaCatalog/ domainModel.html Wednesday, May 13, 2009 22
  23. 23. Design Patterns / Architectural Patterns Example: Table Module http://martinfowler.com/eaaCatalog/ tableModule.html Wednesday, May 13, 2009 23
  24. 24. Design Patterns / Architectural Patterns Example: Table Gateway http://martinfowler.com/eaaCatalog/tableDataGateway.html Wednesday, May 13, 2009 24
  25. 25. Design Patterns / Architectural Patterns Example: Row Gateway http://martinfowler.com/eaaCatalog/rowDataGateway.html Wednesday, May 13, 2009 25
  26. 26. Design Patterns / Architectural Patterns Example: Active Record http://martinfowler.com/eaaCatalog/activeRecord.html http://en.wikipedia.org/wiki/Active_record_pattern Wednesday, May 13, 2009 26
  27. 27. Design Patterns / Architectural Patterns Example: Active Record http://martinfowler.com/eaaCatalog/activeRecord.html http://en.wikipedia.org/wiki/Active_record_pattern Wednesday, May 13, 2009 27
  28. 28. Design Patterns / Architectural Patterns Example: MVC http://en.wikipedia.org/wiki/Model-view-controller http://martinfowler.com/eaaCatalog/modelViewController.html Wednesday, May 13, 2009 28
  29. 29. Design Patterns / Architectural Patterns Example: Registry http://martinfowler.com/eaaCatalog/registry.html Wednesday, May 13, 2009 29
  30. 30. Software Development Process Best Practices for Building Software Wednesday, May 13, 2009 30
  31. 31. 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 Wednesday, May 13, 2009 31
  32. 32. Development Process Unit Testing • Why write unit tests? • prevent regressions • ensure software meets requirements • tests help document what the software does • XUnit pattern http://en.wikipedia.org/wiki/XUnit Wednesday, May 13, 2009 32
  33. 33. 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 http://subversion.tigris.org/ http://git-scm.com/ http://www.github.com http://en.wikipedia.org/wiki/Distributed_revision_control Wednesday, May 13, 2009 33
  34. 34. Development Process Coding Standards • Why have coding standards? • readability for yourself and colleagues • prevents mistakes, syntax errors • Pear Coding Standards • don't write your own standards, its not worth your time 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 Wednesday, May 13, 2009 34
  35. 35. Development Process Build & Deploy • Create a testable and repeatable deployment process • Run some functional tests • document your application • Code comments • API Docs http://cruisecontrol.sourceforge.net/ http://code.google.com/p/xinc/ http://www.atlassian.com/software/bamboo/ Wednesday, May 13, 2009 35
  36. 36. PHP Ecosystem Software & Tools Wednesday, May 13, 2009 36
  37. 37. 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 • Symfony • 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 Wednesday, May 13, 2009 37
  38. 38. PHP Ecosystem Unit Testing Frameworks • PHPUnit • Most popular, derived from NUnit pattern • Simpletest • phpt http://www.simpletest.org/ http://phpt.info/ http://en.wikipedia.org/wiki/Unit_testing http://www.phpunit.de/ Wednesday, May 13, 2009 38
  39. 39. PHP Ecosystem IDEs & Editors • Editors • pattern matched syntax highlighting & code folding • typically multi-language • especially good at text & code manipulation • IDEs • Language introspection (code completion) • Errors / Warnings / Syntax Check • Debugging 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/ Wednesday, May 13, 2009 39
  40. 40. PHP Ecosystem IDEs & Editors • Eclipse-based IDEs • Zend Studio (paid) / PDT (open source) • great PHP editing and debugging • Aptana • javascript & css editing & code completion is excellent • debugging with xdebug • Text Editors • Ultraedit on Windows • Textmate on Mac • “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 Wednesday, May 13, 2009 40
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×