3

I am building an API which will accept a variety of metrics from an iPhone application.

The App Programmer has requested that the API be able to handle types of metrics the API does not yet know about. I would like to use an enumeration to list the current types of Metrics, but new metrics would have to be added as they are pushed to the server.

Has anyone seen this done before? I've thought about using a DB instead of an enum, but that seems really messy.

Any thoughts?

2
  • How is the API going to handle data it doesn't know how to handle? Some specifics as to what you're trying to do would help us answer the question. Commented Jul 8, 2011 at 19:00
  • Just talking about storing it in tables for now. I'm not a marketer, so I can only guess what they'll want to do with it. Essentialy, the App programmer wants to be able to say "hey, I want to capture this bit-o-stuff now", without having to come to me first. Commented Jul 8, 2011 at 19:05

1 Answer 1

4

Don't use an enumeration. Enumerations are primarily useful for when the entire range of values is known ahead of time; this is clearly not your case.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.