使用 Parse 构建数据库
我使用 Parse (www.parse.com) 作为 iPhone 应用程序的后端数据库。我正在创建一个健身应用程序,并希望获得建议作为构建课程和关系的最佳方式。
对数据库的一些需求:
1)Sets
(具有属性或重量和次数)
2)Exercise
(Exercise
的单个实例,其中可以包含多个组
)
3)锻炼
(这将是特定锻炼的单个实例,代表 1 天。任何一天都不能有 2 个锻炼可以的对象。包含多个
Exercise
对象,
然后我还需要一些独立于上面的 Routine
类。
4) Routine
可以包含 。 ExercseForRoutine
对象(看起来与 Exercise
相同,但仅用于例程,无法添加集合。5
) ExercseForRoutine
将被添加到 Routine
中,但与用户输入锻炼数据时将使用的实际 Exercise
对象无关,该对象是只是用来创建例程。
任何有关提示以及如何使用 Parse 构建此结构的建议将不胜感激
I'm using Parse (www.parse.com) for the backend database for an iPhone app. I'm creating a fitness application and want advice as the best way to structure the classes and relationships.
A few needs for the database:
1)Sets
(have attribute or weight and reps)
2)Exercise
(a single instance of an Exercise
which can contain multiple Sets
)
3)Workout
(which will be a single instance for a particular workout which will represent 1 single day. No single day can have 2 Workout
objects. Can contain multiple Exercise
objects.
Then I also need some classes for Routine
which is independent from the ones above.
4) Routine
can contain ExercseForRoutine
objects (which will look the same as Exercise
but will just be used for routines, will not be able to add sets to.
5) ExercseForRoutine
will be added to Routine
, but not related to the actual Exercise
objects that will be used when the user enters workout data, this object is just used to create a Routine.
Any advice on tips and how to structure this using Parse would be appreciated
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不要太关注您的对象模型或数据存储。如果您还没有这样做,请生成核心用例列表并使用它们来驱动你的对象模型。但假设您将对其进行迭代,直到找到适合您的域的内容。听起来你的规范可能有点可疑的一件事是将单日限制写入你的锻炼类中。这听起来似乎对于该领域来说并不是必需的,并且可能很难编写代码(例如,如果我在晚上 11:55 开始锻炼会发生什么?)。
Don't get too hung up on your object model or your data store. If you haven't done so already, generate a list of core use cases and use those to drive your object model. But assume that you will iterate on it until you find a good fit with your domain. The one thing that sounds like it might be a bit fishy about your spec is writing the single day constraint into your Workout class. That doesn't sound like it's essential to the domain and probably will be awkward to code (e.g., what happens if I start my workout at 11:55pm?).