我的项目有一个类软件和另一个类操作系统。一个软件可能支持多个操作系统(我的实际问题要复杂得多)。
我不确定如何以最有效的方式将其保存在我的数据库中。我的表结构如下:
表:操作系统
id name platform
=================================
winxp Windows XP windows
win7 Windows 7 windows
...
表:软件
id name publisher os
====================================================
chrome Google Chrome google winxp,win7,...
ccleaner Ccleaner piriform winxp,win7,...
...
这是最好的方法吗?这会在使用 OOP 编程时引起任何问题(我使用 DAO 方法)还是应该像下面这样更改它:
表:操作系统
id name platform
=================================
winxp Windows XP windows
win7 Windows 7 windows
...
表:软件
id name publisher
=====================================
chrome Google Chrome google
ccleaner Ccleaner piriform
...
表:os_support
softwareid os
======================
chrome winxp
chrome win7
ccleaner winxp
ccleaner win7
ccleaner win8
...