ruby on rails - Is ~44 columns too much for a model? Does it make sense to break a one-to-one relation? -


i interested in best practice model has lot of data attached it. of app revolve around 1 model (sku), , seems have more , more things associated it.

for example, sku model has multiple prices, dimensions, weight, recommended prices multiple price levels, title, description, shelf life, etc. make sense break pricing info table? or break sku different uses of sku , associate them? example, websku, stocksku, etc.

as else said, design of database should respond logic behind it. why? mainly, because easier maintain , understand.

i going drive attention normalization rules, @sawa did.

generally, approach normalize database, provides several advantages. should read this wikipedia link (at least starting point).

following normal rules design database taking account logic behind data.

but denormalization has it's advantages. first (always considered) being optimizing read performance. means having data on 1 table have had in different tables when following normal rules, , makes sense when data has some logic relation.

you have aim achieve balance depending on problem facing.

on other side, tags on post can see using ruby on rails, uses active record pattern. 1 consequence of database model presenting, have domain model complex. mean, large. don't know every detail project, guess grow god object, making code hard maintain, extend , understand.


Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -