iPhone App, server-side component, parse integration

Go To StackoverFlow.com

0

This will be my first iOS app with any bit of complexity. I'd like to outline the components and structure to get some feedback before I dive into attempting it.

From the user's perspective, the app monitors the water level of a local lake and receives push notifications when the water level changes a user-specified amount. I think using Parse will be easiest to manage user data and I will attempt a Node.js server-side component on Nodester (I know some basic JS and figure its an good up and coming language to get familiar with). Here's how I see it working...

  • The user creates an account on the device and specifies a lakeLevelChange amount in which they will receive a push notification. The user's data is pushed to Parse's data mgt.
  • The server side component will run this program 3-6 times a day:
    • Pulls a currentLakeLevel via HTTP request
    • Pulls user data from Parse
    • Compares the currentLakeLevel to the user specified lakeLevelChange
    • If the difference is => lakeLevelChange, a push notification HTTP Post request is sent, per user which their specified condition is met
  • Parse receives POST request and sends a push notification to APNS server
  • Client receives push notification

It actually doesn't sound terribly complex when its typed out. Is this the proper way of structuring this functionality? Am I missing anything? Suggestions are greatly appreciated!

2012-04-03 20:20
by mnort9
Let's deal with the iOS app here please. Open another question if you have questions on Nod - ControlAltDel 2012-04-03 20:25


2

Bit of a logic problem:

The server side component will run this program 3-6 times a day:
Pulls a currentLakeLevel via HTTP request.
Pulls user data from Parse
Compares the currentLakeLevel to the user specified lakeLevelChange
If the difference is => lakeLevelChange, a push notification HTTP Post request is sent, per user which their specified condition is met

You actually need to store the level at last alert for each user, too. Otherwise incremental changes could creep over your users' threshhold and never trigger an alert.

Imagine if I said I want to be alerted when the level has changed by 6 inches. You then record seven events in which the level rises by an inch each time. At no point did you observe more than 6 inches of change, but the total change is over my threshold for notification, and I probably meant to have you notify me about that.

So when you fire an alert, you need to store the current level, and then on each change event, you compare that to the last level you notified them about.

2012-04-03 20:39
by Dan Ray
I didn't think of that, makes sense though, Thank you - mnort9 2012-04-03 20:44
I'll +1 this for a well-thought approach to a case that probably wouldn't have been discovered until later - jmstone617 2012-04-03 22:27


1

You're missing the unhappy path. It's the path programmers never travel while programs always travel. Nothing goes the way we plan it so we have to plan for failures. Ask yourself questions like, "What happens when the server powers down for maintenance or outages and misses one or all of its 3-6 scheduled runs?" "Should the missed executions queue up and send out a bunch of missed notifications?" "What happens when the user changes what they specified as lakeLevelChange but the radio is out and/or the server request cannot complete?" "What happens when Parse gets garbage data in or produces garbage date?" Asking just a few of these will steer you towards an optimal design.

2012-04-03 20:36
by Cliff
Good points, thank you - mnort9 2012-04-03 20:45
Ads