Skip to main content

By clicking Submit, you agree to the developerWorks terms of use.

The first time you sign into developerWorks, a profile is created for you. Select information in your profile (name, country/region, and company) is displayed to the public and will accompany any content you post. You may update your IBM account at any time.

All information submitted is secure.

  • Close [x]

The first time you sign in to developerWorks, a profile is created for you, so you need to choose a display name. Your display name accompanies the content you post on developerworks.

Please choose a display name between 3-31 characters. Your display name must be unique in the developerWorks community and should not be your email address for privacy reasons.

By clicking Submit, you agree to the developerWorks terms of use.

All information submitted is secure.

  • Close [x]

Mastering Facebook application development with PHP, IBM Rational Application Developer, IBM WebSphere Application Server, and DB2, Part 2: Using Java and PHP in parallel

Jake Miles (jacob.miles@gmail.com), Freelance writer, Conde Nast
Author photo
Jake Miles is a senior developer at Conde Nast, currently working with Facebook, Myspace, and OpenSocial applications, using Java, PHP, Adobe Flex and Javascript. He has been working as a professional developer for 10 years and has been an avid student and tinkerer since he was 10. He also teaches on a volunteer basis, and believes that anyone can learn anything if taught clearly enough.

Summary:  Part 2 of this tutorial series covers the details involved for developing the Facebook application that you started in Part 1. Build a Facebook interface for an existing stock brokerage firm that enables online portfolio management. Learn one approach for dividing an application's functionality between PHP and Java components, and use the Spring framework to apply a standard MVC architecture to the Java™ code. This tutorial series steps you through the process of developing a fully functioning Facebook application using WebSphere® Application Server, Rational® Application Developer, Zend Core for IBM, PHP 5, and DB2®.

View more content in this series

Date:  02 Jun 2008
Level:  Intermediate PDF:  A4 and Letter (554 KB | 42 pages)Get Adobe® Reader®

Activity:  24097 views
Comments:  

Before you start

About this series

This tutorial series steps you through the process of developing a fully functioning Facebook application using WebSphere Application Server, Rational Application Developer, Zend Core for IBM, PHP 5, and DB2. You will build part of the application using Java code and part in PHP 5. Representing an existing stock brokerage firm, you'll add a Facebook interface to their online portfolio management system.

  • In Part 1 you got an overview of Facebook application development, and got started with a barebones application.
  • In Part 2 you will do the initial work of creating the Java side of things -- a Rational Application Developer project and Web application using the popular Spring framework.
  • Part 3 will take on the specifics of implementing a fully functioning Facebook application using FaceBook Markup Language (FBML), FaceBook JavaScript (FBJS), and the Facebook API in both the Java and PHP languages.

About this tutorial

In Part 1 you took a first look at Facebook and then installed the tools you used: IBM's Rational Application Developer environment, Zend Core For IBM with its included installations of Apache 2 and IBM's DB2 Express-C database, and IBM WebSphere Application Server. You then took a detailed tour of Facebook's integration points -- the mechanisms Facebook provides to integrate the application into the social network -- and started some barebones development. You created and configured the application on Facebook, created a test index.php for the Callback URL, and then set up the DB2 database, creating some basic tables and populating them with sample data to get started.

In this tutorial, Part 2 of the series, you will set up a Rational Application Developer project to facilitate Java development, configure a JNDI connection-pooled DB2 data source in IBM WebSphere Application Server, and use the Spring framework to apply an MVC structure to the Java code to impose a structure on JDBC access. You'll then write some general-purpose PHP classes that let you apply the same MVC structure in the PHP code and that let you inject properties into class instances similarly to how you would in Spring. You'll write a general-purpose Db2DataSource PHP class for connecting to DB2, and use mod_rewite and mod_proxy to let PHP and Java coexist transparently at the same URL. This tutorial will structure the Java and PHP worlds as identically as possible, because one barrier to integrating the two is that PHP and Java developers often come from different backgrounds and see the two worlds in different ways. These two languages can coexist within the same application (and the same development team) quite happily, and with a high degree of abstraction and clean structure across the board.


Prerequisites

This tutorial is for Java and PHP developers of varying degrees of experience who want to start writing Facebook applications in Java, PHP or integrate the two as parts of a larger application. It's for PHP developers who want to learn what goes into building a J2EE application using the Spring framework and how to apply an object-oriented structure to their PHP applications, and Java developers who want to start using PHP, perhaps in the interest of adding PHP to an existing Java enterprise.

You should read Mastering Facebook application development, Part 1 before continuing with Part 2.


System requirements

To complete the steps in this tutorial, you need the following software. If you don't have the products installed, or don't have the latest release, you can download free trial versions:

1 of 9 | Next

Comments



static.content.url=http://www.ibm.com/developerworks/js/artrating/
SITE_ID=1
Zone=Rational, WebSphere, Information Management
ArticleID=310576
TutorialTitle=Mastering Facebook application development with PHP, IBM Rational Application Developer, IBM WebSphere Application Server, and DB2, Part 2: Using Java and PHP in parallel
publish-date=06022008
author1-email=jacob.miles@gmail.com
author1-email-cc=troy@backstopmedia.com