2

I'm wondering how Web Sites often add new features and new preferences without making a mess of the database.

I thought of storing these in a preferences table with a many to many relationship and a key value pair.

Is there a better way?

Thanks

jmasterx
  • 52,639
  • 96
  • 311
  • 557
  • 2
    In the end, "User Preferences" is just a subsection of "Data" that a web application will need to store. As such, I don't think there is one correct way to answer this question. You might as well ask "How do web sites typically store their data", which of course has a number of answers (as numerous as there are database types and strategies to use those databases, and maybe even client-side storage in some cases). Can you make your question more specific? Is there a specific problem you are having? – Mark Hildreth Jan 17 '13 at 18:03
  • 2
    In addition to @MarkHildreth comment - any question with "better"/"best" is pretty much unanswerable. You need to define what "better" is for you so suggestions can be made for changes toward *your* "better" goal. – Alexei Levenkov Jan 17 '13 at 18:12
  • Why not store them on the users PC w/ cookies, then parse them on the session load. You could less sensitive settings there. – Botonomous Jan 17 '13 at 18:13
  • @Anon very bad idea to store them on cookies. The cookie if follow you on every page call, the size is limited, can be change by hand, not safe etc... – Aristos Jan 17 '13 at 18:15
  • @Aristos notice I said 'Less Sensitive' settings. I was thinking things like page color, font, etc...He never specified what kind of settings. Why would cookies be a bad idea for settings like those? – Botonomous Jan 17 '13 at 18:16
  • @Aristos Yea I get that, but once your cookie has been parsed (Start of session), then you don't need to touch it again. That would only be 1 call. I do see the limitation, but i dont think its a "Very bad idea", that what they were made for. – Botonomous Jan 17 '13 at 18:21
  • @Aristos thanks for the discussion. Apparently we have different views on the topic. Sorry OP about the hijack. – Botonomous Jan 17 '13 at 18:29
  • @Anon At least take some time and read that http://developer.yahoo.com/performance/rules.html#cookie_size – Aristos Jan 17 '13 at 18:33

2 Answers2

4

You can always use the asp.net User Profile Properties that comes together with the login module of the asp.net

Read about and see some examples right on MSDN: http://msdn.microsoft.com/en-us/library/2y3fs9xs.aspx

Aristos
  • 66,005
  • 16
  • 114
  • 150
0

I would recommend storing a portion of your data in a NoSQL database or in a NoSQL style data structure--just like you're saying, key/value pairs.

My personal preference is to store the primary and foreign keys and minimal identification data in a normalized data structure and store other attributes in a NoSQL database or data structure. That way the other attributes can be added and removed easily and can even be different from one record to another.

Samuel Neff
  • 73,278
  • 17
  • 138
  • 182