software engineering in php

28
M A Hossain Tonu http://mahtonu.wordpress.com <[email protected]> an industry perspective

Upload: m-a-hossain-tonu

Post on 24-Jan-2015

2.363 views

Category:

Technology


1 download

DESCRIPTION

Software Engineering in PHP - M A Hossain Tonu

TRANSCRIPT

Page 1: Software Engineering in PHP

M A Hossain Tonuhttp://mahtonu.wordpress.com

<[email protected]>

an industry perspective

Page 2: Software Engineering in PHP

OBJECTIVE

Adopting some engineering into your PHP Development

Quick view on enterprise PHP development process

Will give you concept, not complete set of details

Page 3: Software Engineering in PHP

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

Page 4: Software Engineering in PHP

ENGINEERING APPROACH

Page 5: Software Engineering in PHP

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

Page 6: Software Engineering in PHP

DESIGN PATTERNS : STRATEGY PATTERN Enables us to make decisions on different cases Example: User notification systemclass.emailnotifier.php

class.faxnotifier.php

class.smsnotifier.php

interface.Notifier.php

Page 7: Software Engineering in 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

Page 8: Software Engineering in PHP

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)

Page 9: Software Engineering in PHP

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

Page 10: Software Engineering in PHP

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

Page 11: Software Engineering in PHP

DEVELOPMENT METHODOLOGY: WATER FALL

Classical method

Page 12: Software Engineering in PHP

DEVELOPMENT METHODOLOGY: AGILE

Mostly used agile philosophy are XP and SCRUM

Generic Agile development process:

Page 13: Software Engineering in PHP

PHP DEVELOPMENT PROCESS

Page 14: Software Engineering in PHP

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/

Page 15: Software Engineering in PHP

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

Page 16: Software Engineering in PHP

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/

Page 17: Software Engineering in PHP

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

Page 18: Software Engineering in PHP

OPTIMIZATION

Caching Op-code caching {Page|Database|Module|…} caching Optimized Database Design Database Indexing strategy Writing good SQL

Page 19: Software Engineering in PHP

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

Page 20: Software Engineering in PHP

PERFORMANCE

Consider you have bought the product worth $1k$

How fast system performs under a particular work load

Tests scalability, reliability and resource usage.

Page 21: Software Engineering in PHP

REFACTORING

Cleaning up code

Without changing behavior

Not adding new feature

Use unit test you ensure you don’t break anything

Page 22: Software Engineering in PHP

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)

Page 23: Software Engineering in PHP

SUCCESSFUL PHP PRODUCT

Page 24: Software Engineering in PHP

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:

Page 25: Software Engineering in PHP

REVENUE MODEL ( EARNING MONEY )

Not traditional BUY & SELL method Describes the way of business Typically an online business Monetizes its services Example:

Freemium: "free" and "premium" Subscription Affiliate marketing Ad-funded Online shopping

Page 26: Software Engineering in PHP

USER DOCUMENTATION

Describes how to use the software

As product documentation to User

Way of documentation Tutorials Thematic List of reference

Page 27: Software Engineering in PHP

COMMERCIAL SUPPORT

Maintain support system i.e. ticketing system

Maintain user forum

Maintain product blog

Maintain email newsletter (inform user inside scoop)

Page 28: Software Engineering in PHP

QUESTIONS?