Bernardo O
Bernardo O

Reputation: 828

Facebook Applications - JavaScript or PHP?

So, I'm working on a Facebook Application for the first time. Actually, it's the first web-related development I've ever done. I'm software developer.

I've been doing research and found that I can write my applications in whatever language I want, be it PHP, Python, JavaScript, Java, Ruby, etc., etc..

Since I don't have much time to learn something new, I chose JavaScript, which I have experience with for mobile development.

What I need is a Scratch and Win game in an iFrame. What is the best option to write the application with? Really go with JavaScript or perhaps go for PHP+Flash or something else?

Also, if someone knows of a place where I can find Facebook Apps sample codes, I'd be really thankful.

Thanks.

Upvotes: 0

Views: 9049

Answers (2)

Brent Baisley
Brent Baisley

Reputation: 12721

PHP is the only officially supported backend language, Facebook maintains the library. All other backend languages are maintained mainly by volunteers. Javascript is Facebook's primary front-end language, also maintained by Facebook.

I'm a PHP developer, and have been doing Facebook apps for a few years now. I recently switched to using mainly javascript over PHP. Personally, I think javascript presents a much better user experience for the same functionality. PHP, and any backend language, requires redirects to accomplish most things. Javascript is all inline.

Also, since you include the javascript libs directly from Facebook's servers, they automatically update the code. They are always changing the API, and the rules. It's a real pain to have to constantly be updating your backend libs and adjusting your code.

If you like, you can use the code I created for the someecards.com Facebook app to get you started. I have a standalone javascript file that handles most of the viral functionality (i.e. wall posts, requests). Its fairly generic, so could be reused in any app.

Upvotes: 2

ifaour
ifaour

Reputation: 38115

I would really argue you learn a server-side scripting/programming language first. As the modern web (apps or websites) cant really rely on Static pages (HTML) + Client-side script language anymore.

While I would recommend that you learn PHP because it's widely supported and code samples and snippets are everywhere, you may find it easier for you to learn how to develop websites in Java, python or C# for example since you are a software developer.

Now AFTER that, and for your specific request (scratch-n-win game) it depends on the requirements so you may need to use (in the front-end) Flash or if the requirements are flexible then you can use HTML5 or maybe a simple jquery plugin will get the job done!

Just a small note, your application may not require a deep understanding of the Facebook Platform and you may choose to keep the interaction with the system to the minimal. Anyway, here are a couple of resources:

  1. Facebook Official Samples & How-Tos
  2. Stack overflow
  3. MasteringAPI.com Facebook tutorials
  4. Thinkdiff.com Facebook tutorials
  5. Google!

Upvotes: 4

Related Questions