How can I get started programming a Facebook app?
This is a guest article written by freelance programmer Ville-Matti Hakanpää
In this brief introductory tutorial I will go through some basic aspects of Facebook application development. The work itself is basic app programming, but it's a whole new world and environment. If you have a wonderful idea, Facebook can work as a great distribution channel for you. Heck, even a bad idea can get some attention fast!
Start out with the most basic of questions, though: what makes a good app?
That's the first and most common question people are asking or they should be asking. The best way to start when you're trying to decide what to develop is to look through all the other applications what are inside Facebook already. Facebook applications are listed and rated by users, so there's a feedback loop there too that tells you the kind of things people find useful and engaging.
The most popular one for now is a game called Farmville, with 73 million active users per month, which is over double the next two combined. In general, games are very popular inside Facebook. For me that reveals few things. First of all people like to play games. Entertainment is a hot topic. Second of all, Facebook doesn't have any fun games to offer for own users, hence the popularity of third party apps.
The most popular "ordinary" application is Causes, which provides an opportunity to donate money to different non-profit projects. While charity is important, it doesn't comply with useful, "needed-daily" idea. Think about non-Facebook programs like Google. Would you survive without it? You might, but it makes your life so much easier that you probably choose to use it anyway, many times during the day. If you can create something like that for Facebook, well, you'll have gold in your hands.
Technically you have two different possible approaches you can choose from. You can use Facebook's own technology (FBML, FBJS and FQL) or you can use an API client. Difference is that when you are using FBML (Facebook Markup Language) for example, you are mainly using Facebook's server and its resources. This way you can save you own server. Using API is the complete opposite.
Let's compare these. First let's create a "Hello World" application with PHP5 API client:
// include the Facebook client library
// define your API Key and secret
$facebook_config['api_key'] = '<YOUR_APPLICATIONS_API_KEY>';
$facebook_config['secret'] = '<YOUR_APPLICATIONS_SECRET_KEY>';
// create the Facebook object
$facebook = new Facebook($facebook_config['api_key'], $facebook_config['secret']);
// require user to be logged in'
$user = $facebook->require_login();
// define your callback URL
$callback_url = 'http://<URL_TO_THE_APPLICATION_AT_YOUR_END>/';
And same thing with FBM:
<fb:redirect url="http://www.facebook.com/login.php?v=1.0&api_key=<YOUR_API_KEY>&canvas=http://< URL_TO_THE_APPLICATION_AT_YOUR_END >" />
Both examples will check if the user has approved the application and then prints out words "Hello World". While FBML looks and is much more simple way to do things, it has huge limitations when you compare it to PHP for example. FBML is wary easy to compare with HTML which was the starting point when FBML was developed. Can you build rich web applications using HTML only? Hardly...
The question what should be asked is not which one I should be using, but how to use them both. Let's create a invitation form to show my point:
<USE THE SAME PHP CODE AS IN FIRST EXAMPLE>
content="I say this is a one cool app!<fb:req-choice
url='http://apps.facebook.com/greattestapp/' label='Confirm' />">
<fb:multi-friend-selector actiontext="Tell all your friends! Tell the whole bunch!" />
This looks rather simple, but the mechanism behind it is really helpful and sophisticated. You are gathering all your friends and bringing them into a clickable list. From this point you can grow it to whatever you like with smaller resources required than a normal web application.
Now your program could invite more people and it has requested the basic privileges. That's hardly enough but it's a good start. Now the real developing begins. Use your knowledge of PHP and start learning those Facebook Technologies what I mentioned. Anytime you get stuck, there is a place to go. For like minded people The Facebook Developers Forum provides the support you need. While Facebook development is rather new and is partly in beta state, you will need help and extra revealing information. Go to the forums now and start digging.
More Useful Articles and Reviews Articles:
✔ Review: Verticus for iPad
iOS gamers everywhere are familiar with the genre of infinite forward progress apps - Mega Jump, Canabalt, and a host of other run/jump/fly-until-you-die...✔ Review: Clear Spot Voyager 4G wifi hotspot
Clear Voyager 4g HotspotI'm constantly on the go and with just about every site I visit available via secure SSL connection, I typically...✔ Review: Dropcam HD wifi video camera
Whether you're security paranoid, want to keep an eye on the nanny, have a summer or winter home you'd like to peek in...✔ Audiovox Car Connection Review
I have the smartest house on the block with a wifi-enabled thermostat and garage door opener, along with a complex web of wireless...✔ Review: Slingbox 500
I should start with a candid admission: I'm not a huge television watcher. I catch soccer matches on Fox Soccer Channel, and watch...
Let's stay in touch!
Sign up for my weekly AskDaveTaylor Newsletter and you'll receive even more tech and gadget help right to your inbox, along with exclusive news and industry updates. It's good stuff. I promise!
I do have a comment, now that you mention it!
Check This Out Too...
Look for Answers
All Our Categories
Apple iPad Help
Articles and Reviews
Auctions and Online Shopping
Blogs and Blogging
Building Web Site Traffic
Business and Management
Computer and Internet Basics
d) None of the Above
Google Gmail Help
Google Plus Help
Industry News and Trade Shows
iPhone and Cell Phone Help
iPod, Sony PSP and MP3 Player Help
Kindle Fire Help
Mac OS X Help
Pay Per Click (PPC) Advertising
Search Engine Optimization (SEO)
Shell Script Programming
Tech Support Video Help
The Writing Business
Twitter, LinkedIn and Social Network Help
Unix and Linux Help
Video Game Tips and Help
Windows PC Help
Find Me on Google+
ADT on G+