by shigemk2

当面は技術的なことしか書かない

ブログを毎日書き始めて丸5年が経った

f:id:shigemk2:20160919184127p:plain

へっぽこ日記を毎日書き始めてまる5年になりました。

5年になったからと言って、別に何があるわけではないのですが。

田舎の大学で国際関係学を学んでて、ろくでもない大学生活を送ってて、就活失敗してプータローのまま大学を卒業して、人生のレールから外れました。

大学卒業してから友人に勧められてプログラミングを独学で始めて丸6年。上司に勧められるままブログを書くようになって、丸5年。

今も毎日ブログを書いていますし、今もプログラマとして生きていられています。ありがとうございます。

人並みのコミュニケーション能力があって、世間に対して割りきれてれば、今頃はメガバンクや大手マスコミとかに就職して、今より高い収入を得てて、結婚して子供もいたかもしれません。 プログラミングを始めたのも、ブログを始めたのも、周りに勧められたからです。でも、今の生活も今の人生も今の職業も悪くないと思っています。

いつまでエンジニアを続けられるか、ブログを続けられるかわかりませんが、もう少し頑張ってみようと思います。

イミュータブルなオブジェクトはスレッドセーフ

ということ。中身が不変なので、マルチスレッド処理中にロックをかける必要がないから。

Immutable objects greatly simplify your program, since they:

  • are simple to construct, test, and use
  • are automatically thread-safe and have no synchronization issues
  • don't need a copy constructor
  • don't need an implementation of clone
  • allow hashCode to use lazy initialization, and to cache its return value
  • don't need to be copied defensively when used as a field
  • make good Map keys and Set elements (these objects must not change state while in the collection)
  • have their class invariant established once upon construction, and it never needs to be checked again
  • always have "failure atomicity" (a term used by Joshua Bloch): if an immutable object throws an exception, it's never left in an undesirable or indeterminate state

www.javapractices.com