OOP Associations and database access

My project has a class software and another class OS. A software may support multiple operating systems (My actual problem is much more complex).

I'm not sure how to save it in most effective way in my database. My table structure is as follows:

Table: os

id        name          platform
=================================
winxp     Windows XP    windows
win7      Windows 7     windows
...

Table: softwares

id        name             publisher     os
====================================================
chrome    Google Chrome    google        winxp,win7,...
ccleaner  Ccleaner         piriform      winxp,win7,...
...

Is this the best way? Will this cause any problem when programming with OOP (I use DAO approach) Or should i change it somethig like the following one :

Table: os

id        name          platform
=================================
winxp     Windows XP    windows
win7      Windows 7     windows
...

Table: softwares

id        name             publisher  
=====================================
chrome    Google Chrome    google      
ccleaner  Ccleaner         piriform   
...

Table: os_support

softwareid        os
======================
chrome            winxp
chrome            win7
ccleaner          winxp
ccleaner          win7
ccleaner          win8
...

Answers


Your current approach is wrong - there would be redundancy in your softwares tables. I'm not sure what you mean by winxp,win7... - storing multiple values in a one cell? It's also wrong way - values should be atomic (1st normal form) - but if you mean duplicating row in software table for each operating system - there will be redundancy - like I said at the beggining.

The second approach looks much better (of course if you get rid of os column in software table).

To be sure that field/tables organization is proper, you should read about normalization. Reffer this. 3rd normal form is that what you need :)


Need Your Help

How do I develop for both Portrait and Landscape display formats?

vb.net windows-xp landscape portrait

I'm currently developing for a handheld device running Windows XP Professional (not Tablet PC edition). The device allows users to switch from the standard widescreen landscape display format to a

Iterating through a dictionary using dates

python date python-2.7 iteration

Can any one help me how to iterate through dictionary with dates, I have the data set like this

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.