give IT a try

プログラミング、リモートワーク、田舎暮らし、音楽、etc.

When Database Source Control Goes Bad 翻訳 Part7

前回からかなり間が空いてしまいましたが、海外サイトのWeb記事の翻訳を再開してみたいと思います。
ちなみに前回までのあらすじははこちらです。↓

When Database Source Control Goes Bad 翻訳 Part1 - give IT a try
When Database Source Control Goes Bad 翻訳 Part2 - give IT a try
When Database Source Control Goes Bad 翻訳 Part3 - give IT a try
When Database Source Control Goes Bad 翻訳 Part4 - give IT a try
When Database Source Control Goes Bad 翻訳 Part5 - give IT a try
When Database Source Control Goes Bad 翻訳 Part6 - give IT a try


原文はこちらです。↓


When Database Source Control Goes Bad

Distributed Version-control Systems

分散バージョン管理システム


Distributed Version-control Systems like Git and Mercurial are the fun new fad in version-control, and everyone seems to think that they are so much cooler than more traditional and linear systems like Vault. To me, it seems to grossly overcomplicate an already difficult issue by exacerbating the most problematic concepts, namely branching and merging. But I’m a crusty old conservative who scoffs at anything new, so maybe (and even hopefully) I’m wrong. I was quick to dismiss it as a new toy of bored astronauts, but with DVCS platforms being built by former critics like Joel Spolsky and Eric Sink, I have to figure that I’m probably wrong and will change my mind eventually. But in the meantime there is one idea in DVCS systems that I can already get on board with, and that’s the idea that everyone is working in their own branch. As we’ve discussed, you simply cannot be working in the same sandbox as everyone else, or you will have intractable chaos. You should stay plugged into what everyone else is doing on a regular basis, usually through version-control, but you must also isolate yourself, and you must do so thoroughly.


GitやMercurialのような分散バージョン管理システムが流行している。誰もがGitやMercualのことをVaultのような伝統的でリニアなシステムよりもクールだと考えているようだ。私から見ればこれはブランチ化やマージのような難しい問題をさらに悪化させ、ひどく複雑化しているように感じる。しかし私は新しいものをなんでも冷ややかに見てしまう保守的な老人なので、もしかすると私が間違っているかもしれない(むしろそう願う)。私は分散バージョン管理システムを退屈な宇宙飛行士の新しいおもちゃだと思ってすぐに無視したが、Joel SpolskyやEric Sinkのようにかつて分散バージョン管理システムを批判していた人々によってプラットフォームが構築されているのを考えると、私の考えは間違っていると認め、考えを改めることになると思う。しかし一方で、分散バージョン管理システムには私も受け入れることができる思想がある。その思想とは全員が自分自身のブランチで作業していることだ。すでに議論したように、全員が一つのサンドボックスで作業することはできない。そんなことをすれば手に負えないカオスが待ち受けている。バージョン管理システムを通じて定期的に他の作業者のやっていることとをチェックしつつも、徹底して自分の作業場は隔離しなければならない。


And here’s the thing (and this may very well be the idea that eventually opens my path to DVCS enlightenment): your local machine is branch. Granted, it is not a very robust branch, because it only has two states (your current state and the latest thing in source-control), but you are still essentially branched until you check in, in which case you will have to merge. It might be a really small merge, because the changes were small or backwards compatible, or because you were not branched off locally for that long, or you are the only one working on a feature, or because you’ve been communicating with the rest of your team, or because you are the only person who actually does any work, but you are merging nonetheless.


ここで重要なことを一つ挙げよう(そしてこれは私を分散バージョン管理システムに目覚めさせる思想になるかもしれない) --- それは「あなたのローカルマシンはブランチである」ということだ。確かに、ローカルマシンは大したブランチではない。なぜならローカルマシン上の現在の状態とソース管理上の最新の状態という二つの状態しか存在しないからだ。しかし、あなたがチェックインするまでは本質的にブランチとなっているし、マージしなければならない場合だってある。マージといっても本当に小さなマージかもしれない。なぜなら変更点は非常に小さく、後方互換性を維持していたり、それほど長い間ブランチ状態になっていなかったり、ある特定の機能だけを変更していたり、それまでずっとチームメンバーとコミュニケーションをとっていたり、実際に作業をしているのは自分だけだったり・・・するからだ。とはいえ、いかなる理由にもかかわらず、あなたは変更点をマージする。


What does this have to do with databases? Branching is all about isolation. You must isolate your development environment, and you must so thoroughly. If you think of your machine as simply a branch of the source code, it crystallizes the idea that everything you are doing locally is a full stream of code, and it must contain everything needed to run that code, and must represent all of the changes in that code, including the database. In a broader view, if you were to branch your code to represent a release or a patch or feature, you obviously should be branching your database code at the same time (assuming of course that your database is under version-control). If that is the case, and if the code on your local machine is nothing more than a primitive branch of what is in source-control, then your local machine should also have its own copy of the database.


これがデータベースとどういう関係があるのだろうか?ブランチ化とは隔離することとほぼ同等である。自分の開発環境は徹底して隔離しなければならない。自分のマシンがソースコードのブランチであると考えるのであれば、次のような思想が導かれる。すなわち、ローカルマシンにはすべてのソースコードが存在し、なおかつコードを実行するために必要なすべてのものが存在し、なおかつローカルマシンにはコード上のあらゆる変更を反映しなければならない。データベースの変更も含めてね。より大きな視点で考えてみよう。あるリリース、またはあるパッチ、またはある機能と等しくなるようにコードをブランチ化をするつもりであれば、当然データベースコードも同じタイミングでブランチ化されるべきだ(もちろんデータベースはバージョン管理ツールの管理下にあることを前提としている)。それならば、そしてローカルマシン上のコードがソース管理のブランチにすぎないのであれば、ローカルマシンも独立したデータベースのコピーを持つべきだ。