user594161
user594161

Reputation:

Need Help With Core Data Model

I'm working on a gym logging app using Core Data model. I'm trying to figure out the best way to design the data model.

I'm thinking I will have 2 entities: Exercise and Routine.

The Exercise entity will have attributes for name, link to pic, etc.

The routine will have attributes for strings containing the exercises, along with the reps and sets worked for that particular entry.

What do you guys think or if you have any suggestions? I'm not sure if this is the correct way to organize my data model.

I currently have all the muscle groups and their exercises in an array loaded from a plist.

Upvotes: 0

Views: 138

Answers (2)

Khilendra Chaudhary
Khilendra Chaudhary

Reputation: 1

I really think, you should focus on overall project requirement. After that you can easily identify the required data model, it's all depend on what's the requirement is. May be you can include human resource management requirement for managing staff or client management requirement including client progress, workout plan and tracking, subscription etc.

Upvotes: 0

No Surprises
No Surprises

Reputation: 4901

It sounds like you're asking at a pretty high level how you should model your data. There's no "right" way to do it, but there are general things you can do that will make your life easy and your application efficient.

For example, you would have an Exercise entity, which would have attributes like id, name, description, photo, etc. You'd also have a Routine entity with attributes like id, name, description, etc.

The tricky part is what the relationship between exercises and routines would be. An exercise in routine A might have a different number of sets and reps than the same exercise in routine B. To keep your model efficient, it might make sense to have another entity that associates a particular exercise with a routine and a number of reps and sets. This might be something like RoutineEntry with attributes like id, reps, sets, sequence, etc. and relationships like exercise and routine.

Now the relationships start to become a little clearer. An exercise can be associated with many routine entries. A routine entry has one exercise and one routine. A routine has many routine entries.

Upvotes: 1

Related Questions