Online Book Reader

Home Category

Facebook Cookbook - Jay Goldman [38]

By Root 738 0


Build your user interface so that it can grow with your application. Drastic interface changes drive users away. Try to imagine the largest possible feature set for your application and then see whether your interface can easily scale up to that level or not. This is an issue we faced with Scrabulous. There were too many useful features and too little space on the user interface to make them easily accessible.

Utilize a support system from day one so that all your user requests are handled in an efficient manner. This helps in bug solving and allows for easy handover to a support team when your application becomes successful.

Language Selection As Architecture


Problem


I hear Ruby on Rails is the best thing since Java, which was the best thing since Perl, which was once a great thing but is now a confusing thing, which is similar to but the reverse of PHP, which was a confusing thing but is becoming great. And then there’s JavaScript, which isn’t Java at all and used to be the bane of everyone’s existence but has come back as the golden child thanks to a household cleaner named Ajax. I’m confused. What should I use to build my app?

Solution


All languages are tools that ultimately can be used to achieve the same goal. Some languages are better at certain tasks, and others dominate different jobs. A paragraph like the question you just asked is sure to upset pretty much anyone with a language preference, which is the very nature of a “religious” war.

This question is, in a sense, like asking whether you should use only a hammer, screwdriver, or monkey wrench to build your house. Always use the right tool for the right job, and always remember to measure twice and cut once.

Discussion


At the risk of wandering innocently into the middle of said religious war, I recommend building Facebook applications using PHP 5. A number of different Client Libraries are available thanks to a very active developer community, but there is only one true ring, and it is known as PHP. You can choose to build your app on one of the other Libraries—and you probably should if you have, for example, an entire .NET stack or have spent the last 10 years becoming a Supreme Perl Monger—but keep in mind that those Libraries get updated after the official one and therefore run the risk of not having access to new features and of breaking when Facebook changes core pieces of Platform.

That said, if you’re following the architecture recommended in Architecting for the Future: Open Web Apps, you can use a combination of different languages by adding a compatibility layer of web services, written in the best language for each frontend, which communicate to your shared backend through a standard data protocol like XML (see Figure 4-6).

Figure 4-6. Architecture with multiple languages

Facebook actually uses a mixed language environment, and it is a big fan of the right-tool-for-the-right-job approach. The Facebook team built a framework called Thrift, which they use to do easy cross-language development, and which they have generously made available to the community at large as part of their Open Source Projects initiative (http://developers.facebook.com/opensource.php/). Mark Slee, one of the developers behind Thrift, has contributed a recipe explaining how you can make use of it in your own applications (see Cross-Language Development with Facebook Thrift).

Cross-Language Development with Facebook Thrift


—Mark Slee (see his bio in Contributors)

Problem


I’m developing a large software system, and I’d rather not standardize on one programming language. I’d like to be able to make service calls and move data between languages, but it needs to be fast and easy to maintain.

Solution


Use Thrift, an open source framework developed by Facebook for cross-language data serialization and remote procedure calls in a high-performance environment.

Thrift facilitates performant interoperability between C++, Java, PHP, Python, Ruby, Erlang, Haskell, C#, Cocoa, Smalltalk, and even OCaml.

Discussion


Thrift uses code

Return Main Page Previous Page Next Page

®Online Book Reader