编程与软件工程web.archive.org
更好地设计数据库
Design better databases
2012 — 2016,它一次次回到首页
黑点是上首页(≥ 50 分)的那次投稿,空心点是没冲上去的投稿,点越大分数越高。
导读
这个页面是 dbpatterns.com 的存档副本,一个收集和展示数据库设计模式/数据模型的网站,用户可以浏览别人分享的表结构示例。原站已失效,当前链接指向 Internet Archive 的最近快照。
为什么经久不衰:它把抽象的数据建模变成可浏览的具体例子,而评论中对模式质量与缺少讨论的批评,今天仍提醒我们:模式需要上下文和解释,不能照抄。
HN 评论精选
说明链接已失效,当前页面是存档副本。
原始网址是 http://dbpatterns.com/,但它已不再指向正确内容,所以我们替换成了最接近原始版本的 archive.org 副本。
dang查看英文原文
The original URL was http://dbpatterns.com/, which no longer points to the right content, so we replaced it with the closest archive.org copy of the original.
统一且唯一的 ID 命名可让 JOIN USING 自动去重并简化查询。
给 SQL 用户一个小技巧:如果你给所有 ID 字段起唯一的名字,比如在 reservation 表里也叫 reservation_id 而不是 id,就可以这样写:SELECT * FROM reservation JOIN guest USING (reservation_id); 用 USING (reservation_id) 代替 ON reservation.id = guest.reservation_id,字段会自动去重,查询其他地方不用再加表名限定,SELECT * 也只返回一份。
mortehu查看英文原文
Tip for SQL users: If you give all your ID fields unique names, e.g. by calling your field "reservation_id" instead of "id", even in the reservation table, you can do stuff like: SELECT * FROM reservation JOIN guest USING (reservation_id); By doing "USING (reservation_id)" instead of "ON reservation.id = guest.reservation_id", the field will be automatically deduplicated, so you don't have to qualify it elsewhere in the query, and "SELECT *" will return only one copy.
批评示例模式滥用 UUID、价格用字符串等设计缺陷,却仍获高评分。
我点开第二个“精选”模式,看到一团糟:它得了“每行都塞 UUID”的毛病,这是只学过面向对象设计的人常犯的;price 是字符串(大概是为了能写“市场价”),每个 delivery 上还带货币符号。整个设计毫无道理,却有 18 个星,难以置信。
klodolph查看英文原文
I just clicked on the second "featured" pattern and found this hot mess: http://dbpatterns.com/documents/5091f74289cbad03bc958bc0/ It has the "let's put a UUID on every row" disease common to designers who have never really learned anything other than object oriented design. Price is a string (I guess so you can put "market price" on the fish?), and there's a currency symbol on every "delivery". The whole thing just makes no sense. 18 stars. Unbelievable.
模式必须附上下文和解释,缺少讨论功能会削弱工具价值。
界面很棒,但我发现一个大缺失——没有讨论或评论模式的地方。模式不是活在真空里:它在某些场景下好,在另一些场景下坏。所以只有附带说明它想解决什么问题、为什么长这样,模式对我才有价值。把它连到 StackOverflow,或者至少加个基本评论功能,这才会是有用的工具。
ripperdoc查看英文原文
A great interface, but I see one huge omission - a place to discuss or comment the patterns. A pattern doesn't live in vacuum, it is good under certain circumstances and bad in others. So the pattern is only valuable to me if it comes with an explanation of what it's trying to achieve and why it looks the way it does. Link it up to Stackoverflow or at least throw in some basic commenting function and this would be a useful tool.
历次讨论
同类还值得读
开源应用架构
The Architecture of Open Source Applications
《开源软件架构》(AOSA)是一本在线免费书,邀请知名开源项目的作者亲自剖析其内部设计,涵盖 SQLAlchemy、LLVM、Audacity、Apache、Bash 等系统。
编程与软件工程上首页 9 次 · 2011–2024aosabook.org编辑精选编程语言简史:简短、不完整且多半错误
A Brief, Incomplete, and Mostly Wrong History of Programming Languages
一篇以戏谑、故意不准确的方式回顾编程语言史的博客文章,用夸张轶事和讽刺定义串起 Lisp、C、C++、Java、JavaScript、PHP 等语言。
编程与软件工程上首页 8 次 · 2009–2021james-iry.blogspot.comSQLite 是如何测试的
How SQLite is tested
SQLite 官方文档页,系统介绍 SQLite 的测试体系:多种测试方法(TCL 测试、模糊测试、回归测试、静态分析等)和海量测试用例,展示了这个小型开源项目如何靠极致测试获得…
编程与软件工程上首页 8 次 · 2009–2025sqlite.org编辑精选高级编程语言(2009)
Advanced programming languages (2009)
Matt Might 的经典文章,按用途推荐“高级编程语言”:如果追求就业就选主流语言,如果追求表达力、学术研究或创业,则推荐 Haskell、OCaml、Scala 等函数式语…
编程与软件工程上首页 8 次 · 2009–2022matt.might.net我的 Forth 与栈机器经历
Yosefk - My history with Forth & stack machines
作者以亲身经历回顾了使用 Forth 语言和栈式机器的历程:既赞叹其简洁优雅、代码量小、可自举的优点,也坦率指出栈操作在实际编程中的痛苦,以及 Forth 社区文化中的问题。
编程与软件工程上首页 8 次 · 2010–2024yosefk.com编辑精选