Home Audience Developers Need a Backend For Your App? Here’s Parse to the Rescue!

Need a Backend For Your App? Here’s Parse to the Rescue!

0
6701

Apps-developingDiscover Parse, which allows mobile app developers to forget about server maintenance and complex infrastructure, and instantly add push notifications, data storage and social integration to their apps. Read on…

With the advent of technologies that support mobile development, local storage on browsers, etc, most of the applications developed today are not database intensive, i.e., they do not save much data in the databases. All they need is limited information like user details, high scores, or other such data that cannot be stored on the client side. So when the application is more intensive on the client front and there’s minimal data to store, would a developer want to invest in the middleware and backend technologies? The answer is a simple ‘no’. But what do the developers do, then? Does their dream mobile application go down the drain?

No, since MBaaS comes to the rescue. With the dawn of cloud technology, developers have been blessed with a technology called Mobile Backend as a Service (MBaaS). While taking care of the middleware and backend, it lets developers nurture their dreams and focus entirely on the app. Wikipedia defines MBaaS as: ‘Backend as a service (BaaS), also known as ‘mobile backend as a service’ (MbaaS), is a model for providing Web and mobile app developers with a way to link their applications to backend cloud storage, while also providing features such as user management, push notifications and integration with social networking services.

There are many such MBaaS providers in the market with various offerings. But making the right choice is the biggest challenge. With every list, there are the pros and cons. Today, let’s get to know one major player in the MBaaS market ‘Parse. I’ll share my thoughts and opinions about it, and also provide a few snippets to get you started. It is as wonderful as it sounds. With ease of use for every kind of developer/Web or mobile (hybrid or native)’it provides a wonderful interface and an even more wonderful API to take care of your backend and middleware needs.  

Why Parse?

With so many players in the MBaaS arena, why would a developer opt for Parse? With a simplistic API, Parse also offers many other perks to the developers. The biggest concern for any developer regarding their backend connectivity is the number of hits. The developer always tries to minimise the number of hits to the server so as to reduce the server load. But for a client-side intensive application, there is only a need to hit the server maybe once or twice in a day, for instance, to update user stats, or the leaderboard, etc. With Parse’s ‘Basic’ plan, a developer gets one million requests per account, per month. To juxtapose these figures into a more realistic scenario, let’s assume your app has 10,000 daily users. With one million requests per month, you can cater to approximately 3.3 requests per user, per day-and that too, for free! You don’t have to worry about writing Web services,  maintaining a database, or pay for hosting. And if you are developing a mobile application, there’s more in store for you. Your app also gets one million free pushes per month. And you get to keep an eye on the statistics and the data too, in case you are bothered about exceeding the number of requests. The data is easily accessible through Parse’s data browser that helps you to perform basic operations on each record of the data, as if it were your own database. You can even export the data for your own purposes and do any analytics with it. The usage statistics are also available to you, which helps you to monitor and analyse your app’s performance.

So in case yours is a start-up and you are a bit hesitant about making an app because you are worried about the middleware and the backend, worry no more. And once you can generate enough revenue, you can even go for the ‘Pro’ plan that offers 15 million requests per month with 5 million pushes per month, for a fair enough deal. It is desirable for every app today to have a social connection, and the first choice is Facebook. Parse was acquired by Facebook in April 2013. With that, a developer gets built-in Facebook API calls along with the Parse SDK. So that’s one more advantage. Parse offers a wide array of SDKs for almost all the major mobile development platforms including iOS, Android and Windows Phone 8. But beyond mobile development, it also has a JavaScript API and .NET API, as well as a Xamarin connection. Their usage is well documented too. Just to add one last thing, there are big players in the market already using Parse with their apps. Parse may not be the only good option available in the market but it’s certainly one worth trying.

How to use Parse

Before jumping to any conclusions, let’s just get a glimpse of how to use the Parse SDKs or APIs. I’ll just present a few examples taken directly from the documentation. Generally, developers are quite unsure about saving and fetching data from the cloud because they are uncertain about how complex will it be to do so. To begin with a JavaScript example, you’ll first need to set up Parse for your application. It’s as simple as inserting a script tag and calling an initialisation function in your script:

<script src=http://www.parsecdn.com/js/parse-1.2.9.min.js></script>
<script>
 Parse.initialize(Your Application Id, Your JavaScript Key);
</script>

Once done, you can freely go ahead and use the Parse API in your application. So, for instance, if we want to fetch all the records from our class on Parse, let’s issue the following commands:

var query = new Parse.Query(MyClass);
query.find({
  success: function(results) {
    // results is an array of Parse.Object.
  },
  error: function(error) {
    // error is an instance of Parse.Error.
  }
});

As you can see, it is as simple as that. One can go about other operations similarly. Now let us look at an example for Android. First you need to download the Android SDK for Parse. And then simply import its contents into your Android Project’s ‘libs’ folder. Then in your Activity, import the following:

import com.parse.Parse;
import com.parse.ParseAnalytics;

Call the initialisation method in the onCreate of your Activity:

public void onCreate() {
   Parse.initialize(this, 'Your Application Id', 'Your Client Key');
}

Obviously, your manifest file should have permissions for Internet and network state access, without which any app that needs to use the Internet won’t work. Once this is done, you can perform all the operations on your data easily. For instance, if you want to fetch all the records from your class on Parse, you would need to use the following snippet:

ParseQuery<ParseObject> query = ParseQuery.getQuery('MyClass');
    query.findInBackground(new FindCallback<ParseObject>() {
        public void done(List<ParseObject> objects, ParseException e) {
       if (e == null) {
           objectsWereRetrievedSuccessfully(objects);
          } else {
                           objectRetrievalFailed();
          }
      }
}

Parse includes much more for the developers beyond the things discussed in this article. You can always check out its API and other offerings on its site, and decide if you actually want to use Parse or any other MBaaS provider. The list of MBaaS providers is quite long, starting from Kinvey, StackMob, FeedHenry, Appcelerator to AnyPresence, Kii Cloud, Icenium Everlive. But the choice is yours.

NO COMMENTS

LEAVE A REPLY

Please enter your comment!
Please enter your name here