Simon Willison 提出來的 PAGNIs

Simon Willison 提出來「PAGNIs: Probably Are Gonna Need Its」,整理一下裡面提到的功能。

第一個是 kill switch,在 API 設計上一開始納入強制升級的傳回值,文章裡面有提到一些情境。

第二與第三剛好就是 Test + CI + CD,常常是 best practice,除了文章裡面提到的東西,在其他人的文章裡面應該也都有類似的討論。

第四是 API 的分頁,這個部份只講了要分頁,沒講到分頁時資料庫的效率問題,這部份可以參考「API pagination best practices」這邊的討論,key-based 的 pagination 效能會比較好,也可以避免對資料庫的 DoS 攻擊。

第五是 API 的 log,作者的建議是一開始什麼都存起來,等量大的時候再拔掉,會對於初期開發與除錯很有幫助。我是會掛 Sentry 這類的東西,有錯誤的時候會記錄起來。

第六看不懂他想要幹什麼,先跳過去。第七是在講要盡早實做這些 practice,等專案都推出去後再回過來實做都很花時間。

有些可以練手一下...

Love your country, but never trust its government

Hacker News Daily 上看到的,在 Sun-2 的 bootloader 裡可以看到「Love your country, but never trust its government」這樣的字串:「Why the Sun 2 has the message "Love your country, but never trust its government"」。

這段字串是由 John Gilmore 當時在 Sun 開發時所放入的,John Gilmore 同時也是後來 EFF 創辦人之一,不過當初放入這段字串的目的是為了抓到盜版:

Yes. Vinod Khosla, first President of Sun, came to me at one point and said to put something hidden, triggered in an unexpected way, into the ROM Monitor, so that if somebody cloned the Sun Workstation (violating our software’s copyright), we could do that unexpected thing to the competitor’s demo workstation at a trade show and thereby prove that they had cloned it.

過了三十年後 John Gilmore 被挖出來問的回應也是蠻有趣的... (可以參考原文附上的信件)

而這句話現在回頭看也很經典,尤其是最近各國政府想要在 crypto system 裡面放後門的各種反應。