Thursday, May 31, 2018

(x-post /r/AskProgramming ) Design help for new app

I'm trying to come up with the best way to do this. I'm designing an app (the idea is .NET Core for the back and Quasar for the front, btw) that'll be used to organize workout programs. The model goes like this:

Each PROGRAM consists of one or more WORKOUTS -> for example, a month long program with weekly workouts on MON, WED, FRI will consist of 3 x 4 = 12 workouts

Each WORKOUT consist of one or more SETS, given a SET as the smallest unit of work possible in a WORKOUT -> for example, if WORKOUT A has you do 3 sets of 10 repetitions of squats, that would mean that you'd have 3 SETS, each pointing to (FK) WORKOUT = A, (FK) EXERCISE = Squat, REPS = 10

It'll get a bit more complicated than this, but this should suffice to understand the issue I'm having in my head right now. Users should be able to not only download other users uploaded programs, but upload their own too. Thing is, users should also be able to MODIFY programs they've downloaded as they see fit, and this WILL happen pretty consistely. For example, let's say that you found a program that you really love but you can't do one specific exercise in a specific workout... you'll just download that program, edit it, and substitute that exercise in that workout for a different one that you can actually do. Question is, how do you deal with this without duplicating a whole lot of data in your DB?

These are the options I can think of:

  • Duplicate everything. As soon as you download a program from the "program store", that'll create a new record in the PROGRAM table... and a record for each workout in that program in the WORKOUT table, together with a SET record for each set in each workout... basically, duplicating a shit load of info right away after you download a program. If you download 10, that's a lot of data you're saving to the DB each time. Of course, this method gets rid of any complacations regarding updates in the programs, as if you change anything in any program you've downloaded, you'll just update the records you created when you downloaded it and not the original.

  • Only keep in the DB common info for every user (uploaded programs, users, master tables such as EXERCISE, etc), and for absolutely everything else keep a "local" database or maybe a JSON with every single piece of data / info a user can need, including every program they download and any changes they make to it.

Any opinions? I'm sure there's gotta be an "optimal" way of doing this without over complicating things too much.

(x-post /r/AskProgramming ) Design help for new app Click here
  • Blogger Comment
  • Facebook Comment

0 comments:

Post a Comment

The webdev Team