download ppt
DESCRIPTION
TRANSCRIPT
New York PHP Conference 2006
Download this presentationhttp://www.jaisenmathai.com/talks/
nyphpcon2006/
About myself● I started doing web development in the late 90's
● I currently work at FotoFlix where we are building an online photo sharing/management application
● Prior to FotoFlix I worked at General Motors and Clear Channel Communications
Overview● What is JSON?● What is AJAX?● Why do PHP, JSON and AJAX make a great team?
● How can you prepare to implement PHP, JSON and AJAX into your web application?
What is JSON?● JavaScript Object Notation● It is an extremely lightweight data-interchange format
● JSON is language independant but uses conventions that are familiar to programmers of the C family of languages
● This includes JavaScript, Perl, Python etc.
What does JSON look like?● Arrays
● [456,7390,96748,142]● [“php”, “perl”, “python”]● [673, “new york”]
● Objects● {“username”: “guest”, “password”: “secret”}
● Nested● {“userData”: {“username”: “guest”, “password”: “secret”}, “Ids”:[1,2,3]}
What are the benefits of JSON?● It is very efficient● Data exchange between client and server is trivial
● Native support for JSON can be compiled into PHP using PECL or alternatively a PEAR library is available
● The compiled support is extremely fast● JSON offers a unique solution to the problem of cross domain scripting
● We will be looking at an example of this later
What about XML?● Developers are often looking for a good way to exchange data
● JSON allows developers to focus on the data instead of worrying about parsing the data back and forth from XML to a native data type
● JSON lets developers pass data back and forth from PHP to JavaScript drastically reducing development time
When not to use JSON● Some applications and libraries choose to use other formats to exchange data and may make the use of JSON a poor decision
● Use JSON where it makes sense
Launch Yahoo! Example
Overview● What is JSON?● What is AJAX?● Why do PHP, JSON and AJAX make a great team?
● How can you prepare to implement PHP, JSON and AJAX into your web application?
What is AJAX?● Asynchronous JavaScript and XML● Define AJAX for this session
● For this session the term AJAX is NOT limited to a specific set of technologies
● We will look at AJAX as an alternative method for a client and server to interact through a web page
AJAX is a new term but it is not a new technology
● Microsoft added support for asynchronous scripting in IE 5
● Prior to IE 5 IFRAMEs were used to achieve these effects
● Google maps is arguably the first AJAX application that got people thinking about new ways to build web applications
What are the benefits of AJAX?● AJAX can improve user experience
● A user can interact with a web page without having to wait for the page to reload
● The perceived responsiveness of a web page can be drastically increased
Some common pitfalls of AJAX● Like any technology that gets a lot of attention AJAX can be misused
● It is important to identify what portions of your application would benefit from AJAX
Launch Zip Code Example
Overview● What is JSON?● What is AJAX?● Why do PHP, JSON and AJAX make a great team?
● How can you prepare to implement PHP, JSON and AJAX into your web application?
Why do PHP, JSON and AJAX make such a great team?
● Because AJAX requires frequent data exchange between PHP on the server and JavaScript on the client...JSON is a natural choice
Can these technologies help your application scale?
● When implemented properly you can minimize bandwidth and server load
● The server can send data to the client using JSON and the client's machine can render the data
● This saves bandwidth● Infrequently requested data can be served to the client on demand resulting in a decrease in the number of database queries executed
● This reduces the load on the server
Launch PHP, JSON and AJAX Example
Overview● What is JSON?● What is AJAX?● Why do PHP, JSON and AJAX make a great team?
● How can you prepare to implement PHP, JSON and AJAX into your web application?
What you need to know to begin implementing these technologies
● Marking up a web page is very different from scripting a web page
● Developing AJAX applications requires a different skillset than traditional web applications
● Requires the developer to be fluent in PHP and JavaScript
How do you put together a good team?● Find developers with strong skills in both PHP and JavaScript
● It will be hard to find developers with lots of experience with AJAX and JSON because they are relatively new technologies
● Look for developers that are eager to learn
How can you equip your team to develop using these technologies?
● Give them time to research the topics using online resources
● Give them an existing problem to “fix” or “improve”
● Send a lead developer to a conference covering these topics... like this one
Overview● What is JSON?● What is AJAX?● Why do PHP, JSON and AJAX make a great team?
● How can you prepare to implement PHP, JSON and AJAX into your web application?
Resources● http://www.php.net● http://www.json.org● http://www.ajaxian.com/● http://pear.php.net/pepr/pepr-proposal-show.php?id=198
● http://www.aurore.net/projects/php-json/
The End