Home » Posts tagged "blog" (Page 2)

Microsoft Blogs 上 TDD 的戰文...

文章標題就直接寫「#NoTDD」的戰文 XDDD

列了 Pros (一行) 跟 Cons (超長 XDDD):

Pros

  • We end up with tests that verify the behavior of the code and help prevent regressions

這個是 TDD 的目的。而 Cons:

Cons

  • It takes us longer to write code using TDD
  • The tests get in the way. Because my design does not have low coupling, I end up with tests that also do not have low coupling. This means that if I change the behavior of how class works, I often have to fix tests for other classes.
  • Because I don’t have low coupling, I need to use mocks or other tests doubles often. Tests are good to the extent that the tests use the code in precisely the same way the real system uses the code. As soon as I introduce mocks, I now have a test that only works as long as that mock faithfully matches the behavior of the real system. If I have lots of mocks – and since I don’t have low coupling, I need lots of mocks – then I’m going to have cases where the behavior does not match. This will either show up as a broken test, or a missed regression.
  • Design on the fly is a learned skill. If you don’t have the refactoring skills to drive it, it is possible that the design you reach through TDD is going to be worse than if you spent 15 minutes doing up-front design.

這四個問題講的是時間與能力兩個因子的作用,轉一個角度來討論其實是:如果 junior engineer 可以寫出好的測試,他們就不叫 junior engineer 了... 而 senior engineer 是稀缺資源,讓他們多花時間寫出「好的測試」未必是划算的。

反而是另外一種常見的方式常常跟 TDD 在對抗:透過 QA team 在完成後測試,尤其是用手動測試的 QA team XDDD

這個方法很簡單,而且行之有年。而且很無奈的,跟一般軟體工程所期望的相反,junior engineer 就可以做的不錯,所以人力的部份相當好 scale,而品質也有不錯的水準 (畢竟是直接測實際的功能了)。

剛好前陣子有提到另外一篇論文也在討論 TDD 的效果 (參考「又一篇戰文:討論 TDD 的過程」這邊),也有類似的反思。

前陣子在 Twitter 上看到這則也是很有趣,拿來當結尾 XDDD:

把自己的 Blog 丟上 CloudFront

因為 CloudFront 也支援 HTTP/2 了,對於效能的衝擊應該小不少。另外當初希望多用點 IPv6,CloudFront 也支援了。最後看了一下自己的流量,每個禮拜大約 380MB 與 210K requests,也還能接受。

就把自己的 blog 再次丟上 CloudFront 玩看看,不過這次只上了 Price Class 100 (只有歐美與加拿大)。之後也許來玩看看 AWS WAF,不過開起來應該就跟 CloudFront 費用差不多了?XD

先來看看效果以及有沒有 bug 吧...

GitHub 重新定位 Redis 的功能...

GitHub Engineering 說明了他們為什麼改變 Redis 的使用情境:「Moving persistent data out of Redis」。

GitHub 裡面,Redis 有兩種不同的情境,一種叫做 transient Redis,只用做 cache:

We used it as an LRU cache to conveniently store the results of expensive computations over data originally persisted in Git repositories or MySQL. We call this transient Redis.

另外一種則是打開 persistence 功能,叫做 persistent Redis:

We also enabled persistence, which gave us durability guarantees over data that was not stored anywhere else. We used it to store a wide range of values: from sparse data with high read/write ratios, like configuration settings, counters, or quality metrics, to very dynamic information powering core features like spam analysis. We call this persistent Redis.

這邊講的是 persistent Redis 被換成用 MySQL (InnoDB) 儲存:

Recently we made the decision to disable persistence in Redis and stop using it as a source of truth for our data. The main motivations behind this choice were to:

  • Reduce the operational cost of our persistence infrastructure by removing some of its complexity.
  • Take advantage of our expertise operating MySQL.
  • Gain some extra performance, by eliminating the I/O latency during the process of writing big changes on the server state to disk.

For the majority of callsites, we replaced persistent Redis with GitHub::KV, a MySQL key/value store of our own built atop InnoDB, with features like key expiration. We were able to use GitHub::KV almost identically as we used Redis: from trending repositories and users for the explore page, to rate limiting to spammy user detection.

後面講了不少轉換的過程 (還包含了某些功能的改寫),但沒有講的太清楚為什麼不繼續使用 Redis。

目前只能就提到的三點問題來看,persistent 的 i/o 成本可能太高?而且難以再壓榨效能出來?而相反的,InnoDB 已經花了很多力氣在上面,直接拿來用反而可以解決問題?

不過看得出來這個轉換還是花了不少力氣,看得出來有些 application 使用 Redis 的模式不能直接搬到 InnoDB 上,花了時間改寫...

VaultPress 的新方案

VaultPressWordPress 的付費服務,可以備份自己架設的 WordPress 站台。

剛剛看到新的方案出爐了:「Announcing Streamlined Plans — at Lower Prices」,Jetpack Personal 將本來的 VaultPress Lite 包在內,但是價錢更低了:

At $3.50 per month, the Jetpack Personal plan includes everything the old VaultPress Lite plan used to — at a price that’s 30% lower.

有在用的人記得進去更改方案,另外要注意生效時間,等原來 Lite 快到期再改。

Blog 換 Hosting...

早上花了點時間,把 blog 從 DigitalOcean 搬到 Vultr 上了...

本來是打算要換到 Linode 上,但 Linode 最小台的機器太大台了 (2GB RAM),還是找了其他方案來用,看了看就挑 Vultr 了,用 768MB RAM 的方案,跟之前 DigitalOcean 相比多了一些 RAM 可以用...

順便趁機把系統換成 Ubuntu 16.04 跟 MySQL 5.7,現在用了六個小時,感覺還不錯...?

Blogger (Blogspot) 全面提供 HTTPS 版本

Google 主動啟用了 HTTPS 版本:「Bringing HTTPS to all blogspot domain blogs」,預設會將 HTTPS 開起來:

As part of this launch, we're removing the HTTPS Availability setting. Even if you did not previously turn on this setting, your blogs will have an HTTPS version enabled.

另外提供 HTTPS Redirect 的選項,可以將訪客自動轉到 HTTPS 上:

custom domain 的部份不知道會怎麼提供...

阻擋 PIXNET 的三分鐘閒置視窗

在看宵夜文「2016更新【2013台北宵夜美食小吃精選】松山區信義區大安區」的時候做其他事情,回來就看到 in-window popup 視窗,決定擋下來,所以就把 html 找出來:

<div class="modal idle-pop" tabindex="-1" role="dialog" aria-describedby="dialog">
    <div class="modal-content">
      <div class="modal-header">本網頁已閒置超過 3 分鐘。請點 <kbd>關閉>/kbd> 或 <kbd>點擊</kbd>任一空白處,即可回到網頁</div>
      <div class="modal-body">

我選擇的方法是透過 uBlock Origin 阻擋元素:

pixnet.net##.idle-pop

然後重新開 blog 頁面,等個幾分鐘後確認就可以了。

使用 WordPress 的內容佔有全 Web 的 25% 比率

WordPressMatt Mullenweg 在他的 blog 上提到了 WordPress 的內容建構了 Web 上的 25% 內容:「Seventy-Five to Go」,出自 W3Techs 的「 Historical yearly trends in the usage of content management systems for websites 」這邊的資料。

WordPress 從 2004 年 MovableType 的 license 爭議事件後崛起 (Commitment to a Free Version, while getting our pricing right),後來就愈站愈穩了,而 MovableType 在 2007 年又宣布 open source (Movable Type Open Source),但也已經無法挽回了...

而且 WordPress 的比率目前還在緩緩攀升...

Archives