Download - Enterprise PHP

Transcript
Page 1: Enterprise PHP

… to be precise: “PHP in real world”

Page 2: Enterprise PHP

Introduction

A look at PHP

What is Enterprise

Development Lifecycle

Enterprise Techniques

Take-Aways

Open Discussion

Page 3: Enterprise PHP

Who is here?

Page 4: Enterprise PHP
Page 5: Enterprise PHP

How many of us here are:

• Management / Decision makers

• Project Managers

• Developers – PHP

• Developers – Other (.NET/RoR/Python/Java/…)

• Student / Hobbyist

Page 6: Enterprise PHP

Past and Present

Page 7: Enterprise PHP
Page 8: Enterprise PHP
Page 9: Enterprise PHP
Page 10: Enterprise PHP

Made for the web

Low learning curve

Short time-to-market

Huge active community

Platform independent (Linux, windows, …)

Open source

Versatile

Backed by Zend, Microsoft, IBM, etc.

Page 11: Enterprise PHP
Page 12: Enterprise PHP

“PHP is for hobbyists”

• Low learning curve

• Proper software engineering => proper quality

“PHP is insecure”

• PHP is a language; it’s the programmer that implements

security

“PHP is not a real language”

• It’s a dynamic scripting language; but a powerful one

Page 13: Enterprise PHP

“PHP does not scale”

• Most often PHP is not the bottleneck, DB is

• Language does not scale, architecture does

“PHP is not ready for Enterprise”

• Already running in mission-critical enterprises

• More on this later

Page 14: Enterprise PHP

When to consider something enterprise, and why

Page 15: Enterprise PHP

Customizability

• Adherence to business-specific rules

• Adaption of changing business environment

• Change of direction

Scalability

• Need to scale as business grows

• Change in infrastructure

Page 16: Enterprise PHP

Security

• Security is priority #1

Integration

• Needs to work seamlessly with existing solutions

• Should be open for collaboration

Performance

• Response time

• Load time

Page 17: Enterprise PHP

How we do it in real life

Page 18: Enterprise PHP

Analysis

Design

Coding

Testing

Deployment and Maintenance

Page 19: Enterprise PHP

Scrum

Extreme Programming (XP)

Kanban

OpenAgile

Page 20: Enterprise PHP

Working software is delivered frequently

Working software is the principal measure of progress

Even late changes in requirements are welcomed

Regular adaptation to changing circumstances

Customer is a part of the team

Page 21: Enterprise PHP

How to get ready for the enterprise

Page 22: Enterprise PHP

Simple code

DRY

Code quality

Security

Testing

Caching

Debugging

Deployment

Performance

Refactoring

Page 23: Enterprise PHP

This is easier said than done

Do the simplest thing that could possibly work.

Do not run for complexity, complexity kills!

Page 24: Enterprise PHP

Stick to standards

Open source = open knowledge

Reuse Experience

Use Components

Use Frameworks

Page 25: Enterprise PHP

Static Code Analysis

• Lint (php -l)

• PHP_CodeSniffer

Software Metrics

• PHPUnit

• PHP_Depend

Output validation

• Tidy

• HTML/CSS validation

Page 26: Enterprise PHP

Security is not an afterthought, it should be built within

the system

Trust no one

Handle common issues:

• XSS,

• SQL/Code injection,

• Session fixation,

• Session hijacking,

• CSRF

Page 27: Enterprise PHP

Unit Tests

Integration Tests

Acceptance Tests

Testing Tools:

• PHPUnit (http://www.phpunit.de)

• Selenium (http://seleniumhq.org)

Page 28: Enterprise PHP

Use a compiler cache (Zend, APC, etc)

Cache generated content:

• Whole pages or fragments (disk, squid, memcache)

• Database query results (query cache, memcache)

• External data (memcache, disk)

Page 29: Enterprise PHP

Create a test to expose each bug

Keep the test, and run it often

Tool:

• xdebug (http://www.xdebug.org)

• Tracing

• Remote Debugging

Page 30: Enterprise PHP

Always automate deployment

Use 3 Systems

• Development

• Integration/Staging

• Live

Consider virtual machines / cloud hosting

Page 31: Enterprise PHP

Do not guess where to start

Profile your code

• how often are functions called

• how long does execution take

Look for all possible execution path

Tool:

• xdebug (http://www.xdebug.org)

Page 32: Enterprise PHP

Improve the design of software without changing its

behavior

Not adding new features

“Cleaning up” code

Keep refactoring your code constantly

Use unit tests to ensure you don't break anything

Page 33: Enterprise PHP

The Negatives

• PHP does not always have all of the functionality needed

• Java development/implementation is more difficult than many

situations require

The Positives

• PHP will do most of what you need to do, easier.

• Java can fill almost any feature void in PHP for a web-based

deployment

Page 34: Enterprise PHP

Source: Kevin Schroeder (Zend)

Page 35: Enterprise PHP
Page 36: Enterprise PHP

PHP is a serious language

PHP is used in big, real world projects

Good life cycle for project matters

PHP can be used in conjunction with other technologies

When developing software for enterprise:

• Keep things simple

• Accept change

• Test early and often

• Automate tests and deployment

Page 37: Enterprise PHP

Questions ??


Top Related