international php2011_kore nordmann_tobias schlitt_modular application architecture

102
HTTP is your architecture International PHP Conference Spring Edition Kore Nordmann (@koredn) Tobias Schlitt (@tobySen) May 31, 2011 HTTP is your architecture 1 / 34

Upload: smuellersandsmedia

Post on 20-Jun-2015

339 views

Category:

Technology


0 download

TRANSCRIPT

Page 1: international PHP2011_Kore Nordmann_Tobias Schlitt_Modular Application Architecture

HTTP is your architectureInternational PHP Conference Spring Edition

Kore Nordmann (@koredn)Tobias Schlitt (@tobySen)

May 31, 2011

HTTP is your architecture 1 / 34

Page 2: international PHP2011_Kore Nordmann_Tobias Schlitt_Modular Application Architecture

About us

I Degree in computer sience

I More than 10 years ofprofessional PHP

I Open source enthusiasts

I Contributing to variousFLOSS projects

Qafoopassion for software quality

HTTP is your architecture 2 / 34

Page 3: international PHP2011_Kore Nordmann_Tobias Schlitt_Modular Application Architecture

About us

I Degree in computer sience

I More than 10 years ofprofessional PHP

I Open source enthusiasts

I Contributing to variousFLOSS projects

Qafoopassion for software quality

HTTP is your architecture 2 / 34

Page 4: international PHP2011_Kore Nordmann_Tobias Schlitt_Modular Application Architecture

About us

I Degree in computer sience

I More than 10 years ofprofessional PHP

I Open source enthusiasts

I Contributing to variousFLOSS projects

Qafoopassion for software quality

HTTP is your architecture 2 / 34

Page 5: international PHP2011_Kore Nordmann_Tobias Schlitt_Modular Application Architecture

About us

I Degree in computer sience

I More than 10 years ofprofessional PHP

I Open source enthusiasts

I Contributing to variousFLOSS projects

Co-founders of

Qafoopassion for software quality

HTTP is your architecture 2 / 34

Page 6: international PHP2011_Kore Nordmann_Tobias Schlitt_Modular Application Architecture

About us

I Degree in computer sience

I More than 10 years ofprofessional PHP

I Open source enthusiasts

I Contributing to variousFLOSS projects

Co-founders of

Qafoopassion for software quality

We help people to createhigh quality PHP

applications.

HTTP is your architecture 2 / 34

Page 7: international PHP2011_Kore Nordmann_Tobias Schlitt_Modular Application Architecture

About us

I Degree in computer sience

I More than 10 years ofprofessional PHP

I Open source enthusiasts

I Contributing to variousFLOSS projects

Co-founders of

Qafoopassion for software quality

We help people to createhigh quality PHP

applications.

http://qafoo.com

HTTP is your architecture 2 / 34

Page 8: international PHP2011_Kore Nordmann_Tobias Schlitt_Modular Application Architecture

Outline

Introduction

HTTP

Taking it further

Conclusion

HTTP is your architecture 3 / 34

Page 9: international PHP2011_Kore Nordmann_Tobias Schlitt_Modular Application Architecture

Aspects of a web application

I Scalability

I Reliability

I Simplicity

I Usability

I Security

I Standard Compliance

HTTP is your architecture 4 / 34

Page 10: international PHP2011_Kore Nordmann_Tobias Schlitt_Modular Application Architecture

Architecture

LCoDC$SS

I Who heard of this term before?I This is HTTP. [Fie00]

HTTP is your architecture 5 / 34

Page 11: international PHP2011_Kore Nordmann_Tobias Schlitt_Modular Application Architecture

Architecture

LCoDC$SS

I Who heard of this term before?I This is HTTP. [Fie00]

HTTP is your architecture 5 / 34

Page 12: international PHP2011_Kore Nordmann_Tobias Schlitt_Modular Application Architecture

Architecture

LCoDC$SS

I Who heard of this term before?I This is HTTP. [Fie00]

HTTP is your architecture 5 / 34

Page 13: international PHP2011_Kore Nordmann_Tobias Schlitt_Modular Application Architecture

Architecture

LCoDC$SS

HTTP is your architecture 6 / 34

Page 14: international PHP2011_Kore Nordmann_Tobias Schlitt_Modular Application Architecture

Architecture

Layered CoDC$SS

HTTP is your architecture 6 / 34

Page 15: international PHP2011_Kore Nordmann_Tobias Schlitt_Modular Application Architecture

Architecture

Layered Code on Demand C$SS

HTTP is your architecture 6 / 34

Page 16: international PHP2011_Kore Nordmann_Tobias Schlitt_Modular Application Architecture

Architecture

Layered Code on Demand Client $S Server

HTTP is your architecture 6 / 34

Page 17: international PHP2011_Kore Nordmann_Tobias Schlitt_Modular Application Architecture

Architecture

Layered Code on Demand Client Cached S

Server

HTTP is your architecture 6 / 34

Page 18: international PHP2011_Kore Nordmann_Tobias Schlitt_Modular Application Architecture

Architecture

Layered Code on Demand Client Cached

Stateless Server

HTTP is your architecture 6 / 34

Page 19: international PHP2011_Kore Nordmann_Tobias Schlitt_Modular Application Architecture

Outline

Introduction

HTTP

Taking it further

Conclusion

HTTP is your architecture 7 / 34

Page 20: international PHP2011_Kore Nordmann_Tobias Schlitt_Modular Application Architecture

Outline

HTTPLayered architectureRequest semanticsStateless serverCode on demand

HTTP is your architecture 8 / 34

Page 21: international PHP2011_Kore Nordmann_Tobias Schlitt_Modular Application Architecture

Layered architecture

I What is required?I Request semanticI Stateless server

Client

Database

Application

HTTP

HTTP is your architecture 9 / 34

Page 22: international PHP2011_Kore Nordmann_Tobias Schlitt_Modular Application Architecture

Layered architecture

I What is required?I Request semanticI Stateless server

Client

Database

Application

HTTP

HTTP is your architecture 9 / 34

Page 23: international PHP2011_Kore Nordmann_Tobias Schlitt_Modular Application Architecture

Layered architecture

I What is required?I Request semanticI Stateless server

Client

Database

Application

Proxy

HTTP

HTTP

HTTP is your architecture 9 / 34

Page 24: international PHP2011_Kore Nordmann_Tobias Schlitt_Modular Application Architecture

Layered architecture

I What is required?I Request semanticI Stateless server

Client

Database

Application

HTTP

HTTP

LoadBalancer

HTTP is your architecture 9 / 34

Page 25: international PHP2011_Kore Nordmann_Tobias Schlitt_Modular Application Architecture

Outline

HTTPLayered architectureRequest semanticsStateless serverCode on demand

HTTP is your architecture 10 / 34

Page 26: international PHP2011_Kore Nordmann_Tobias Schlitt_Modular Application Architecture

HTTP methods

I Well knownI GETI POST

I Less knownI PUTI DELETE

I Mostly unknownI HEADI OPTIONSI TRACEI CONNECT

I WebDAVI MKCOLI PROPSETI PROPGET

I Use any you want. . .

HTTP is your architecture 11 / 34

Page 27: international PHP2011_Kore Nordmann_Tobias Schlitt_Modular Application Architecture

HTTP methods

I Well knownI GETI POST

I Less knownI PUTI DELETE

I Mostly unknownI HEADI OPTIONSI TRACEI CONNECT

I WebDAVI MKCOLI PROPSETI PROPGET

I Use any you want. . .

HTTP is your architecture 11 / 34

Page 28: international PHP2011_Kore Nordmann_Tobias Schlitt_Modular Application Architecture

HTTP methods

I Well knownI GETI POST

I Less knownI PUTI DELETE

I Mostly unknownI HEADI OPTIONSI TRACEI CONNECT

I WebDAVI MKCOLI PROPSETI PROPGET

I Use any you want. . .

HTTP is your architecture 11 / 34

Page 29: international PHP2011_Kore Nordmann_Tobias Schlitt_Modular Application Architecture

HTTP methods

I Well knownI GETI POST

I Less knownI PUTI DELETE

I Mostly unknownI HEADI OPTIONSI TRACEI CONNECT

I WebDAVI MKCOLI PROPSETI PROPGET

I Use any you want. . .

HTTP is your architecture 11 / 34

Page 30: international PHP2011_Kore Nordmann_Tobias Schlitt_Modular Application Architecture

HTTP methods

I Well knownI GETI POST

I Less knownI PUTI DELETE

I Mostly unknownI HEADI OPTIONSI TRACEI CONNECT

I WebDAVI MKCOLI PROPSETI PROPGET

I Use any you want. . .

HTTP is your architecture 11 / 34

Page 31: international PHP2011_Kore Nordmann_Tobias Schlitt_Modular Application Architecture

“Safe” HTTP methods

[..] GET and HEAD methods SHOULD NOT have the significanceof taking an action other than retrieval. [RF99]

I . . . so it is safe for spiders to call them.I Since nothing is modified, the result can be cached.

I Proxies can use that automaticallyI Varnish / SquidI Company application proxies

I Layered Code on Demand Client Cached Stateless Server

HTTP is your architecture 12 / 34

Page 32: international PHP2011_Kore Nordmann_Tobias Schlitt_Modular Application Architecture

“Safe” HTTP methods

[..] GET and HEAD methods SHOULD NOT have the significanceof taking an action other than retrieval. [RF99]

I . . . so it is safe for spiders to call them.I Since nothing is modified, the result can be cached.

I Proxies can use that automaticallyI Varnish / SquidI Company application proxies

I Layered Code on Demand Client Cached Stateless Server

HTTP is your architecture 12 / 34

Page 33: international PHP2011_Kore Nordmann_Tobias Schlitt_Modular Application Architecture

“Safe” HTTP methods

[..] GET and HEAD methods SHOULD NOT have the significanceof taking an action other than retrieval. [RF99]

I . . . so it is safe for spiders to call them.I Since nothing is modified, the result can be cached.

I Proxies can use that automaticallyI Varnish / SquidI Company application proxies

I Layered Code on Demand Client Cached Stateless Server

HTTP is your architecture 12 / 34

Page 34: international PHP2011_Kore Nordmann_Tobias Schlitt_Modular Application Architecture

“Safe” HTTP methods

[..] GET and HEAD methods SHOULD NOT have the significanceof taking an action other than retrieval. [RF99]

I . . . so it is safe for spiders to call them.I Since nothing is modified, the result can be cached.

I Proxies can use that automaticallyI Varnish / SquidI Company application proxies

I Layered Code on Demand Client Cached Stateless Server

HTTP is your architecture 12 / 34

Page 35: international PHP2011_Kore Nordmann_Tobias Schlitt_Modular Application Architecture

Is your search form broken?

1 <form ac t i on=”/ s e a r ch ” method=”POST”>2 <i npu t type=” t e x t ” name=”term” />3 <i npu t type=” submit ” va lue=”Search ! ” />4 </ form>

I Broken semanticsI Search results may not be cached

I No bookmarking of search results

HTTP is your architecture 13 / 34

Page 36: international PHP2011_Kore Nordmann_Tobias Schlitt_Modular Application Architecture

Is your search form broken?

1 <form ac t i on=”/ s e a r ch ” method=”POST”>2 <i npu t type=” t e x t ” name=”term” />3 <i npu t type=” submit ” va lue=”Search ! ” />4 </ form>

I Broken semanticsI Search results may not be cached

I No bookmarking of search results

HTTP is your architecture 13 / 34

Page 37: international PHP2011_Kore Nordmann_Tobias Schlitt_Modular Application Architecture

Is your search form broken?

1 <form ac t i on=”/ s e a r ch ” method=”POST”>2 <i npu t type=” t e x t ” name=”term” />3 <i npu t type=” submit ” va lue=”Search ! ” />4 </ form>

I Broken semanticsI Search results may not be cached

I No bookmarking of search results

HTTP is your architecture 13 / 34

Page 38: international PHP2011_Kore Nordmann_Tobias Schlitt_Modular Application Architecture

POST vs. PUT

I POSTI . . . is used to request that the origin server accept the entity

enclosed in the request as a new subordinate . . . [RF99]I Appends to an existing resource!

I e.g. an existing collection of documentsI Examples

I Posting a message to a bulletin boardI Extending a database through an append operation

I PUTI . . . requests that the enclosed entity be stored under the

supplied Request-URI. [RF99]I Creates or replaces a resource!I Examples

I Updating account data using (PUT /users/42)I Create a new resource with known identifier

HTTP is your architecture 14 / 34

Page 39: international PHP2011_Kore Nordmann_Tobias Schlitt_Modular Application Architecture

POST vs. PUT

I POSTI . . . is used to request that the origin server accept the entity

enclosed in the request as a new subordinate . . . [RF99]I Appends to an existing resource!

I e.g. an existing collection of documentsI Examples

I Posting a message to a bulletin boardI Extending a database through an append operation

I PUTI . . . requests that the enclosed entity be stored under the

supplied Request-URI. [RF99]I Creates or replaces a resource!I Examples

I Updating account data using (PUT /users/42)I Create a new resource with known identifier

HTTP is your architecture 14 / 34

Page 40: international PHP2011_Kore Nordmann_Tobias Schlitt_Modular Application Architecture

POST vs. PUT

I POSTI . . . is used to request that the origin server accept the entity

enclosed in the request as a new subordinate . . . [RF99]I Appends to an existing resource!

I e.g. an existing collection of documentsI Examples

I Posting a message to a bulletin boardI Extending a database through an append operation

I PUTI . . . requests that the enclosed entity be stored under the

supplied Request-URI. [RF99]I Creates or replaces a resource!I Examples

I Updating account data using (PUT /users/42)I Create a new resource with known identifier

HTTP is your architecture 14 / 34

Page 41: international PHP2011_Kore Nordmann_Tobias Schlitt_Modular Application Architecture

POST vs. PUT

I POSTI . . . is used to request that the origin server accept the entity

enclosed in the request as a new subordinate . . . [RF99]I Appends to an existing resource!

I e.g. an existing collection of documentsI Examples

I Posting a message to a bulletin boardI Extending a database through an append operation

I PUTI . . . requests that the enclosed entity be stored under the

supplied Request-URI. [RF99]I Creates or replaces a resource!I Examples

I Updating account data using (PUT /users/42)I Create a new resource with known identifier

HTTP is your architecture 14 / 34

Page 42: international PHP2011_Kore Nordmann_Tobias Schlitt_Modular Application Architecture

POST vs. PUT

I POSTI . . . is used to request that the origin server accept the entity

enclosed in the request as a new subordinate . . . [RF99]I Appends to an existing resource!

I e.g. an existing collection of documentsI Examples

I Posting a message to a bulletin boardI Extending a database through an append operation

I PUTI . . . requests that the enclosed entity be stored under the

supplied Request-URI. [RF99]I Creates or replaces a resource!I Examples

I Updating account data using (PUT /users/42)I Create a new resource with known identifier

HTTP is your architecture 14 / 34

Page 43: international PHP2011_Kore Nordmann_Tobias Schlitt_Modular Application Architecture

POST vs. PUT

I POSTI . . . is used to request that the origin server accept the entity

enclosed in the request as a new subordinate . . . [RF99]I Appends to an existing resource!

I e.g. an existing collection of documentsI Examples

I Posting a message to a bulletin boardI Extending a database through an append operation

I PUTI . . . requests that the enclosed entity be stored under the

supplied Request-URI. [RF99]I Creates or replaces a resource!I Examples

I Updating account data using (PUT /users/42)I Create a new resource with known identifier

HTTP is your architecture 14 / 34

Page 44: international PHP2011_Kore Nordmann_Tobias Schlitt_Modular Application Architecture

POST vs. PUT

I POSTI . . . is used to request that the origin server accept the entity

enclosed in the request as a new subordinate . . . [RF99]I Appends to an existing resource!

I e.g. an existing collection of documentsI Examples

I Posting a message to a bulletin boardI Extending a database through an append operation

I PUTI . . . requests that the enclosed entity be stored under the

supplied Request-URI. [RF99]I Creates or replaces a resource!I Examples

I Updating account data using (PUT /users/42)I Create a new resource with known identifier

HTTP is your architecture 14 / 34

Page 45: international PHP2011_Kore Nordmann_Tobias Schlitt_Modular Application Architecture

POST vs. PUT

I POSTI . . . is used to request that the origin server accept the entity

enclosed in the request as a new subordinate . . . [RF99]I Appends to an existing resource!

I e.g. an existing collection of documentsI Examples

I Posting a message to a bulletin boardI Extending a database through an append operation

I PUTI . . . requests that the enclosed entity be stored under the

supplied Request-URI. [RF99]I Creates or replaces a resource!I Examples

I Updating account data using (PUT /users/42)I Create a new resource with known identifier

HTTP is your architecture 14 / 34

Page 46: international PHP2011_Kore Nordmann_Tobias Schlitt_Modular Application Architecture

HTML 5 is broken!

Using PUT and DELETE as HTTP methods for the form elementis no longer supported. [vK10]

HTTP is your architecture 15 / 34

Page 47: international PHP2011_Kore Nordmann_Tobias Schlitt_Modular Application Architecture

Idempotent methods

f (x) = f (f (x))

I Everything but POST has to be idempotentI Executing the request again, should not change anything.I This includes PUT and DELETE

I Really useful to just resend request, if one failed due tonetwork problems

I Idempotence is a useful property in all messaging systems

HTTP is your architecture 16 / 34

Page 48: international PHP2011_Kore Nordmann_Tobias Schlitt_Modular Application Architecture

Idempotent methods

f (x) = f (f (x))

I Everything but POST has to be idempotentI Executing the request again, should not change anything.I This includes PUT and DELETE

I Really useful to just resend request, if one failed due tonetwork problems

I Idempotence is a useful property in all messaging systems

HTTP is your architecture 16 / 34

Page 49: international PHP2011_Kore Nordmann_Tobias Schlitt_Modular Application Architecture

Idempotent methods

f (x) = f (f (x))

I Everything but POST has to be idempotentI Executing the request again, should not change anything.I This includes PUT and DELETE

I Really useful to just resend request, if one failed due tonetwork problems

I Idempotence is a useful property in all messaging systems

HTTP is your architecture 16 / 34

Page 50: international PHP2011_Kore Nordmann_Tobias Schlitt_Modular Application Architecture

Idempotent methods

f (x) = f (f (x))

I Everything but POST has to be idempotentI Executing the request again, should not change anything.I This includes PUT and DELETE

I Really useful to just resend request, if one failed due tonetwork problems

I Idempotence is a useful property in all messaging systems

HTTP is your architecture 16 / 34

Page 51: international PHP2011_Kore Nordmann_Tobias Schlitt_Modular Application Architecture

Idempotent methods

f (x) = f (f (x))

I Everything but POST has to be idempotentI Executing the request again, should not change anything.I This includes PUT and DELETE

I Really useful to just resend request, if one failed due tonetwork problems

I Idempotence is a useful property in all messaging systems

HTTP is your architecture 16 / 34

Page 52: international PHP2011_Kore Nordmann_Tobias Schlitt_Modular Application Architecture

HTTP method fail in PHP

I $ GET contains the request parameters

I $ POST contains the request bodyI All HTTP requests may contain body and parameters

I Yes, even GET!

I You may want to use something likeI $request->parametersI $request->body

HTTP is your architecture 17 / 34

Page 53: international PHP2011_Kore Nordmann_Tobias Schlitt_Modular Application Architecture

HTTP method fail in PHP

I $ GET contains the request parameters

I $ POST contains the request bodyI All HTTP requests may contain body and parameters

I Yes, even GET!

I You may want to use something likeI $request->parametersI $request->body

HTTP is your architecture 17 / 34

Page 54: international PHP2011_Kore Nordmann_Tobias Schlitt_Modular Application Architecture

HTTP method fail in PHP

I $ GET contains the request parameters

I $ POST contains the request bodyI All HTTP requests may contain body and parameters

I Yes, even GET!

I You may want to use something likeI $request->parametersI $request->body

HTTP is your architecture 17 / 34

Page 55: international PHP2011_Kore Nordmann_Tobias Schlitt_Modular Application Architecture

HTTP method fail in PHP

I $ GET contains the request parameters

I $ POST contains the request bodyI All HTTP requests may contain body and parameters

I Yes, even GET!

I You may want to use something likeI $request->parametersI $request->body

HTTP is your architecture 17 / 34

Page 56: international PHP2011_Kore Nordmann_Tobias Schlitt_Modular Application Architecture

Do you speak HTTP?

I GET and HEAD must be supported

I All other methods are optional

I But if you implement them, they must obey to semanticsI Sorry, your website is not HTTP, if you . . .

I . . . are using POST for a search form.I . . . are using POST for data updates.

HTTP is your architecture 18 / 34

Page 57: international PHP2011_Kore Nordmann_Tobias Schlitt_Modular Application Architecture

Do you speak HTTP?

I GET and HEAD must be supported

I All other methods are optional

I But if you implement them, they must obey to semanticsI Sorry, your website is not HTTP, if you . . .

I . . . are using POST for a search form.I . . . are using POST for data updates.

HTTP is your architecture 18 / 34

Page 58: international PHP2011_Kore Nordmann_Tobias Schlitt_Modular Application Architecture

Do you speak HTTP?

I GET and HEAD must be supported

I All other methods are optional

I But if you implement them, they must obey to semanticsI Sorry, your website is not HTTP, if you . . .

I . . . are using POST for a search form.I . . . are using POST for data updates.

HTTP is your architecture 18 / 34

Page 59: international PHP2011_Kore Nordmann_Tobias Schlitt_Modular Application Architecture

Do you speak HTTP?

I GET and HEAD must be supported

I All other methods are optional

I But if you implement them, they must obey to semanticsI Sorry, your website is not HTTP, if you . . .

I . . . are using POST for a search form.I . . . are using POST for data updates.

HTTP is your architecture 18 / 34

Page 60: international PHP2011_Kore Nordmann_Tobias Schlitt_Modular Application Architecture

Outline

HTTPLayered architectureRequest semanticsStateless serverCode on demand

HTTP is your architecture 19 / 34

Page 61: international PHP2011_Kore Nordmann_Tobias Schlitt_Modular Application Architecture

Stateless server

I No persistent connectionI Each request contains all information to be processed

I Cookies

I Servers can be exchanged transparentlyI Mind the sessions and static data

I Layered Code on Demand Client Cached Stateless Server

HTTP is your architecture 20 / 34

Page 62: international PHP2011_Kore Nordmann_Tobias Schlitt_Modular Application Architecture

Stateless server

I No persistent connectionI Each request contains all information to be processed

I Cookies

I Servers can be exchanged transparentlyI Mind the sessions and static data

I Layered Code on Demand Client Cached Stateless Server

HTTP is your architecture 20 / 34

Page 63: international PHP2011_Kore Nordmann_Tobias Schlitt_Modular Application Architecture

Stateless server

I No persistent connectionI Each request contains all information to be processed

I Cookies

I Servers can be exchanged transparentlyI Mind the sessions and static data

I Layered Code on Demand Client Cached Stateless Server

HTTP is your architecture 20 / 34

Page 64: international PHP2011_Kore Nordmann_Tobias Schlitt_Modular Application Architecture

Stateless server

I No persistent connectionI Each request contains all information to be processed

I Cookies

I Servers can be exchanged transparentlyI Mind the sessions and static data

I Layered Code on Demand Client Cached Stateless Server

HTTP is your architecture 20 / 34

Page 65: international PHP2011_Kore Nordmann_Tobias Schlitt_Modular Application Architecture

Stateless server

I No persistent connectionI Each request contains all information to be processed

I Cookies

I Servers can be exchanged transparentlyI Mind the sessions and static data

I Layered Code on Demand Client Cached Stateless Server

HTTP is your architecture 20 / 34

Page 66: international PHP2011_Kore Nordmann_Tobias Schlitt_Modular Application Architecture

Drawbacks / Benefits

I DrawbacksI Users do have state

I BenefitsI ScalabilityI FailoverI Simplicity

HTTP is your architecture 21 / 34

Page 67: international PHP2011_Kore Nordmann_Tobias Schlitt_Modular Application Architecture

Drawbacks / Benefits

I DrawbacksI Users do have state

I BenefitsI ScalabilityI FailoverI Simplicity

HTTP is your architecture 21 / 34

Page 68: international PHP2011_Kore Nordmann_Tobias Schlitt_Modular Application Architecture

Drawbacks / Benefits

I DrawbacksI Users do have state

I BenefitsI ScalabilityI FailoverI Simplicity

HTTP is your architecture 21 / 34

Page 69: international PHP2011_Kore Nordmann_Tobias Schlitt_Modular Application Architecture

Drawbacks / Benefits

I DrawbacksI Users do have state

I BenefitsI ScalabilityI FailoverI Simplicity

HTTP is your architecture 21 / 34

Page 70: international PHP2011_Kore Nordmann_Tobias Schlitt_Modular Application Architecture

Drawbacks / Benefits

I DrawbacksI Users do have state

I BenefitsI ScalabilityI FailoverI Simplicity

HTTP is your architecture 21 / 34

Page 71: international PHP2011_Kore Nordmann_Tobias Schlitt_Modular Application Architecture

Share nothing!

I PHP itself follows a share nothing architectureI Clean PHP instance for each requestI By default no shared resources

I It’s your job to obey to it!I Session storage?I Database server?I File access?

I App servers usually suck!

HTTP is your architecture 22 / 34

Page 72: international PHP2011_Kore Nordmann_Tobias Schlitt_Modular Application Architecture

Share nothing!

I PHP itself follows a share nothing architectureI Clean PHP instance for each requestI By default no shared resources

I It’s your job to obey to it!I Session storage?I Database server?I File access?

I App servers usually suck!

HTTP is your architecture 22 / 34

Page 73: international PHP2011_Kore Nordmann_Tobias Schlitt_Modular Application Architecture

Share nothing!

I PHP itself follows a share nothing architectureI Clean PHP instance for each requestI By default no shared resources

I It’s your job to obey to it!I Session storage?I Database server?I File access?

I App servers usually suck!

HTTP is your architecture 22 / 34

Page 74: international PHP2011_Kore Nordmann_Tobias Schlitt_Modular Application Architecture

Share nothing!

I PHP itself follows a share nothing architectureI Clean PHP instance for each requestI By default no shared resources

I It’s your job to obey to it!I Session storage?I Database server?I File access?

I App servers usually suck!

HTTP is your architecture 22 / 34

Page 75: international PHP2011_Kore Nordmann_Tobias Schlitt_Modular Application Architecture

Share nothing!

I PHP itself follows a share nothing architectureI Clean PHP instance for each requestI By default no shared resources

I It’s your job to obey to it!I Session storage?I Database server?I File access?

I App servers usually suck!

HTTP is your architecture 22 / 34

Page 76: international PHP2011_Kore Nordmann_Tobias Schlitt_Modular Application Architecture

Outline

HTTPLayered architectureRequest semanticsStateless serverCode on demand

HTTP is your architecture 23 / 34

Page 77: international PHP2011_Kore Nordmann_Tobias Schlitt_Modular Application Architecture

Do you?

In the code-on-demand style, a client component . . . receives thatcode, and executes it locally. [Fie00]

I Do you deliver code on demand?I You do!

I JavaScriptI HTML is also just code

although not turing complete

I Layered Code on Demand Client Cached Stateless Server

HTTP is your architecture 24 / 34

Page 78: international PHP2011_Kore Nordmann_Tobias Schlitt_Modular Application Architecture

Do you?

In the code-on-demand style, a client component . . . receives thatcode, and executes it locally. [Fie00]

I Do you deliver code on demand?I You do!

I JavaScriptI HTML is also just code

although not turing complete

I Layered Code on Demand Client Cached Stateless Server

HTTP is your architecture 24 / 34

Page 79: international PHP2011_Kore Nordmann_Tobias Schlitt_Modular Application Architecture

Do you?

In the code-on-demand style, a client component . . . receives thatcode, and executes it locally. [Fie00]

I Do you deliver code on demand?I You do!

I JavaScriptI HTML is also just code

although not turing complete

I Layered Code on Demand Client Cached Stateless Server

HTTP is your architecture 24 / 34

Page 80: international PHP2011_Kore Nordmann_Tobias Schlitt_Modular Application Architecture

Do you?

In the code-on-demand style, a client component . . . receives thatcode, and executes it locally. [Fie00]

I Do you deliver code on demand?I You do!

I JavaScriptI HTML is also just code

although not turing complete

I Layered Code on Demand Client Cached Stateless Server

HTTP is your architecture 24 / 34

Page 81: international PHP2011_Kore Nordmann_Tobias Schlitt_Modular Application Architecture

Do you?

In the code-on-demand style, a client component . . . receives thatcode, and executes it locally. [Fie00]

I Do you deliver code on demand?I You do!

I JavaScriptI HTML is also just code

although not turing complete

I Layered Code on Demand Client Cached Stateless Server

HTTP is your architecture 24 / 34

Page 82: international PHP2011_Kore Nordmann_Tobias Schlitt_Modular Application Architecture

Do you?

In the code-on-demand style, a client component . . . receives thatcode, and executes it locally. [Fie00]

I Do you deliver code on demand?I You do!

I JavaScriptI HTML is also just code

although not turing complete

I Layered Code on Demand Client Cached Stateless Server

HTTP is your architecture 24 / 34

Page 83: international PHP2011_Kore Nordmann_Tobias Schlitt_Modular Application Architecture

Security

Code generation is the root cause for webb application securityproblems.

I Escape for target context / language (XSS)

HTTP is your architecture 25 / 34

Page 84: international PHP2011_Kore Nordmann_Tobias Schlitt_Modular Application Architecture

Security

Code generation is the root cause for webb application securityproblems.

I Escape for target context / language (XSS)

HTTP is your architecture 25 / 34

Page 85: international PHP2011_Kore Nordmann_Tobias Schlitt_Modular Application Architecture

Outline

Introduction

HTTP

Taking it further

Conclusion

HTTP is your architecture 26 / 34

Page 86: international PHP2011_Kore Nordmann_Tobias Schlitt_Modular Application Architecture

Embrace HTTP

Client

Application

Storage

HTTP

HTTP

LoadBalancer

Cache

HTTP

LoadBalancer

Cache

HTTP

HTTP

HTTP

HTTP is your architecture 27 / 34

Page 87: international PHP2011_Kore Nordmann_Tobias Schlitt_Modular Application Architecture

Embrace HTTP

Client

Application

Storage

HTTP

HTTP

LoadBalancer

Cache

HTTP

LoadBalancer

Cache

HTTP

HTTP

HTTP

Attentio

n,

Single Point o

f Failu

re!

HTTP is your architecture 27 / 34

Page 88: international PHP2011_Kore Nordmann_Tobias Schlitt_Modular Application Architecture

Use HTTP actively

I Semantic HTTP methods

I URIs (address resources)

I Status codesI Headers

I Cache controlI Content negotiationI . . .

HTTP is your architecture 28 / 34

Page 89: international PHP2011_Kore Nordmann_Tobias Schlitt_Modular Application Architecture

What about REST?

I What is REST actually?I “New” style web servicesI Follow HTTP / LCoDC$SSI Follow resources / concept character of URIsI Use proper status codesI HATEOAS

I Hypermedia as the Engine of Application State [Fie00]I Short: Use hyper links to delegate client

HTTP is your architecture 29 / 34

Page 90: international PHP2011_Kore Nordmann_Tobias Schlitt_Modular Application Architecture

What about REST?

I What is REST actually?I “New” style web servicesI Follow HTTP / LCoDC$SSI Follow resources / concept character of URIsI Use proper status codesI HATEOAS

I Hypermedia as the Engine of Application State [Fie00]I Short: Use hyper links to delegate client

HTTP is your architecture 29 / 34

Page 91: international PHP2011_Kore Nordmann_Tobias Schlitt_Modular Application Architecture

What about REST?

I What is REST actually?I “New” style web servicesI Follow HTTP / LCoDC$SSI Follow resources / concept character of URIsI Use proper status codesI HATEOAS

I Hypermedia as the Engine of Application State [Fie00]I Short: Use hyper links to delegate client

HTTP is your architecture 29 / 34

Page 92: international PHP2011_Kore Nordmann_Tobias Schlitt_Modular Application Architecture

What about REST?

I What is REST actually?I “New” style web servicesI Follow HTTP / LCoDC$SSI Follow resources / concept character of URIsI Use proper status codesI HATEOAS

I Hypermedia as the Engine of Application State [Fie00]I Short: Use hyper links to delegate client

HTTP is your architecture 29 / 34

Page 93: international PHP2011_Kore Nordmann_Tobias Schlitt_Modular Application Architecture

What about REST?

I What is REST actually?I “New” style web servicesI Follow HTTP / LCoDC$SSI Follow resources / concept character of URIsI Use proper status codesI HATEOAS

I Hypermedia as the Engine of Application State [Fie00]I Short: Use hyper links to delegate client

HTTP is your architecture 29 / 34

Page 94: international PHP2011_Kore Nordmann_Tobias Schlitt_Modular Application Architecture

What about REST?

I What is REST actually?I “New” style web servicesI Follow HTTP / LCoDC$SSI Follow resources / concept character of URIsI Use proper status codesI HATEOAS

I Hypermedia as the Engine of Application State [Fie00]I Short: Use hyper links to delegate client

HTTP is your architecture 29 / 34

Page 95: international PHP2011_Kore Nordmann_Tobias Schlitt_Modular Application Architecture

Outline

Introduction

HTTP

Taking it further

Conclusion

HTTP is your architecture 30 / 34

Page 96: international PHP2011_Kore Nordmann_Tobias Schlitt_Modular Application Architecture

Conclusion

Use HTTP!

HTTP is your architecture 31 / 34

Page 97: international PHP2011_Kore Nordmann_Tobias Schlitt_Modular Application Architecture

Conclusion

Use HTTP, properly!

HTTP is your architecture 31 / 34

Page 98: international PHP2011_Kore Nordmann_Tobias Schlitt_Modular Application Architecture

Q/A

Questions? Comments? Feedback?

HTTP is your architecture 32 / 34

Page 99: international PHP2011_Kore Nordmann_Tobias Schlitt_Modular Application Architecture

Thanks for listening

Please rate this talk athttp://joind.in/3502

and (optionally) give us some feedback right now

HTTP is your architecture 33 / 34

Page 100: international PHP2011_Kore Nordmann_Tobias Schlitt_Modular Application Architecture

Thanks for listening

Please rate this talk athttp://joind.in/3502

and (optionally) give us some feedback right now

This is very important for . . .

I Speakers

I Organizers

I You!

HTTP is your architecture 33 / 34

Page 101: international PHP2011_Kore Nordmann_Tobias Schlitt_Modular Application Architecture

Thanks for listening

Please rate this talk athttp://joind.in/3502

and (optionally) give us some feedback right now

Stay in touch

I Kore Nordmann

I [email protected]

I @koredn / @qafoo

I Tobias Schlitt

I [email protected]

I @tobySen / @qafoo

Rent a PHP quality expert:http://qafoo.com

HTTP is your architecture 33 / 34

Page 102: international PHP2011_Kore Nordmann_Tobias Schlitt_Modular Application Architecture

Bibliography I

[Fie00] R. Fielding, Architectural styles and the design of network-basedsoftware architectures, Ph.D. thesis, University of California, Irvine,USA, 2000.

[RF99] et al. R. Fielding, Hypertext transfer protocol – http/1.1,http://tools.ietf.org/html/rfc2616, June 1999.

[vK10] Anne van Kesteren, Html5 differences from html4,http://www.w3.org/TR/2010/WD-html5-diff-20101019/, October2010.

HTTP is your architecture 34 / 34