Question

Background

So I have a REST API that allows for client applications to access and manipulate users' data.

I'm in the process of writing an Objective-C class for simple utilization of this REST API, but I'm stuck between two methods of implementation.

Method 1

class MYClient
    string username
    string password
    methods for using GET, PUT, POST, DELETE on questions
    // questions are dictionaries with 'title' and 'body' strings

Method 2

class MYUser
    string username
    string password
    array  tokens
class MYToken
    string title
    string body

// classes inherently sync themselves to the server in their initializers, setters, and getters

Questions

  • Is there one that is more appropriate for use in (for example) iOS apps?
  • Is there one that is more appropriate in general?
  • What are the distinct benefits of Method 1 over Method 2 and vice versa?

No correct solution

Licensed under: CC-BY-SA with attribution
scroll top