ときどきの雑記帖 RE* (新南口)
Does exactly what it says on the tin
閏年
前任者から引き継いだシステム、うるう年なのに何故か2/29が表示されないと思ったらとんでもない設計になっていた件 - Togetter
コメントの中にもあったけど、これと「逆」のパターンのコードに遭遇したことがある。 とある組込み機器のプログラムで(マスクROMに書かれたもので後からの書き換えはできない)、 1990年代前半に書かれカレンダー絡みの機能も持っていた。 で、閏年の判定を西暦年を4で割り切れるかどうかだけでやっていたのだけど 2000年は「例外の例外」で閏年であったので無事に2000年を過ごせたという。
Date
「カレンダー」絡みでもう一つ
また、Dateクラスはいま主担当のメンテナーがいません。メンテナーがいない機能に依存するのはリスクが高いため、 DateクラスとTimeクラスとの依存関係を切り離したいという思いもあります。
Dateクラスの(元)メンテナーってFさんだったっけか? 個人的にはあまりいい印象は持ってなかったりする。
Git’s list of banned C functions
ban される関数にgetsがないんだけど、 規格的にそんなものはもうないことになっている (gets - Wikipedia, C言語の最新事情を知る: C11の仕様-脆弱性対応に関連する機能強化点 - Build Insider )からだろうか?
参考:
- MSC24-C. 非推奨関数や時代遅れの関数を使用しない
- asctime, asctime_r, asctime_s - cppreference.com
- ctime, ctime_r, ctime_s - cppreference.com
just what it says on the tin
Qiita の編集リクエストってどうやるのだっけ。
The Rails Doctrine(日本語訳) - Qiita
tin
「(DHHにとっての)微笑み最大の原則」という原則は、まさにブリキに書いてある通りです。 私をもっともっと広く笑顔にしてくれるようなものに細心の注意を払って設計されたAPIです。このように書き出すと、 ほとんどコミカルなナルシストのように聞こえますし、私でさえ、その第一印象に反論するのは難しいと思います。
「ブリキに書いてある通り」という部分に違和感を持ったので原文に当たってみると
The Principle of The Bigger Smile (of DHH), which is just what it says on the tin: APIs designed with great attention paid to whatever would make me smile more and broader. When I write it out like this, that sounds almost comically narcissistic, and even I find hard to argue against that first impression.
ふむ。ブリキ==tinだよなと思いつつも、「it says on the tin」で検索するとこういうのが引っかかる。
- DOES WHAT IT SAYS ON THE TIN | 意味, Cambridge 英語辞書での定義
- オンライン英会話辞典 BRIDGE これを英語でなんと言うか? How do you say that in English?: 能書き通りの効能を発揮するを英語でなんと言うか?
- Does exactly what it says on the tin - Wikipedia
じゃあどう訳すかと言ってもわたしには「これ」という訳を提示できないけど、 変えた方が良いのじゃないでしょうか。
after
しかし、この二つの決定は今でも私を笑わせてくれます。テストケースやコンソールでpeople.thirdを書く楽しさを満喫しています。 もちろん、この楽しさは論理的ではありません。効率的ではありません。病的かもしれません。しかし、それは私を笑顔にし続け、 こうして原則を満たし、私の人生を豊かにし、12年間のサービスの後にRailsに関わり続けていることを正当化するのに役立っています。
But both decisions still, to this day, make me smile. I relish getting to write people.third in a test case or the console. No, that’s not logical. It’s not efficient. It may even be pathological. But it continues to make me smile, thus fulfilling the principle and enriching my life, helping to justify my continued involvement with Rails after 12 years of service.
snowflake
Railsの初期の生産性のモットーの1つは、次のようなものでした。「あなたは美しくてユニークな雪の結晶ではない」というものです。 空虚な個性を手放すことで、平凡な意思決定の煩わしさを跳ね除け、本当に重要な分野ではより速く進歩することができると仮定しています。
One of the early productivity mottos of Rails went: “You’re not a beautiful and unique snowflake”. It postulated that by giving up vain individuality, you can leapfrog the toils of mundane decisions, and make faster progress in areas that really matter.
この「雪の結晶(snowflake)」って何かの比喩じゃなかろうかと思ったので調べてみると Wikipediaにこんなのがあった Snowflake (slang) - Wikipedia。
試しに「スラング」を検索ワードに追加すると
- snowflakeの意味とは?「雪片」以外の意味もある? 最近流行のスラング
- snowflakeは雪片という意味ですが、最近流行のスラングになりました。 - 英語 with Luke
- 若者に使われる英語「Snowflake」の意味って何?【スラング】
といったものが。特に三番目の記事にはこういう記述があります。
Urban Dictionaryを見てみると・・・
Snowflake
A term for someone that thinks they are unique and special, but really are not. It gained popularity after the movie “Fight Club” from the quote “You are not special. You’re not a beautiful and unique snowflake. You’re the same decaying organic matter as everything else."
本人はユニークで特別と思っているが実際はそうでない人を指す表現。以下略 Urban Dictionary
とのことです。1999年の映画ファイトクラブから広まった表現なんですね。こんなところにもファイトクラブの影響があるなんて。
以上まとめると、Snowflakeには「ユニーク・特別」のイメージがあり、その意味で普通に使われます。更に、ファイトクラブ由来で、 「本人はユニークで特別と思っているが実際はそうでない人」も指すようになって来てます。どっちの意味で使われているかは前後の コンテキストで把握するより他ない感じですね。
やはり(ある属性を持った)人々を指して言っているような気がします。
そして後続のパラグラフの「snowflake」もまあそのままの意味(雪片)ではないでしょうね。
難しいのは、いつ慣習から逸脱するかを把握することです。逸脱した特殊性は、いつ、遠出を正当化するのに十分なほど重大なものなのでしょうか? 私は、美しくユニークな雪片になりたいという衝動のほとんどは、十分に考慮されておらず、 Railsから外れて行くことのコストが過小評価されていると主張しますが、慎重に検討するまでもないこともあるでしょう。
The hard part is knowing when to stray from convention. When are the deviating particulars grave enough to warrant an excursion? I contend that most impulses to be a beautiful and unique snowflake are ill considered, and that the cost of going off the Rails is under appreciated, but just enough of them won’t be that you need to examine all of them carefully.
big pot
Rails MVCの中のビューを構築しているテンプレートを見てみましょう。デフォルトでは、 これらのテンプレートからコードを抽出されたヘルパーは、すべてを大きな鍋に突っ込まれた関数にすぎません! 名前空間すら一つにまとめられています。なんと衝撃的で恐ろしいことでしょう、昔ながらのPHPのスープのようなものです!
Take the templates we build the view in our Rails MVC pie with. By default, all the helpers that allow us to extract code from these templates are just a big pot of functions! It’s a single namespace even. Oh the shock and the horror, it’s like PHP soup!
PHP soup
はなにかの比喩とかあるいは現実の何か(製品名称とか)にひっかけているような
気がするんですが、これというものは見つけられませんでした。
DHH本人に聞くよりないかも。
それと all the helpers that allow us to extract code from these templates are just a big pot of functions!
の that allow ~はhelpersを説明しているもので、そこを省くと
all the helpers are just a big pot of functions
なわけだから、
「これらのテンプレート(複数)からコードをextractすることを可能にするhelpers(複数)は
関数(複数)のbig potだよ」という流れなのでは。
Railsははるか昔にちょっと触っただけなので、 ヘルパーやらテンプレートに誤解があるかもしれませんが。
しかし、ビューテンプレートの多くの抽象化がそうであるように、相互作用をほとんど必要としない個々の関数を提示するという点では、 PHPは正しかったと私は考えています。そして、この目的のためには、単一の名前空間、メソッドの大きな鍋は、合理的な選択であるだけでなく、 優れた選択でもあります。
But I contend that PHP had it right when it came to presenting individual functions that rarely needed to interact, as is the case with much abstraction in view templates. And for this purpose, the single namespace, the big pot of methods, is not only a reasonable choice, but a great one.