Friday Oct 16, 2009

OOW and Social Networking

In case you missed the Oracle BMW sailboat (doubt you did), here it is.

The event itself was quite energizing and technology centric, filled with events, two exhibit floors, and multiple sessions. Exhibit floors included Cloud vendors like Amazon, as Oracle is available on EC2. There was a large presence by with their CRM on the cloud and developer cloud offerings. The Oracle development team had a long stretch of booths on the expo floor as well. Below are a few technology snapshots that particularly apply to Social Networking applications.

To improve performance and scalability of PHP applications, you can pool DB connections with Oracle's Database Resident Connection Pool (DRCP). This is important because by default, HTTP requests are handled by individual process in the following manner. A PHP application is deployed on an Apache server using a mod_php module. Individual HTTP requests are processed within a corresponding Apache child process, which is spawned for each request. All resources, including the database connections, are created and destroyed within the context of that child process. However, creating individual database connections for each HTTP request is a resource expensive operation. Oracle's DRCP allows PHP applications to leverage a connection pool. DRCP keeps track of open connections and recycles them in a fashion similar to a JDBC connection pool. It times out idle connections and a Connection Broker of DRCP manages incoming connection requests. Using persistent db connections improves web application scalability.

Mapping and GIS applications can leverage Oracle's database spatial and mapping technology. With Oracle Locator you can quickly calculate a distance from point A to point B, trace a travel route, and perform amny other mapping functions. Most startups in the GIS space rely on PostgreSQL, but if you happen to use Oracle there are definitely many useful features you can utilize.

Oracle's open source, in-memory database, Berkeley DB transactional data store, is used across a multitude popular Web 2.0 apps. To name a few, MemcacheD uses Berkeley DB as it's core in-memory engine. It's often used as an embedded DB. For example, Sun's large scale, open source, networking platform for gaming and virtual world applications, Project Darkstar, also leverages Berkeley DB. Berkeley DB is also used by Internet Archive's Wayback Machine and Heretrix, an open source Internet crawler project. Ulike TimesTen, Berkeley DB is not designed with a primary goal of SQL query execution, instead it can be used as a key-value pair for large objects. The db stores data in a shallow B+ tree, which contributes to quick data retrieval as well as fast writes. The implementation is available in C and Java.

Oracle's Open Source resources can be found here.

Aside from the Oracle technologies that can be applied for building Social Networking applications, partner applications were a big part of the exhibit. There were multiple startups (in SSE definition) that demonstrated technologies for efficient data transfer, data archival and replication.

Tuesday Jun 23, 2009

PHP Unit Testing

At this month's LAMP meetup we had an educational talk on Unit Testing by Jakob Heuser, a web engineer from LinkedIn. In PHP, there are a number of frameworks used by developers including SnapTest, PHPUnit, SimpleTest, and Tesrilence. The main principle behind Unit Testing is to validate application requirements.  This includes checking application logic that implements a give requirements, making sure the fault flows are managed accordingly, and various conditional boundaries are satisfied. Unit testing focuses on testing smallest component of the program, such as function, public method, or an include file. With SnapTest, it is pretty straight forward to get started. After implementing PHP classes to test the application you can start multiple tests simultaneously to expedite the testing process. While SnapTest has a low starting barrier, testing frameworks like PHPUnit is a much more comprehensive framework. But regardless of the framework that you pick, here is an ideal order in which you should be building and testing your application:
  1. design your class/API
  2. create a test suite
  3. implement the class/API
  4. run the test suite
  5. fix failures or errors and go to #4 again
After all test suites were ran and errors have been fixed, it's a good time to do refactoring and simplify the application logic, create a more elegant implementation, and then obviously run the tests again to make sure that newly introduced logic doesn't break anything else in the program.

Jakob maintains and contributes towards SnapTest framework and his presentation is available at:

Thursday Jan 29, 2009

From OO PHP Design to Implementation

The last two meetups of the Greater SF LAMP community that we host at Sun campus were focused around PHP development. The December one had an exciting topic on Object Oriented Design Patterns for PHP presented by Robert Gonzalez of Bay Alarm. What's interesting since I've started working with the Web 2.0 community I rarely heard the word pattern that we traditionally apply in the sw architecture, the main emphasis is on functionality and the business ideas fostering the implementation. However, with PHP 5 you can apply the Object Oriented principles and achieve an elegant application architecture, well beyond 'just getting the job done'. The speaker went over a few patterns that I'm used in the Java world, and shown examples of how to apply them in PHP. The traditional Singleton and Factory patterns were discussed. Also the Strategy Pattern was an interesting one as it encapsulates a set of algorithms that change and leaves out what doesn't change. This pattern makes encapsulated algorithms that are interchangeable. It favors composition over inheritance. A ComputerPlatform interface can have multiple implementations such as ComputerPlatform_Mac, ComputerPlatform_Solaris, ComputerPlatform_Windows that all implement a given method, but individual implementation may vary. All in all it was a great session and there are already quite a few books out there that discuss patterns with PHP as the language matures.

This month the two speakers covered NetBeans IDE and Aptana's IDE around their PHP support. So from design to implementation, if you attended both of these sessions, you're armed with all you need to create PHP applications.


Marina Fisher is a member of Oracle ISV Engineering team, posting blogs around industries, technologies, and applications she is working with.


« June 2016