ときどきの雑記帖 2012

最新ページへのリンク
目次ページへのリンク

一つ前へ 2012年8月(中旬)
一つ後へ 2012年9月(上旬)

ホームへ

2012年08月31日

■_

シリーズ累計80万部

やさしいC 第4版 (「やさしい」シリーズ) やさしいC++ 第4版 (「やさしい」シリーズ)

この二つを都内某大型書店で見かけたのですが、 どちらも帯に「シリーズ累計80万部」とかなんとかありまして。 これってCとC++がそれぞれの版を合計して80万部ずつではなく、 やさしいC、やさしいC++、その他合計ってことなんでしょうか。 C、C++で累計にしても80万部とかいうとちと怖い(謎)

この方も多作ですねえ。 Amazon.co.jp: 高橋 麻奈: 本

■_

■_ Free as in Freedom

電書で買ったんですが(実はハードカバーも買っていたはずなんだけど行方不明) Free as in Freedom [Paperback] - O'Reilly Media ←これね。 んが、 Amazon.co.jp: Free As In Freedom: Richard Stallman's Crusade for Free Software: Sam Williams: 洋書 と比較してみると、前者が Publisher: O'Reilly Media Released: March 2002 Pages: 240 なのに対して後者が ペーパーバック: 225ページ 出版社: Oreilly & Associates Inc (2012/2/9) 出版時期がこれだけ違うのは一体… 不確実な記憶では改訂版がでたとかなんとか聞いたような覚えもあるので それが2012年2月としても、オライリーのサイトの情報が2002年てのは?

Free As In Freedom: Richard Stallman's Crusade for Free Software

■_

明日は(ぴー)なのでいつにも増して今日は内容がないよう

あ、これではないです ○| ̄|_ 函数プログラミングの集い 2012 in Tokyo - [PARTAKE]

2012年08月30日

■_

ドリフターズお休み>アワーズ

■_ 20 controversial programming opinions

こういうのがありまして

20 controversial programming opinions « Programmers Stack Exchange Blog
20 controversial programming opinions
August 29, 2012 by Yannis Rizos. 59 comments

One of the very first ideas we had for this blog was to convert some of the wonderful gems of
the early era of our site, the undisciplined period, to blog posts. Questions that were once
enthusiastically received by the community, but no longer fit Programmer's scope.

The first deleted question I've chosen is Jon Skeet's “What's your most controversial
programming opinion?” question, a +391 scored question that was originally asked on Stack
Overflow on January 2, 2009. What follows are twenty of the highest voted answers, in random
order…


で、20個ほどありがたい(?)お言葉があげられていたのですがそれはさておき

■_

こちらで大人気に。 20 controversial programming opinions : programming

そこからひとつ。

20 controversial programming opinions : programming

These are controversial? These are tame opinions in the programming world; and I pretty much
agree with all of them, at least for the most part. If you want a controversial programming
opinion talk to the following people:

    Linus Torvalds - Not really always controversial with opinions, but has a tendency to have
    harsh discussions regarding the opinions with people who disagree, making any controversy
    significantly louder. He does notoriously think very little of C++ and its users.

    Richard Stallman - The GNU philosophy, for or against. He can be a bit crazy, but maybe he's
    right? You tell me.

    Matthew Dillon - Stirs up some trouble in the BSD community. I believe he's fairly reasonable,
    but you don't create a successful (and significantly different) fork of FreeBSD without there
    being some controversial opinions.

    Lennart Pottering - Creator/maintainer (I always get this term wrong - since the software is
    written by many people now) of pulseaudio and systemd.

    Ulrich Drepper - glibc dictator. Everyone wants glibc to be their glibc, Drepper has had quite
    the reputation for laying a smackdown and providing some very controversial directions in the
    development of the most widely used GNU library - arguably helping shape how C is widely used
    in many ways.

    Bjarne Stroustrup - Creator of C++, decider of many controversial developments within the
    language and how it might affect its predecessor, C.

    Theo de Raadt - Creator of OpenBSD. Security comes first and that can lead him to some pretty
    controversial opinions between him and the performance folks. He's been in a few arguments with
    a number of people on this list.

    Zed A. Shaw - just Zed. He has opinions, but can't close his mouth. I like him for his honesty,
    but not everything he says is agreeable.

■_ The Best Programming Advice I Ever Got

ちょっと前に Rob Pike が書いていたのが話題になったアレ。 調べてみると二週間に一回の割で連載されてるっぽい? "The Best Programming Advice I Ever Got" with Andrei Alexandrescu | | InformIT

余裕があったら遡って調べてみる。

■_ 入門書

【2012年8月】IT技術書新刊・近刊まとめ(その2) - @IT自分戦略研究所

【2012年8月】IT技術書新刊・近刊まとめ(その2) - @IT自分戦略研究所

やさしいC 第4版
高橋 麻奈 著
ソフトバンククリエイティブ
2012/8/31
2625円(税込)

分かりやすさで定評のあるプログラミング入門書のベストセラー、高橋麻奈の「やさしい」シリーズ。
C言語の基本を、スラスラ読める文と、シンプルで分かりやすいサンプルプログラムを使った解説で、
プログラミング経験ゼロからでもスッキリ理解できます。


やさしいC++ 第4版
高橋 麻奈 著
ソフトバンククリエイティブ
2012/8/31
2730円(税込)

プログラミング入門書のベストセラー、高橋麻奈の「やさしい」シリーズから『やさしいC++』を改訂。
豊富なイラストとスラスラ読める文、分かりやすいサンプルプログラムを使った解説で、プログラミング
経験ゼロからでもスッキリ理解できます。 

正直前の版とどこが変わるんだろうという気が。 C11 やら C++11の話を(少なくともこの時期にある程度のボリュームを)書くような シリーズとも思えないし。 実はまじめにきちんとこの二つを読んだことはないんですが、 Java のやつをちょっと読んだときにすぐにわかるような つつきどころがあったし、この二つもそうだったような。

つーかさー(省略されました)

■_

2012年08月29日

■_

都立中央図書館
ちょっとばかし交通の便がいいとは言い難いところがあるけど あそこは籠もって本読むには本当に良いところだと思う。 パソコン席は御多分に漏れず競争率高めだけど。 図書館でモクモク自習会 2回目 - [PARTAKE] 都立図書館の蔵書の中から読みたい技術書を見つけ、読んだり、写経したりする会です。

■_ Making Software

Making Software ―エビデンスが変えるソフトウェア開発

積んでました。 んでまあ昨日辺りからぼちぼち読み始めたのですが、もっと早く読み始めるべきだったとちょっと後悔。 まだそれほど読み進めてないので(しかも順番無視)、 書評感想などは他の方にお任せ。

書評:Making Software — KaoriYa ちょむメモ: 読書: 『Making Software ――エビデンスが変えるソフトウェア開発』 Making Softwareを読んで、ソフトウェア開発の技芸と工学について考えた - 勘と経験と読経 Making Software エビデンスが変えるソフトウェア開発 | kozawa のたまに気になること

高橋会長も言及していた。

オライリーも技評もそれ以外も頑張ってると思う - 思っているよりもずっとずっと人生は短い。

2011年に出た本だけでも、『JavaScriptパターン』『ウェブオペレーション』『iPhoneアプリ設計の極意』
『ゲームストーミング』『Hacking:美しき策謀 第2版』『ビューティフルビジュアライゼーション』
『デザイニング・インターフェース 第2版』くらいはありましたっけ。あと忘れていけないのは「Make」方面。
「Make」誌はもちろん、数年前の本では『Making Things Talk』『Prototyping Lab』、今年だと『XBeeで
作るワイヤレスセンサーネットワーク』とか、MTMも含めて、少なくともこの国のフィジカルコンピューティ
ング、電子工作に関する日本語オライリーの貢献というは少なくはないはず。そうそう、コンピュータ書じゃ
ないけど『Cooking for Geeks』もありましたね(追記:あと、『Making Software』もありました。ソフト
ウェア開発におけるエビデンスにフォーカスした本で、こういう本を見るとさすがオライリーだと思います
よね?)

んでコメント欄(こっちのやりとりは今まで気がついてなかった)

"Making Software" はオライリーらしい、というよりはむしろこれまでの(オープンソース解説書路線な)オ
ライリーらしくない硬派な本で、最初はアジソンウェズレイだと密かに勘違いしてました:D いい本でござ
います。個人的には要素技術解説本というのは賞味期限が短くもともと書籍向きではないので、書き手の意
見や研究結果をまとめたこういう本が増えると良いなと思います。それは特定出版社や2011に限った話じゃ
ないですけど。

で、あれだ。 アレとかアレとかアレのようないかにも売れます(売れてます) という本の(ぴー)な書評(や感想)は嬉々として書きまくるのにこういう本の紹介はしない人ってのは… おっと個人攻撃良くない(^^;

もうちょっと読んだら改めて書く(かもしれないしそうでもないかもしれない)。

■_ ソート

実は全部はまだ読んでないw

Tabasco Sort: a super-optimal merge sort - Paul Khuong mostly on Lisp

Tabasco Sort: A Super-optimal Merge Sort

Aug 27th, 2012

In an earlier post, I noted how tedious coding unrolled sorts can be. Frankly, that's the main
reason I stopped at leaf sorts of size three. Recently, Neil Toronto wrote a nice post on the
generation of size-specialised merge sorts. The post made me think about that issue a bit more,
and I now have a neat way to generate unrolled/inlined merge sorts that are significantly smaller
than the comparison and size “-optimal” inlined merge sorts.

The code is up as a single-file library, and sorts short vectors faster than SBCL's inlined
heapsort by a factor of two to three… and compiles to less machine code. The generator is a bit
less than 100 LOC, so I'm not sure I want to include it in the mainline yet. If someone wants to
add support for more implementations, I'd be happy to extend Tabasco sort, and might even consider
letting it span multiple files ;)

Differently-optimal sorts

The inlined merge sort for three values (a, b, and c) is copied below. It has to detect between
3!=6 permutation, and does so with an optimal binary search tree. That scheme leads to code with
n!−1 comparisons to sort n values, and for which each execution only goes through two or three
comparisons (≈logn!).

“optimal” inlined merge sort (n = 3)


  (if (< b c)
      (if (< a b)
          (values a b c)
          (if (< a c)
              (values b a c)
              (values b c a)))
      (if (< a c)
          (values a c b)
          (if (< a b)
              (values c a b)
              (values c b a))))

で変化していくコードを見るだけでも結構楽しい。

An optimal sorting network for three values needs only three comparisons, and always executes
those three comparisons.

optimal sorting network (n = 3)

  (progn
    (when (< c b)
      (rotatef b c))
    (when (< b a)
      (rotatef a b))
    (when (< c b)
      (rotatef b c)))

Finally, the leaf sort I used in SBCL is smaller than the inlined merge sort (three comparisons),
but sometimes executes fewer than three comparisons. It's superoptimal ;)

“super-optimal” inlined merge sort (n = 3)

  (progn
    (when (< c b)
      (rotatef b c))
    (if (< b a)
        (if (< c a)
            (values b c a)
            (values b a c))
        (values a b c)))

  
Posted by Paul Khuong Aug 27th, 2012

■_ C についてのあれこれ

Interesting C Interview Questions and Answers | Hacker News

12 Interesting C Interview Questions and Answers

12 Interesting C Interview Questions and Answers

by Himanshu Arora on August 17, 2012

In this article, we will discuss some interesting problems on C language that can help students
to brush up their C programming skills and help them prepare their C fundamentals for interviews.

1. gets() function

Question: There is a hidden problem with the following code. Can you detect it?
以下のコードには問題が隠れています。それを指摘してください。

  #include<stdio.h>

  int main(void)
  {
      char buff[10];
      memset(buff,0,sizeof(buff));

      gets(buff);

      printf("\n The buffer entered is [%s]\n",buff);

      return 0;
  }

Answer: The hidden problem with the code above is the use of the function gets(). This function
accepts a string from stdin without checking the capacity of buffer in which it copies the value.
This may well result in buffer overflow. The standard function fgets() is advisable to use in
these cases.

2. strcpy() function

(略)

12. Processing printf() arguments

Question: What would be the output of the following code?
          次のコードが出力するものは?

  #include<stdio.h>

  int main(void)
  {
      int a = 10, b = 20, c = 30;

      printf("\n %d..%d..%d \n", a+b+c, (b = b*2), (c = c*2));

      return 0;
  }

Answer: The output of the above code would be :

110..40..60

This is because the arguments to the function are processed from right to left but are printed
from left to right.
Copyright © 2008–2012 Ramesh Natarajan. All rights reserved

12 はコメント欄でも指摘されてますが、環境や処理系を問わず成り立つことではないですね。

■_ 検索機械

とっても同意。自分が一番ひどい(使いにくい)と思うのは(省略されました)

■_

2012年08月28日

■_

今日発売のイブニング掲載のとろ鉄(とろける鉄工所)のエピソードは結構オススメな気がする (色々と)

■_ RSBC

そもそも今から揃えられるのかという気もするけど(新刊では)

佐藤大輔 85

885 名無し三等兵 [sage] 2012/08/27(月) 23:18:53.35 ID:??? Be:
    レッドサンブラッククロスってどれを買いそろえれば良いの?

    いろんな出版社から出ていてワケワカメ。
    あと、皇国の守護者は一応は区切りが良いところまで話が進んでたけど
    レッドサンブラッククロスはどうなの?
    キリが良い巻で止めとけみたいなのってある? 

886 名無し三等兵 [sage] 2012/08/27(月) 23:38:38.89 ID:??? Be:
    >>885
    多分読まないのが良いと思うよ。
    谷先生の土木世界へ逝くことをお勧めする。 

887 名無し三等兵 [sage] 2012/08/28(火) 00:17:03.51 ID:??? Be:
    >>885
    わざわざ煉獄に望んで入ることはあるまいよ?
    さぁ、その話はもう忘れるんだ。 

888 名無し三等兵 [sage] 2012/08/28(火) 00:21:46.67 ID:??? Be:
    >>886
    何それ?

    >>887
    つまり、キリが良いところは無いって事? 

889 名無し三等兵 [sage] 2012/08/28(火) 00:30:51.47 ID:??? Be:
    >>885
    みんな言うとおり読まないのがいいと思うけど、
    やっぱり冒険したいというなら…。
    徳間文庫の1~7巻で一応キリがいいんじゃないかと。
    あとは手に入れば外電。
    C☆ノベルズシリーズは飢えに苦しむことになるのでお勧めしない。 

890 名無し三等兵 [sage] 2012/08/28(火) 00:35:20.52 ID:??? Be:
    結論:鮭先生の要塞か艦隊シリーズ読んどけ。 

891 名無し三等兵 [sage] 2012/08/28(火) 00:38:49.81 ID:??? Be:
    >>889
    読まない方がいいってのは
    単純につまらないのか、
    面白いから餓えに苦しむのか
    どっちなんやろか・・・ 

894 名無し三等兵 [sage] 2012/08/28(火) 11:52:19.22 ID:??? Be:
    >>891
    後者でおk 

895 名無し三等兵 [sage] 2012/08/28(火) 14:54:27.61 ID:??? Be:
    今続き書いても糞化してそうなんだよね 

■_

■_

色々とダメ

2012年08月27日

■_

石井琢朗引退の知らせが。 お疲れさま。ではあるのだけど彼に限らず98年優勝時の主力メンバーに対しては 色々複雑な感情があったりする。

■_ Top 5 Surprises When Starting Out as a Software Developer

5つの驚き

Top 5 Surprises When Starting Out as a Software Developer | Henrik Warne's blog

Top 5 Surprises When Starting Out as a Software Developer
Posted on August 22, 2012

Even though more than 20 years have passed, I still remember wondering what it would be like
to finish university and start working. Up until that point, I had pretty much spent my whole
life in school, with only a few, non-programming summer jobs thrown in. My expectations of
what it would be like to work as a software developer were mostly correct, but there were a
few surprises in the first few years, and here are the top five:

であげられたのが

  1. Complexity from Aggregation
  2. Few Clever Algorithms
  3. Software is Never Done
  4. Writing Matters
  5. People Interaction

詳しくは元記事を

■_

■_

2012年08月26日

■_

あまりの暑さに明け方に目を覚まし、 涼しいところに逃げてぼけーっとしてたら コオロギの鳴き声(いやありゃ「声」じゃあないけども)が聞こえてきた。 今年初めて聞いたような(夜に聞いた覚えがない)。

読んだ
泳ぐやる夫シアター AAで学ぶ南北戦争への道 第8回 遥かなる理想郷 泳ぐやる夫シアター やる夫で学ぶ第一次世界大戦  第二十八夜「終わりの始まり」

で、南北戦争の方で   イギリス内戦(1638-1660)清教徒革命ともいう という記述を見つけ、「え、なにそれはつみみ>イギリス内戦」 ということで調べてみると イギリス内戦(その1) : 防衛省OB太田述正の日本はアメリカの属国だ

イギリス内戦(その1) : 防衛省OB太田述正の日本はアメリカの属国だ

イギリス内戦(English Civil War)と聞くと、一体何のことだ、と思われる方もいるかもしれません。
 そういう方は、1642年から1651年(内戦の最後の戦いが行われた年)にかけてのイギリスでの内戦の
ことだと申し上げれば、なんだ、清教徒革命(1642~49年。1649年はチャールス1世が処刑された年)
のことか、と拍子抜けされるのではないでしょうか。
 実は、「イギリス内戦」についての英語版ウィキペディアと「清教徒革命」についての日本語版ウィ
キペディアは、用いられている多くの図や絵が共通しており、明らかにほぼ同じ事件を扱っていると
考えられるにもかかわらず、前者には英国におけるイギリス内戦に関する史観の推移を説明する中で
Puritan Revolution (清教徒革命)という言葉がただの一回切り出てくるだけなのに対し、後者の中
にはイギリス(イングランド)内戦(English Civil War)という言葉は、革命の全過程の間に断続的
に行われた内戦の総称として用いられているにとどまります。
 一体これはどういうことなのでしょうか。
English Civil War - Wikipedia, the free encyclopedia

The English Civil War (1642–1651) was a series of armed conflicts and political machinations
between Parliamentarians (Roundheads) and Royalists (Cavaliers). The first (1642–46) and
second (1648–49) civil wars pitted the supporters of King Charles I against the supporters of
the Long Parliament, while the third war (1649–51) saw fighting between supporters of King
Charles II and supporters of the Rump Parliament. The Civil War ended with the Parliamentary
victory at the Battle of Worcester on 3 September 1651.

へー。

■_ 同人誌

秋葉原に行って、委託販売されてたこれを偶然見つけて買ってみた→ 棚から一掴み ★コミックマーケット82 新刊のご案内 買った最新号はまだ通販のページにはないっぽい。 COMIC ZIN 通信販売/商品一覧ページ

んでまあこの COMIC ZIN というところはわりと評論系のものも熱心に扱っている印象があって、 アキバ系!電脳空間カウボーイズ: 第三百三十二回 定理証明支援系言語って何よ!? で話題に上っている「坂口くん」の関わっているものもあったりします COMIC ZIN 通信販売/商品一覧ページ 残念ながらこちらも話題のCoq本はまだの模様 (秋葉原の店舗に行けば2Fにありました)。

で、同人誌と言えばLLVM本。 やれ達人出版会で出せば買うだの色々要望がありましたけど 一部の人の良いようにちょっと引っかかるものがありました。 まあ今更いうことでもないんですが (ちょっとした表現のことでもあるし)

LLVM 本のあとがきから。

思い返せば最初に LLVM 本を書くといい始めたのは2011年の8月頃、夏コミの直後のことでした。あの時は
5月病を患って悶々とした日々を送っていまして、夏コミの熱気にあてられた筆者は漠然と何か作りたいな
と思ったのでした。
(略)
ちなみに、筆者がこの本を書こうと思った原点は某 Cell の同人誌にあったりします。当時まだ学生で Cell
プログラミングをやっていた筆者は、あの本の完成度と情報量に感動を覚え、いつか自分もこういう活動を
してみたいと漠然と思ったものです。Cellの本の中の人とは面識もなければ本の購入時以外で会話したこと
すらないのですが、未だに一方的な憧れと尊敬の念を抱いていたりします。恐らくあの本を手にとっていな
ければ筆者がこのような本を書こうと思うことも無かったことでしょう。
  

だから「(俺が読みたいのだから)電子書籍で出せ」というのは もうちょっと言い方があるだろうと思ったのですよね。 まあわたしにしても当人たち関係なしに ぶーたれてるのでナニサマだよって話ですが。

[コミックマーケット]人気の理由は多様化 来場者増で新たな課題も | ホビー | マイナビニュース

■_ 買った

これを知って → お絵かきボード「Boogie Board rip」が限定特価に、2,500円

さてどこでどう使おう(マテ

■_ Scala 本

某スレ。

プログラミング言語 Scala 8冊目 

356 デフォルトの名無しさん [sage] 2012/08/26(日) 10:53:07.97 ID: Be:
    Scalaでおすすめの書籍はどれですか?
    あと買ってはいけない読んではいけない書籍も教えて下さい。 

358 デフォルトの名無しさん [sage] 2012/08/26(日) 12:46:39.19 ID: Be:
    >352
    >大学で Java を教えてるとファイル入出力が鬼門な学生たちがあまりに多く、

    鬼門というかいちいち説明に時間さくのが勿体ないので、東大京大ではRubyを採用している。

    情報工学科で授業で使う言語って、
    ・Matlab (Scilab,Rの場合も)
    ・JavaやC (プログラム言語というのはこういうもの、という題材向け)
    ・Ruby (東大、京大の1年向け教養課程で、情報科学の宿題向けに)
    が人気だろ。
    言語の授業だったら、Smalltalk,Haskell,Schemとかも教えるかもしれないけど、あくまで言語の授業の題材としてだな。

    大学で言語専門でなければ、言語は使うもの。
    教えたいのは言語じゃなくて、 情報科学の方だからな。
    Matlabでアルゴリズム開発して、速度のためにC言語で再実装するっていうのが多いだろ。

    そういう用途では、Scalaで関数言語の特徴生かして、アルゴリズムも実装も一気にやっちゃうのは得策だな。

    >>356
    > Scalaでおすすめの書籍はどれですか?

    ・即実践なら、「Scala逆引きレシピ」
    ・入門なら、「Scalaで学ぶ関数脳入門」
    他は、「Scala実践プログラミング」「ボクらのScala 」「プログラミングScala」など。

    > あと買ってはいけない読んではいけない書籍も教えて下さい。

    本代くらいケチるな。全部買え。
    と言いたいところだが、ここでこんな質問するような>356には、通称「コップ本」はムリ。買うな。 

いくらなんでもHさんの本は除外すべきだと思う。>Scala 本

■_ アレ

The Pragmatic Architect - To Boldly Go Where No One Has Gone Before

To Boldly~ってスタートレックのアレで商標登録だかされてんじゃなかったっけか とちょっと気になった(めんどくせー)。

■_

2012年08月25日

■_

エスカレーターで
狭い通路でも頑として並んで歩いているカップルが エスカレーターにさしかかるや一列に(二人並ぶだけの幅は十分にあります)。 恐るべしエスカレーター(違)

2012年夏のプログラミング・シンポジウム

■_ 醵金

読めなかったw

「醵金させていただきます」という表現はおかしいですか? 学生時代に指導してい... - Yahoo!知恵袋

きょきん【醵金】の意味 - 国語辞書 - goo辞書

[名](スル)ある目的のために金を出し合うこと。また、その金。「被災者救援のために―する」
[補説]「拠金」とも当てて書く。

なるほど。

■_

 実物でたどるコンピュータの歴史 [東京書籍株式会社]

■_ TAPL

以前から翻訳作業がなされているという話は洩れ伝わってきていましたが わりと広く知られるイベントがあった模様。

日本語版でるまでに読書会完走できるかしらん ○| ̄|_

おや?

■_

■_

PFSD も途中で放置してるなあ(読書会も…)

Purely Functional Data Structures Purely Functional Data Structures

この二つどこが違うんだろ? 版が改まったにしては時期の差がそれほどではないし、 ハードカバーとペーパーバックなら値段の差が? あら、 ペーパーバック: 232ページ ハードカバー: 232ページ

■_

飽きたのでこの辺で投げるw

Why OO Sucks by Joe Armstrong

Why OO Sucks by Joe Armstrong
なぜオブジェクト指向は××なのか

(Note: This is a copy of the original that used to live at http://www.bluetail.com/~joe/vol1/v1_oo.html )

When I was first introduced to the idea of OOP I was skeptical but didn't know why - 
it just felt "wrong". After its introduction OOP became very popular (I will 
explain why later) and criticising OOP was rather like "swearing in church". 
OOness became something that every respectable language just had to have.

最初にオブジェクト指向プログラミングの考えを intoroduce したとき
わたしは懐疑的だったのですが、それがなぜかはわかりませんでした。
ただ単に「間違っている」と感じたのです。
オブジェクト指向プログラミングが非常にポピュラーなものになり
(それがなぜかは後で説明します)、
criticising OOP was rather like "swearing in church"  のあとでは
オブジェクト指向性 (OOness) は rspectable なプログラミング言語すべてが
持っていなければならないものとなりました。


As Erlang became popular we were often asked "Is Erlang OO" - well, of 
course the true answer was "No of course not" - but we didn't to say this 
out loud - so we invented a serious of ingenious ways of answering the question that 
were designed to give the impression that Erlang was (sort of) OO (If you waved your 
hands a lot) but not really (If you listened to what we actually said, and read the 
small print carefully).

Erlang がポピュラーなものになるにつれ、
わたしたちはしばしば「Erlang はオブジェクト指向プログラミング言語なのか」という
質問を頻繁に受けるようになりました。
もちろんそれに対する回答は "No of course not" でしたが、
わたしたちはそれを直接大声で主張することはせず
so we invented a serious of ingenious ways of answering the question that 
were designed to give the impression that Erlang was (sort of) OO (If you waved your hands a lot)
but not really (If you listened to what we actually said, and read the small print carefully).
ですからわたしたちは発明しました
その質問に回答する
serious of ingenious way 
を

Erlang はオブジェクト指向(の一種)ではあるけれども
そのものではない


At this point I am reminded of the keynote speech of the then boss of IBM in France 
who addressed the audience at the 7th IEEE Logic programming conference in Paris. IBM 
prolog had added a lot of OO extensions, when asked why he replied:

ここでわたしが

IBM prolog はたくさんのオブジェクト指向拡張を追加されていて
それがなぜかと尋ねられたときに彼はこう返しました


  "Our customers wanted OO prolog so we made OO prolog"
  我々の顧客がオブジェクト指向 prolog を望んだ。であるから我々はオブジェクト指向 prolog を作ったのだ

I remember thinking "how simple, no qualms of conscience, no soul-searching, no asking
"Is this the right thing to do" ...


Why OO sucks
なぜオブジェクト指向は(略)なのか

My principle objection to OOP goes back to the basic ideas involved, I will outline 
some of these ideas and my objections to them.

Objection 1 - Data structure and functions should not be bound together
異論 1 データ構造と関数は一緒にまとめるべきではない


Objects bind functions and data structures together in indivisible units. I think this 
is a fundamental error since functions and data structures belong in totally different 
worlds. Why is this?

オブジェクトは独立した unit の中で関数とデータ構造とを一緒に結び付けます。
わたしはそれが根本的な過ち (fundamental error) であると確信しています。
なぜなら関数とデータ構造は根本的の異なる世界に属するものだからです。
なぜこうなっているのでしょうか?


Functions do things. They have inputs and outputs. The inputs and outputs are data 
structures, which get changed by the functions. In most languages functions are built 
from sequences of imperatives: "Do this and then that ..." to understand 
functions you have to understand the order in which things get done (In lazy FPLs and 
logical languages this restriction is relaxed).

関数は仕事をします。関数には入力と出力があります。関数の入力と出力はデータ構造であり、
関数によって変化するものです。大部分のプログラミング言語では、関数は「これをやって、
次にあれをやって…」といった命令の並びから構成されています。
関数を理解するためにはそういった命令がどのような順番で行われるのかを理解しなければなりません
(lazyな関数プログラミング言語や論理プログラミング言語ではこの制限は緩和されます)。


    Data structures just are. They don't do anything. They are intrinsically declarative.
    "Understanding" a data structure is a lot easier than "understanding" a
    function.

    データ構造は単に存在しています。
    データ構造はなにもしません。
    データ構造は intrinsically declarative です。
   「データ構造を理解すること」は「関数を理解すること」よりもずっと易しいことです。


Functions are understood as black boxes that transform inputs to outputs. If I understand the
input and the output then I have understood the function. This does not mean to say that I could
have written the function.

関数は入力を出力へと変換するブラックボックスとして理解されます。
もしわたしが入力と出力とを理解していればその関数を理解していします。
これはその関数を記述ということは意味していません。


Functions are usually "understood" by observing that they are the things in a computational
system whose job is to transfer data structures of type T1 into data structure of type T2.

関数は通常、型 T1 のデータ構造を型 T2 のデータ構造へと変換する働きをする
computational システムにおける things であるということを
observing することにより「理解」されます


Since functions and data structures are completely different types of animal it is 
fundamentally incorrect to lock them up in the same cage.

関数とデータ構造とは完全に異なる動物なのですから、同じ檻 (cage) に放り込むことは
根本的に間違っていること (fundamentally incorrect) なのです。


Objection 2 - Everything has to be an object
異論 その2 すべてがオブジェクトでなければならない

Consider "time". In an OO language "time" has to be an object. But 
in a non OO language a "time" is a instance of a data type. For example, in 
Erlang there are lots of different varieties of time, these can be clearly and 
unambiguously specified using type declarations, as follows:

「時間」について考えてみましょう。
オブジェクト指向言語においては「時間」はオブジェクトであるべきものです。
しかし、非オブジェクト指向の言語においては「時間」はあるデータ型のインスタンスです。
たとえば Erlang では時間について a lots of differnt varieties があって、
以下のような type declarations を使った明快かつ曖昧さのない指定が可能になっています。

  -deftype day() = 1..31.
  -deftype month() = 1..12.
  -deftype year() = int().
  -deftype hour() = 1..24.
  -deftype minute() = 1..60.
  -deftype second() = 1..60.
  -deftype abstime() = {abstime, year(), month(), day(), hour(), min(), sec()}.
  -deftype hms() = {hms, hour(), min(), sec()}.
  ...

Note that these definitions do not belong to any particular object. they are 
ubiquitous and data structures representing times can be manipulated by any function 
in the system.

これらの定義がなんら特定のオブジェクトに属していないということに注意してください。
これらの定義は ubiquious (どこにでもある) なものであり、
データ型はシステムに存在する任意の関数によって操作が可能な時間を表現しています。


There are no associated methods.

データ型に結び付けられたメソッドはありません。


Objection 3 - In an OOPL data type definitions are spread out all over the place
異論 3 オブジェクト指向言語におけるデータ型の定義はすべての場所に spread out される


In an OOPL data type definitions belong to objects. So I can't find all the data type 
definition in one place. In Erlang or C I can define all my data types in a single 
include file or data dictionary. In an OOPL I can't - the data type definitions are 
spread out all over the place.

オブジェクト指向プログラミング言語における型定義はオブジェクトに属します。
そのため、一箇所ですべてのデータ型の定義を見つけるということができません。
Erlang や C では、自分のすべてのデータ型をひとつの include file だとか
data directionary で定義できます。
オブジェクト指向プログラミング言語ではそれはできません。
オブジェクト指向プログラミング言語におけるデータ型の定義は
all over the place に spread out してしまうのです。


Let me give an example of this. Suppose I want to define a ubiquitous data structure. 
ubiquitous data type is a data type that occurs "all over the place" in a system.

ひとつ例を出します。ある ubiquitous なデータ構造を定義したかったとしましょう。
その ubiquitous なデータ型は、あるシステムにおいて "all over the place" に
登場するデータ型です。


As lisp programmers have know for a long time it is better to have a smallish number 
of ubiquitous data types and a large number of small functions that work on them, than 
to have a large number of data types and a small number of functions that work on them.

Lisp プログラマーが昔から知っているように、
少数の ubiquitos なデータ型とそれに対して作用する多数の小さな関数を持つことは、
多数のデータ型とそれに対して作用する少数の関数を持つことよりも良いのです。


A ubiquitous data structure is something like a linked list, or an array or a hash 
table or a more advanced object like a time or date or filename.

ubiquitous なデータ構造は linked list だとか、あるいは配列、ハッシュ、テーブル、
さらには時間だとか日付、ファイル名のような、もっと高度なオブジェクトのようなものです。


In an OOPL I have to choose some base object in which I will define the ubiquitous 
data structure, all other objects that want to use this data structure must inherit 
this object. Suppose now I want to create some "time" object, where does 
this belong and in which object...

オブジェクト指向プログラミング言語では、自分が定義する ubiquitous な data structure を
使うためにほかのすべてのオブジェクトがそれを継承しなければならないようななんらかの
base object を選択しなければなりません。
わたしがそういった役割を果たす "time" オブジェクトを作りたいと仮定しましょう


Objection 4 - Objects have private state
異論 4 オブジェクトは private な状態を持っている

State is the root of all evil. In particular functions with side effects should be avoided.

状態とは諸悪の根源 (root of all evil) です。特に副作用を伴う関数は排除すべきものです。


While state in programming languages is undesirable, in the real world state abounds. 
I am highly interested in the state of my bank account, and when I deposit or withdraw 
money from my bank I expect the state of my bank account to be correctly updated.


プログラミング言語における状態とは undesirable なものでありますが、現実世界は状態に囲まれています。
わたしは自分の銀行口座の状態にとても関心がありますし、
銀行口座に入金したり、あるいは口座から引き出したときには
自分の口座の状態が正しく更新されることを期待します。


Given that state exists in the real world what facilities should programming language 
provide for dealing with state?


    OOPLs say "hide the state from the programmer". The states is hidden and visible
    only through access functions.

    オブジェクト指向プログラミング言語は「状態をプログラマーから隠している」と主張しています。
    状態は隠蔽され、アクセス関数を通してのみ見ることが可能です。

    Conventional programming languages (C, Pascal) say that the visibility of state variables is
    controlled by the scope rules of the language.

    (C や Pascal のような) conventinal なプログラミング言語は状態変数の可視性 (visibility) は
    言語のスコープ規則によって制御されると主張しています。

    Pure declarative languages say that there is no state.

    純粋な宣言型プログラミング言語は状態は存在しないと主張しています。


The global state of the system is carried into all functions and comes out from all 
functions. Mechanisms like monads (for FPLs) and DCGs (logic languages) are used to 
hide state from the programmer so they can program "as if state didn't matter"
but have full access to the state of the system should this be necessary.

グローバルなシステムの状態はすべての関数に carried into されまたすべての関数から comes out されます。
関数プログラミング言語のためのモナドや
論理プログラミング言語のための DCG はプログラマーから状態を隠すために用いられていて、
「状態が問題でないかのように」プログラムできますが、
 state of the system へのフルアクセスを持っています。


The "hide the state from the programmer" option chosen by OOPLs is the worse 
possible choice. Instead of revealing the state and trying to find ways to minimise 
the nuisance of state, they hide it away.

オブジェクト指向プログラミング言語によって選択された
"hide the state from the programmer" option
(「プログラマーから状態を隠すという」選択) は非常に悪いものです。
状態を revealing (露出させる? )したり
nuisance of state を最小化する手段を探そうとするのではなく、
状態を隠してしまっています。


Why OO was popular?
なぜオブジェクト指向は popular だったのでしょうか?

    Reason 1 - It was thought to be easy to learn.
               学習が簡単であると考えられた

    Reason 2 - It was thought to make code reuse easier.
               コードの再利用を簡単にすると考えられた

    Reason 3 - It was hyped.


    Reason 4 - It created a new software industry.
               新しいソフトウェア industry を作り出した


I see no evidence of 1 and 2. Reasons seem to be the driving force behind the technology.
If a language technology is so bad that it creates a new industry to solve problems of its
own making then it must be a good idea for the guys who want to make money.

わたしは 1 と 2 の証拠となるものを見たことがありません。
理由はテクノロジーの背後に隠された driving force のようです。
もしある言語テクノロジーが自分が作った問題を解決するための新しい industry を作り出すほどに
悪いものであるのなら、それは金儲けをしたい連中にとっては優れた考えであるに違いありません。


This is is the real driving force behind OOPs.

これこそが、オブジェクト指向プログラミングの背後にある本当の driving force なのです。

2012年08月24日

■_

実は今日になって(偶然読んだ古雑誌で)知った→ 田口壮、現役引退を決意 - プロ野球ニュース : nikkansports.com 彼は確か大学では内野手をやっていて、 ドラフトの時点でも強打の内野手といった感じで期待されてたような覚えが。 ところがプロでやってみると色々あって内野手失格。 しかし外野手に転向したらそれが実に良かった。 メジャーリーグではイチローのような派手に目につく活躍はあまりなかったけど 実働年数は結構なもので、それは賞賛すべきものだと思う。 やはりブルーウェーブからメジャーリーグに行った長谷川滋利もそうだけど コーチの声とかかからんのかねえ (実はコーチやったりすると年収が下がるというのはあるかもしれない)。

内野手失格で云々というとベイスターズからホークスに移籍した内川もそうだなあ。

アドエス
交換した電池がまたへたってきたらしく。 さてどうしたものか。

■_ 21世紀のC

21st Century C - O'Reilly Media を買ってみた(もちろん電書)。

どんな本かというと

21st Century C - O'Reilly Media

This book is great for developers comfortable with languages like Ruby or Python who want to
build systems (or extensions) in C but don't know where to start in putting together a proper C
development environment, or what libraries to choose, or what is the state of the art when it
comes to cross-platform support (and many more things). It covers the environment, packaging
your project, and the language itself.

Also, if you know C but you haven't used it in a while and you would like to get back on track,
this book can also be of great help.

The book seems well researched, it is well written and it is a real joy to read. Well done
and highly recommended!

Bottom Line Yes, I would recommend this to a friend

Zed の Learn C The Hard Way とか Learn C The Hard Way A Clear & Direct Introduction To Modern C Programming オライリーの Head First C とか なぜ今? という気もするけれどもありきたりな入門書ではない感じなので楽しみではある (こっちはただいま電子積読ちゅー)。

Head First C

あ、そこの C++er 落ち着いて。

■_

仕事の話

なんというかこう、とにかく「上流」で「仕様」を「洩れなく策定して」 とかいうのはもはや無理筋だと思うんだけどにんともかんとも。

とはいえ「見落としは常にある」という前提で、 どうリカバリーするか(被害拡大を防ぐか)に労力を振り向ける…なんてのは無理だろうなあ。

■_

■_

ここの容量問題をどうにかしないとねえ。

2012年08月23日

■_

ぐだぐだな

エスカレーターについて

■_

■_ 新刊

渋谷のジュンク堂で買ってきた。

【宇宙戦争】横山信義総合スレ25【碧海の玉座】

503 名無し三等兵 [sage] 2012/08/23(木) 09:50:30.46 ID:??? Be:
    早いトコだと今日あたり新刊と遭遇出来るのかな? 

504 名無し三等兵 [sage] 2012/08/23(木) 18:43:41.37 ID:??? Be:
    >>503
    >>503
    某ぶろぐ情報ニヨレバ、カノ某大先生ノ奇怪ナル新刊げっと情報之在リ
    出版社ヲ同ジクスル系列新刊ナレバ今夕ヲ以テ流通開始ト推定ス

    所謂“ねたばれ”ハ正規ノ作戦開始日ヲ考慮シ日本時間8月26日00:00ヲ
    以テ行動開始ヲ提案ス。如何 

505 503 [sage] 2012/08/23(木) 20:22:03.98 ID:??? Be:
    >>504
    情報謝ス
    作戦開始時間ニ異論ナシ 前動続行サレタシ 

八八艦隊海戦譜 - 開戦篇 (C・Novels 55-75)
八八艦隊海戦譜 - 開戦篇 (C・Novels 55-75)

おっと表紙画像はまだなかった。

■_

こっちはまだだった

Think Stats ―プログラマのための統計入門

なんかベタ誉めしまくってるっぽい人がいるあっちの本も買ったけどあえてスルー。 読み終わってからなんか書くかもしれないし書かないかもしれない (単なるひねくれ者です)。

2012年08月22日

■_

いやまあなんというか、「ぼのぼの」に出てくるアライグマのオヤジみたいに 身の回りのあらゆることに腹を立てまくっているというか (別に世の中がどうとか大層なことではない)

ぼのぼの 第32話 - YouTube

■_

■_

型じゅーよー。

Why type-first development matters | Blog | TomasP.Net

Why type-first development matters

Using functional programming language changes the way you write code in a number of ways. Many
of the changes are at a small-scale. For example, you learn how to express computations in a
shorter, more declarative way using higher-order functions. However, there are also many
changes at a large-scale. The most notable one is that, when designing a program, you start
thinking about the (data) types that represent the data your code works with.

関数プログラミング言語を使うことで、数多くのコードの書き方が変わります。
そういった変化の多くが small-scale です。
たとえば、あなたは computation を短くどのように表現するか、
高階関数を使ったより declative な手法といったものを学びます。
しかし、large-scale においても多くの変化があるのです。
そのもっとも notable なもののひとつが
プログラムを設計するときにコードと一緒に使われるデータを表現する
型について考え始めるというものです。


In this article, I describe this approach. Since the acronym TDD is already taken, I call the
approach Type-First Development (TFD), which is probably a better name anyway. The development
is not driven by types. It starts with types, but the rest of the implementation can still use
test-driven development for the implementation.

略

Summary

In this article, I described a development style that often comes with functional programming
languages such as F#. It was partly inspired by a related article on type driven design, but I
discussed the topic from a different perspective - instead of looking at types technically, I
tried to highlight what they mean in practice, for the development style.

本 article では、F#のような関数プログラミング言語でよく使われる開発スタイルについて
説明しました。そのスタイルは type driven design に関連した article に
inspire されたものでしたが、わたしは異なる視点からそれを論じてみました。
型を technically に注目するのではなく
開発スタイルにとって、型が実践でどのような意味を持っているのかを
強調しようとしたのです。


The key idea of the type-first development (TFD) is that we start designing and prototyping
applications by writing the types they work with. In F#, this is done by writing type
declarations (using records and discriminated unions), but the same methodology can work in
other languages - even in dynamically typed ones.

As demonstrated by a simple case study, focusing on the types first gives you a very powerful
way to communicate and prototype ideas about design. Using types is very developer-friendly
approach, but I believe that it is accessible to any somewhat technical person. Moreover, the
methodology works well with test-driven development style and it helps writing extensible code.

Of course, no one size fits all. There are clearly scenarios where TFD is not the right way. As
mentioned, it is very developer centric and so if you need to work with non-technical analysts
or customers on a complex projects, approaches like behaviour-driven development (BDD) may be
more relevant.


Published: August 16, 2012 00:21

2012年08月21日

■_

関数型言語

アライグマの親父

■_

■_ Dedekind cuts

数学は(も?)いろいろありますねえ。 あとからあとから出てくる出てくる Programming language for EXACT real arithmetic based on Dedekind cuts : programming Dedekind cut ってなによーと調べてみるがよくわからん(^^; Dedekindの切断 デデキント切断 - Wikipedia Dedekind cut - Wikipedia, the free encyclopedia

andrejbauer/marshall

andrejbauer/marshall

Marshall is a programming language for exact real arithmetic based on ideas from Abstract Stone
Duality (ASD) and the construction of the Dedekind reals in ASD. See also Andrej Bauer's talk
on Efficient computations with Dedekind reals.

The main idea of Marshall is that a real number x is given as a Dedekind cut, i.e., as a pair
of predicates describing which numbers are smaller than x and which ones larger. For example,
the sqrt function is defined in Marshall as

let sqrt =
  fun a : real =>
    cut x
      left  (x < 0 \/ x * x < a)
      right (x > 0 /\ x * x > a)

一つ前へ 2012年8月(中旬)
一つ後へ 2012年9月(上旬)

ホームへ


リンクはご自由にどうぞ

メールの宛先はこちらkbk AT kt DOT rim DOT or DOT jp