<?xml version="1.0" encoding="UTF-8"?> <rss
version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:wfw="http://wellformedweb.org/CommentAPI/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
><channel><title>Web scratch &#187; javascript</title> <atom:link href="http://efcl.info/category/javascript/feed/" rel="self" type="application/rss+xml" /><link>http://efcl.info</link> <description>フリーソフトやFirefoxなどについて、web全般なサイト</description> <lastBuildDate>Sat, 14 Apr 2012 15:37:26 +0000</lastBuildDate> <language>en</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.3.2</generator> <item><title>テストで学ぶJavaScriptについて</title><link>http://efcl.info/2012/0414/res3059/</link> <comments>http://efcl.info/2012/0414/res3059/#comments</comments> <pubDate>Sat, 14 Apr 2012 14:38:26 +0000</pubDate> <dc:creator>azu</dc:creator> <category><![CDATA[javascript]]></category> <category><![CDATA[test]]></category><guid
isPermaLink="false">http://efcl.info/?p=3059</guid> <description><![CDATA[A Test-Driven JS Assessment というテストを通るようなコードを書いて、JavaScriptを学ぶものが公開されていたので、それの紹介です。JS Assessmentは最初に失敗するテストが用意さ [...]]]></description> <content:encoded><![CDATA[<p><a
href="https://github.com/rmurphey/js-assessment">A Test-Driven JS Assessment</a> というテストを通るようなコードを書いて、JavaScriptを学ぶものが公開されていたので、それの紹介です。<br
/><a
href="https://github.com/rmurphey/js-assessment">JS Assessment</a>は最初に失敗するテストが用意されていて、そのテストコードを通るような関数などを書いていってJavaScriptの力試し、学習をするものです。</p><p>簡単にやり方を書くと、Node環境を用意した状態で</p><p><code>git clone https://github.com/rmurphey/js-assessment.git</code>などで、リポジトリをダウンロードして、<br
/>ダウンロードしたディレクトリ内で、 nodeを使って以下のようコマンドを実行してテストが実行できるローカルサーバを立ち上げます。</p><pre><code>npm install
node bin/serve</code></pre><p>実行した状態で <a
href="http://localhost:4444">http://localhost:4444</a> というURLに行けば、Mochaで書かれたテストが走った結果が表示されます。</p><p>テストを通るコードの書き方は、node bin/serve を実行した時に表示されますが、</p><pre>To work on the tests, open a browser and visit http://localhost:4444. Then,
edit the tests in the files in the tests/app directory, reloading your browser
to see whether the tests are passing.

Each test will look something like this:

    it("you should be able to return a truthy value", function() {
      // define a function for fn so that the following will pass
      expect(fn()).to.be.ok();
    });

In the case of the above test, you'd need to define a value for fn (by default,
fn is a function that does nothing):

    it("you should be able to return a truthy value", function() {
      // define a function for fn so that the following will pass
      fn = function() {
        return true;
      };
      expect(fn()).to.be.ok();
    });

For some tests, the instructions will be more involved; in those cases, the
inline comments should give you the details you need.</pre><p>と書かれているように、tests/appにあるコードを編集して、それぞれのitの中にテストケースを通るような関数を定義したりして、<br
/> <a
href="http://localhost:4444">http://localhost:4444</a>にアクセスして全てのテストが通るようにするのが目的です。</p><p>e.g) <a
href="https://github.com/azu/js-assessment/commit/c955516d4a66de510585e50f7811253363422e8a">solve Arrays Test · c955516 · azu/js-assessment</a></p><p><img
title="arrays.js - js-assessment - [~_workspace_js_js-assessment].png" src="http://efcl.info/wp-content/uploads/2012/04/arrays.js-js-assessment-_workspace_js_js-assessment.png" border="0" alt="Arrays js  js assessment   ~ workspace js js assessment" width="600" height="400" /></p><p>テストコードはNodeで動くテストフレームワークの<a
href="http://visionmedia.github.com/mocha/">Mocha</a>を使って書かれています。<br
/>expectで期待してる動作は結構そのまま分かる感じなので、itのテスト文とあわせれば、大体期待してる挙動はわかるとは思いますが、<br
/><a
href="http://visionmedia.github.com/mocha/">Mocha</a>自体の挙動も少し知っておいたほうがいい場合もあります。</p><ul><li><a
href="http://blog.livedoor.jp/ryu22e/archives/65636256.html">ryu22eBlog : Node.jsのテスティングフレームワーク「Mocha」（前編）</a></li></ul><p>用意されてるテストはArrayの機能のテストやBackboneを使ったViewのテスト、非同期のテスト等が入っています。</p><p>これで、<a
href="https://github.com/rmurphey/js-assessment">A Test-Driven JS Assessment</a>の紹介は終わりですが、これ見た時に<a
href="http://el.jibun.atmarkit.co.jp/rails/2011/01/koan-3c38.html">禅の公案（Koan）</a>に何か似てるなとか思った。<br
/>JavaScriptでは</p><ul><li><a
href="https://github.com/liammclennan/JavaScript-Koans">liammclennan/JavaScript-Koans</a> ( <a
href="http://code.google.com/p/javascript-koans/">javascript-koans &#8211; Javascript learning tool. &#8211; Google Project Hosting</a> )</li><li><a
href="http://d.hatena.ne.jp/ninoseki/20111023/1319369396">禅の公安スタイルでCoffeeScriptを学ぶ「coffeescript-koans」 &#8211; にのせき日記</a></li></ul><p>あたりが知られてそうな気がします。(他にも色々あるみたいだけど <a
href="https://github.com/search?langOverride=&amp;q=Koans+Javascript&amp;repo=&amp;start_value=1&amp;type=Repositories&amp;utf8=%E2%9C%93">Search · Koans Javascript</a> ) <br
/>Koanとは以下のような穴埋め用のテストがかかれていて、そのテストを正しく書いてプログラミングを学べるものです。</p><pre><code lang="javasript">test("not", function() {
    not(__, 'what is a false value?');
});</code></pre><p>という穴埋め問題だったら</p><pre><code lang="javasript">test("not", function() {
    not(false, 'what is a false value?');
});</code></pre><p>のように、穴埋めするという感じのものです。</p><p>Koanと<a
href="https://github.com/rmurphey/js-assessment">JS Assessment</a>を比較すると、Koanは穴埋めという要素が強くてロジックなどは用意されてる感じになっています。<br
/>一方 、<a
href="https://github.com/rmurphey/js-assessment">A Test-Driven JS Assessment</a>はテストだけ書かれていて、ロジックなどを書いてそのテストを通るような関数を書くというものになっています。<br
/>似ているところもありますが、やりたいことは逆な感じなので、<a
href="https://github.com/rmurphey/js-assessment">A Test-Driven JS Assessment</a>の場合は人によって答えが全然違うという事もありえて、<br
/>実際のテストファーストなものを書くのに近い感じになっていそうです。</p><p>これを書きながら、JavaScriptを学ぶ時に、最初からテストと絡めて学習したほうが良い感じになるのかなということについて考えていました。<br
/>実際に新人教育とかでそういう事をしている<a
href="http://tech.kayac.com/">会社</a>さん等の成果とかを聞いてみたいですね。</p><ul><li> <a
href="http://rmurphey.com/blog/2012/04/12/a-baseline-for-front-end-developers/">A Baseline for Front-End Developers &#8211; Adventures in JavaScript Development</a></li><li><a
href="http://testfirst.org/">TestFirst.org &#8211; The Home of Test-First Teaching</a></li></ul>]]></content:encoded> <wfw:commentRss>http://efcl.info/2012/0414/res3059/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>ECMAScript勉強会 アウトラインメモ</title><link>http://efcl.info/2012/0407/res3047/</link> <comments>http://efcl.info/2012/0407/res3047/#comments</comments> <pubDate>Sat, 07 Apr 2012 12:57:38 +0000</pubDate> <dc:creator>azu</dc:creator> <category><![CDATA[javascript]]></category> <category><![CDATA[イベント]]></category> <category><![CDATA[ECMAScript]]></category><guid
isPermaLink="false">http://efcl.info/?p=3047</guid> <description><![CDATA[ECMAScript勉強会 に参加してきたのでその時のメモです。久々に結構難しい内容が多かった気がする。 ECMAScript勉強会 ECMAScript概要 &#8211; rika_t ECMAScript Stud [...]]]></description> <content:encoded><![CDATA[<p><a
href="http://atnd.org/events/25793">ECMAScript勉強会</a> に参加してきたのでその時のメモです。<br
/>久々に結構難しい内容が多かった気がする。</p><h1 style="padding-top: 0.25em; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: initial; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 23px; border-top-style: none; border-top-color: initial; margin: 0px;">ECMAScript勉強会</h1><h2 style="margin-top: 1.5em; margin-right: 0px; margin-bottom: 1em; margin-left: 0px; padding-top: 0.5em; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 4px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 20px; border-top-style: solid; border-top-color: #e0e0e0;">ECMAScript概要 &#8211; rika_t</h2><p
style="margin-top: 1em; margin-right: 0px; margin-bottom: 1em; margin-left: 0px; line-height: 1.5em; padding: 0px;"><a
style="color: #4183c4; text-decoration: none; padding: 0px; margin: 0px;" title="ECMAScript Study #1 Overview" href="http://www.slideshare.net/agigigigi/ecmascript-study-1-overview">ECMAScript Study #1 Overview</a></p><hr
style="padding: 0px; margin: 0px; border: 1px solid #dddddd;" /><p
style="margin-top: 1em; margin-right: 0px; margin-bottom: 1em; margin-left: 0px; line-height: 1.5em; padding: 0px;">途中参加</p><hr
style="padding: 0px; margin: 0px; border: 1px solid #dddddd;" /><h3 style="margin-top: 1em; margin-right: 0px; margin-bottom: 1em; margin-left: 0px; padding: 0px; border: 0px initial initial;">newがあるのはなぜ</h3><p
style="margin-top: 1em; margin-right: 0px; margin-bottom: 1em; margin-left: 0px; line-height: 1.5em; padding: 0px;">プリミティブな型もメソッドやプロパティを持てるようにしたいため、ラッパーでラップしてた。</p><h3 style="margin-top: 1em; margin-right: 0px; margin-bottom: 1em; margin-left: 0px; padding: 0px; border: 0px initial initial;">globalオブジェクト</h3><p
style="margin-top: 1em; margin-right: 0px; margin-bottom: 1em; margin-left: 0px; line-height: 1.5em; padding: 0px;">globalオブジェクトは必ずしもwindowではない</p><h3 style="margin-top: 1em; margin-right: 0px; margin-bottom: 1em; margin-left: 0px; padding: 0px; border: 0px initial initial;">オブジェクトとクラス</h3><p
style="margin-top: 1em; margin-right: 0px; margin-bottom: 1em; margin-left: 0px; line-height: 1.5em; padding: 0px;">内部的には[[Class]]というクラスという文字列がでてきてた。</p><ul
style="margin-top: 1em; margin-right: 0px; margin-bottom: 1em; margin-left: 2em; padding: 0px;"><li
style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; padding: 0px;">ES6から内部的にClassというものがなくなってきてる。</li><li
style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; padding: 0px;">リテラル記法やコンストラクタを使って様々なオブジェクトを表現してる</li><li
style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; padding: 0px;"><code
style="padding-top: 0px; padding-right: 0.2em; padding-bottom: 0px; padding-left: 0.2em; font: normal normal normal 12px/normal Monaco, 'Courier New', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', monospace; font-size: 12px; background-color: #f8f8ff; color: #444444; margin: 0px; border: 1px solid #dedede;">NativeBrand</code>という名前になってる</li></ul><h3 style="margin-top: 1em; margin-right: 0px; margin-bottom: 1em; margin-left: 0px; padding: 0px; border: 0px initial initial;">prototype</h3><ul
style="margin-top: 1em; margin-right: 0px; margin-bottom: 1em; margin-left: 2em; padding: 0px;"><li
style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; padding: 0px;">仕様書にのってるprototypeの図はわかりにくい</li></ul><h3 style="margin-top: 1em; margin-right: 0px; margin-bottom: 1em; margin-left: 0px; padding: 0px; border: 0px initial initial;">変数宣言</h3><ul
style="margin-top: 1em; margin-right: 0px; margin-bottom: 1em; margin-left: 2em; padding: 0px;"><li
style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; padding: 0px;">“var&#8221;キーワードの後にIdentifierを与える</li><li
style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; padding: 0px;">opt = option としてInitiliser = “str&#8221;みたいに初期化も同時にできる</li><li
style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; padding: 0px;">IdentifierName<ul
style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 2em; padding: 0px;"><li
style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; padding: 0px;">IdentifierStart (変数名の最初に文字列) か初めて</li><li
style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; padding: 0px;">IdentifierName IdentifierPart</li></ul></li><li
style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; padding: 0px;"><strong
style="padding: 0px; margin: 0px;">let</strong> から始まる内容はここで定義してる内容をかかれてる(他を見なくてもいい)</li></ul><h3 style="margin-top: 1em; margin-right: 0px; margin-bottom: 1em; margin-left: 0px; padding: 0px; border: 0px initial initial;">変数宣言の処理</h3><ul
style="margin-top: 1em; margin-right: 0px; margin-bottom: 1em; margin-left: 2em; padding: 0px;"><li
style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; padding: 0px;">return (normal,empty,empty) normalは正常終了</li></ul><h2 style="margin-top: 1.5em; margin-right: 0px; margin-bottom: 1em; margin-left: 0px; padding-top: 0.5em; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 4px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 20px; border-top-style: solid; border-top-color: #e0e0e0;">ES.next 追っかけ &#8211; teramako</h2><p
style="margin-top: 1em; margin-right: 0px; margin-bottom: 1em; margin-left: 0px; line-height: 1.5em; padding: 0px;"><a
style="color: #4183c4; text-decoration: none; padding: 0px; margin: 0px;" title="ES.next 追っかけ - ECMAScript 勉強会" href="http://teramako.github.com/doc/es6_study-20120407/index.html">ES.next 追っかけ &#8211; ECMAScript 勉強会</a></p><h3 style="margin-top: 1em; margin-right: 0px; margin-bottom: 1em; margin-left: 0px; padding: 0px; border: 0px initial initial;">メーリングリストの購読</h3><ul
style="margin-top: 1em; margin-right: 0px; margin-bottom: 1em; margin-left: 2em; padding: 0px;"><li
style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; padding: 0px;">es-discussの購読</li><li
style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; padding: 0px;">ES.nextに追うため見るメーリングリスト</li><li
style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; padding: 0px;">流量が多い</li></ul><h3 style="margin-top: 1em; margin-right: 0px; margin-bottom: 1em; margin-left: 0px; padding: 0px; border: 0px initial initial;">構文抽出</h3><ul
style="margin-top: 1em; margin-right: 0px; margin-bottom: 1em; margin-left: 2em; padding: 0px;"><li
style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; padding: 0px;">wiki.ecmascript.org に最新版のドラフトがアップロードされる</li><li
style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; padding: 0px;">更新内容は色分け表示されてる</li><li
style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; padding: 0px;">ドラフト仕様から構文部分のみ抽出したものを作成</li></ul><h3 style="margin-top: 1em; margin-right: 0px; margin-bottom: 1em; margin-left: 0px; padding: 0px; border: 0px initial initial;">Mozillaの実装追いかけ</h3><p
style="margin-top: 1em; margin-right: 0px; margin-bottom: 1em; margin-left: 0px; line-height: 1.5em; padding: 0px;">＊SpiderMonkeyのHarmony実装をトラッキングするメタバグがある</p><h3 style="margin-top: 1em; margin-right: 0px; margin-bottom: 1em; margin-left: 0px; padding: 0px; border: 0px initial initial;">構文解析</h3><p
style="margin-top: 1em; margin-right: 0px; margin-bottom: 1em; margin-left: 0px; line-height: 1.5em; padding: 0px;">JavaScriptがどうやって構文解析していくか</p><ul
style="margin-top: 1em; margin-right: 0px; margin-bottom: 1em; margin-left: 2em; padding: 0px;"><li
style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; padding: 0px;">Reflect.parse()メソッド</li><li
style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; padding: 0px;">結果をオブジェクトのツリーで返してくれる</li><li
style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; padding: 0px;">reflect.jsmを読み込んでReflect.parseが利用できる</li></ul><h4 style="padding: 0px; margin: 0px; border: 0px initial initial;">iv/js</h4><ul
style="margin-top: 1em; margin-right: 0px; margin-bottom: 1em; margin-left: 2em; padding: 0px;"><li
style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; padding: 0px;">ES.nextの実装をパースできるツール</li><li
style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; padding: 0px;">http://constellation.github.com/iv/js/es.next.html</li><li
style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; padding: 0px;">esprimaを使ったものも最近でてきた</li><li
style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; padding: 0px;">http://esprima.org/demo/parse.html</li></ul><h3 style="margin-top: 1em; margin-right: 0px; margin-bottom: 1em; margin-left: 0px; padding: 0px; border: 0px initial initial;">quasiリテラル</h3><ul
style="margin-top: 1em; margin-right: 0px; margin-bottom: 1em; margin-left: 2em; padding: 0px;"><li
style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; padding: 0px;">ヒアドキュメント的に使えそう</li></ul><h2 style="margin-top: 1.5em; margin-right: 0px; margin-bottom: 1em; margin-left: 0px; padding-top: 0.5em; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 4px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 20px; border-top-style: solid; border-top-color: #e0e0e0;">ES.next the corner case &#8211; Constellation</h2><p
style="margin-top: 1em; margin-right: 0px; margin-bottom: 1em; margin-left: 0px; line-height: 1.5em; padding: 0px;"><a
style="color: #4183c4; text-decoration: none; padding: 0px; margin: 0px;" title="ES.next the corner cases" href="http://constellation.github.com/slides/contents/20120407/presentation.html#slide1">ES.next the corner cases</a></p><ul
style="margin-top: 1em; margin-right: 0px; margin-bottom: 1em; margin-left: 2em; padding: 0px;"><li
style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; padding: 0px;">esprima<ul
style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 2em; padding: 0px;"><li
style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; padding: 0px;">コミッターやってる</li></ul></li></ul><h3 style="margin-top: 1em; margin-right: 0px; margin-bottom: 1em; margin-left: 0px; padding: 0px; border: 0px initial initial;">ConstDeclarationの話</h3><ul
style="margin-top: 1em; margin-right: 0px; margin-bottom: 1em; margin-left: 2em; padding: 0px;"><li
style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; padding: 0px;">initializer必須</li><li
style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; padding: 0px;">Blockスコープ</li><li
style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; padding: 0px;">BNFだけでは判断できないで、semaniticsも見ないと行けないようになった *</li></ul><h3 style="margin-top: 1em; margin-right: 0px; margin-bottom: 1em; margin-left: 0px; padding: 0px; border: 0px initial initial;">block scope</h3><ul
style="margin-top: 1em; margin-right: 0px; margin-bottom: 1em; margin-left: 2em; padding: 0px;"><li
style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; padding: 0px;">staticに解析可能</li><li
style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; padding: 0px;">ブロックスコープになったことで、ランタイムでないと判定できなかったのが、静的に解析が可能</li><li
style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; padding: 0px;"><p
style="margin-top: 1em; margin-right: 0px; margin-bottom: 1em; margin-left: 0px; line-height: 1.5em; padding: 0px;">そのため速度がかなりよくなった</p></li><li
style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; padding: 0px;"><p
style="margin-top: 1em; margin-right: 0px; margin-bottom: 1em; margin-left: 0px; line-height: 1.5em; padding: 0px;">再代入はsyntax errorにする</p></li><li
style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; padding: 0px;"><p
style="margin-top: 1em; margin-right: 0px; margin-bottom: 1em; margin-left: 0px; line-height: 1.5em; padding: 0px;">これもパース時に判断できるので、速度がよくなる</p><p
style="margin-top: 1em; margin-right: 0px; margin-bottom: 1em; margin-left: 0px; line-height: 1.5em; padding: 0px;">const V = 20; V = 30;// syntax error</p></li><li
style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; padding: 0px;"><p
style="margin-top: 1em; margin-right: 0px; margin-bottom: 1em; margin-left: 0px; line-height: 1.5em; padding: 0px;">early errorに分類(run timeより前)</p></li></ul><h3 style="margin-top: 1em; margin-right: 0px; margin-bottom: 1em; margin-left: 0px; padding: 0px; border: 0px initial initial;">egal operator</h3><ul
style="margin-top: 1em; margin-right: 0px; margin-bottom: 1em; margin-left: 2em; padding: 0px;"><li
style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; padding: 0px;">is</li><li
style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; padding: 0px;">isnt</li><li
style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; padding: 0px;">より値の同一性に重きをおいたequal</li><li
style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; padding: 0px;">is/isnt はContextual Keyword</li><li
style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; padding: 0px;">Statement先頭にくるキーワードはcontextual Keywordになる<ul
style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 2em; padding: 0px;"><li
style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; padding: 0px;">ofとか</li></ul></li><li
style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; padding: 0px;">文脈依存のキーワードのような扱い方をされるということ</li></ul><h3 style="margin-top: 1em; margin-right: 0px; margin-bottom: 1em; margin-left: 0px; padding: 0px; border: 0px initial initial;">&lt;| operator トライアングル演算子</h3><ul
style="margin-top: 1em; margin-right: 0px; margin-bottom: 1em; margin-left: 2em; padding: 0px;"><li
style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; padding: 0px;">常にArrayを継承できる</li><li
style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; padding: 0px;"><code
style="padding-top: 0px; padding-right: 0.2em; padding-bottom: 0px; padding-left: 0.2em; font: normal normal normal 12px/normal Monaco, 'Courier New', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', monospace; font-size: 12px; background-color: #f8f8ff; color: #444444; margin: 0px; border: 1px solid #dedede;">&lt;|</code>の右はリテラルしか置けない</li><li
style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; padding: 0px;">なぜリテラルのみ<ul
style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 2em; padding: 0px;"><li
style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; padding: 0px;">JITとかに破壊的になってしまう</li><li
style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; padding: 0px;">inline cacheが破壊されて、キャシュが機能しない</li></ul></li><li
style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; padding: 0px;">右側にfunctionリテラルときは挙動が変わる<ul
style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 2em; padding: 0px;"><li
style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; padding: 0px;">継承っぽくなる</li><li
style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; padding: 0px;">Base.prototypeを[[Prototype]]にもつObjectが生成されて、インスタンスのprototypeに設定される</li></ul></li><li
style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; padding: 0px;"><a
style="color: #4183c4; text-decoration: none; padding: 0px; margin: 0px;" title="ECMAScript と OOP パラダイム、それに ES.next の議論中 OOP 周りのシンタックス - oogattaの勉強日記" href="http://d.hatena.ne.jp/oogatta/20111204/1322982897">ECMAScript と OOP パラダイム、それに ES.next の議論中 OOP 周りのシンタックス &#8211; oogattaの勉強日記</a></li></ul><h3 style="margin-top: 1em; margin-right: 0px; margin-bottom: 1em; margin-left: 0px; padding: 0px; border: 0px initial initial;">ES.next Library Extension</h3><ul
style="margin-top: 1em; margin-right: 0px; margin-bottom: 1em; margin-left: 2em; padding: 0px;"><li
style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; padding: 0px;">String/Number/Function などに機能を増やす<ul
style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 2em; padding: 0px;"><li
style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; padding: 0px;">repeat</li><li
style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; padding: 0px;">startsWith</li><li
style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; padding: 0px;">などの便利な関数</li></ul></li><li
style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; padding: 0px;">GlobalなものをNumberにいける<ul
style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 2em; padding: 0px;"><li
style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; padding: 0px;">isFinite</li><li
style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; padding: 0px;">parseInt などをNumberにも追加する</li></ul></li></ul><h3 style="margin-top: 1em; margin-right: 0px; margin-bottom: 1em; margin-left: 0px; padding: 0px; border: 0px initial initial;">duplicateな変数purge機構</h3><ul
style="margin-top: 1em; margin-right: 0px; margin-bottom: 1em; margin-left: 2em; padding: 0px;"><li
style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; padding: 0px;">関数スコープのレキシカルスコープ内で変数宣言が被った時にsyntax errorになる</li></ul><h3 style="margin-top: 1em; margin-right: 0px; margin-bottom: 1em; margin-left: 0px; padding: 0px; border: 0px initial initial;">new Date(NaN)</h3><ul
style="margin-top: 1em; margin-right: 0px; margin-bottom: 1em; margin-left: 2em; padding: 0px;"><li
style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; padding: 0px;">ES.nextのnew Date(NaN).toString() Invalid Dateをかえすようになった</li></ul><h3 style="margin-top: 1em; margin-right: 0px; margin-bottom: 1em; margin-left: 0px; padding: 0px; border: 0px initial initial;">propertyの登場順</h3><ul
style="margin-top: 1em; margin-right: 0px; margin-bottom: 1em; margin-left: 2em; padding: 0px;"><li
style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; padding: 0px;">for-in , Object.keysなどの登場順が規定される</li></ul><h3 style="margin-top: 1em; margin-right: 0px; margin-bottom: 1em; margin-left: 0px; padding: 0px; border: 0px initial initial;">LHS</h3><ul
style="margin-top: 1em; margin-right: 0px; margin-bottom: 1em; margin-left: 2em; padding: 0px;"><li
style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; padding: 0px;">left hand side</li><li
style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; padding: 0px;">今まで()でくくって中が式なら何でも入ってた</li><li
style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; padding: 0px;">それがleft hand side expressionという部類のみになった</li></ul><blockquote
style="margin-top: 1em; margin-right: 0px; margin-bottom: 1em; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0.6em; border-left-width: 5px; border-left-style: solid; border-left-color: #dddddd; color: #555555;"><p
style="margin-top: 1em; margin-right: 0px; margin-bottom: 1em; margin-left: 0px; line-height: 1.5em; padding: 0px;">(1,2,3) = 20;</p></blockquote><p
style="margin-top: 1em; margin-right: 0px; margin-bottom: 1em; margin-left: 0px; line-height: 1.5em; padding: 0px;">というのがSyntaxErrorになる(ES5はReferrenceErrorなった) またパース時に判断できる</p><h3 style="margin-top: 1em; margin-right: 0px; margin-bottom: 1em; margin-left: 0px; padding: 0px; border: 0px initial initial;">ES.nextのバグ</h3><ul
style="margin-top: 1em; margin-right: 0px; margin-bottom: 1em; margin-left: 2em; padding: 0px;"><li
style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; padding: 0px;">draftにはバグある</li></ul><blockquote
style="margin-top: 1em; margin-right: 0px; margin-bottom: 1em; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0.6em; border-left-width: 5px; border-left-style: solid; border-left-color: #dddddd; color: #555555;"><p
style="margin-top: 1em; margin-right: 0px; margin-bottom: 1em; margin-left: 0px; line-height: 1.5em; padding: 0px;">({responseText }) = res;</p></blockquote><p
style="margin-top: 1em; margin-right: 0px; margin-bottom: 1em; margin-left: 0px; line-height: 1.5em; padding: 0px;">そもそもオブジェクトリテラルの解釈</p><h2 style="margin-top: 1.5em; margin-right: 0px; margin-bottom: 1em; margin-left: 0px; padding-top: 0.5em; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 4px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 20px; border-top-style: solid; border-top-color: #e0e0e0;">名前</h2><ul
style="margin-top: 1em; margin-right: 0px; margin-bottom: 1em; margin-left: 2em; padding: 0px;"><li
style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; padding: 0px;">ES.next<ul
style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 2em; padding: 0px;"><li
style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; padding: 0px;">バージョン番号がアレなので.nextという名前になってる</li></ul></li><li
style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; padding: 0px;"><a
style="color: #4183c4; text-decoration: none; padding: 0px; margin: 0px;" title="strawman" href="http://wiki.ecmascript.org/doku.php?id=strawman:strawman&amp;amp;s=strawman">strawman</a>(ストローマン)<ul
style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 2em; padding: 0px;"><li
style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; padding: 0px;">とりあえずな感じのバージョン</li></ul></li><li
style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; padding: 0px;">Harmony<ul
style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 2em; padding: 0px;"><li
style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; padding: 0px;">いずれかのバージョンにはいるかも的なもの</li></ul></li></ul><p
style="margin-top: 1em; margin-right: 0px; margin-bottom: 1em; margin-left: 0px; line-height: 1.5em; padding: 0px;"><a
style="color: #4183c4; text-decoration: none; padding: 0px; margin: 0px;" title="A brief history of ECMAScript versions (including Harmony and ES.next)" href="http://www.2ality.com/2011/06/ecmascript.html">A brief history of ECMAScript versions (including Harmony and ES.next)</a></p><h3 style="margin-top: 1em; margin-right: 0px; margin-bottom: 1em; margin-left: 0px; padding: 0px; border: 0px initial initial;">CoffeeScript</h3><ul
style="margin-top: 1em; margin-right: 0px; margin-bottom: 1em; margin-left: 2em; padding: 0px;"><li
style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; padding: 0px;">is/isnt みたいにセマンティックが同じなのに、挙動が違うことで論争が起きるのが怖い</li><li
style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; padding: 0px;">=&gt; とかでも論争がおきてる</li></ul><h2 style="margin-top: 1.5em; margin-right: 0px; margin-bottom: 1em; margin-left: 0px; padding-top: 0.5em; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 4px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 20px; border-top-style: solid; border-top-color: #e0e0e0;">ECMAScript読書会</h2><ul
style="margin-top: 1em; margin-right: 0px; margin-bottom: 1em; margin-left: 2em; padding: 0px;"><li
style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; padding: 0px;">6章からが本番</li><li
style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; padding: 0px;">Annexに定義などが入ってる</li><li
style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; padding: 0px;">Annex C はStrict mode</li><li
style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; padding: 0px;">D, Eが変更点修正点</li></ul><h3 style="margin-top: 1em; margin-right: 0px; margin-bottom: 1em; margin-left: 0px; padding: 0px; border: 0px initial initial;">4.概要</h3><ul
style="margin-top: 1em; margin-right: 0px; margin-bottom: 1em; margin-left: 2em; padding: 0px;"><li
style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; padding: 0px;"><blockquote
style="margin-top: 1em; margin-right: 0px; margin-bottom: 1em; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0.6em; border-left-width: 5px; border-left-style: solid; border-left-color: #dddddd; color: #555555;"><p
style="margin-top: 1em; margin-right: 0px; margin-bottom: 1em; margin-left: 0px; line-height: 1.5em; padding: 0px;">この仕様では外部データの入力や計算結果の出力に関する規定はありません</p></blockquote></li><li
style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; padding: 0px;">仕様外だが他にもオブジェクトがあるかもしれない事は考慮する(DOM)</li></ul><p
style="margin-top: 1em; margin-right: 0px; margin-bottom: 1em; margin-left: 0px; line-height: 1.5em; padding: 0px;">4.2.2 Strict mode</p><ul
style="margin-top: 1em; margin-right: 0px; margin-bottom: 1em; margin-left: 2em; padding: 0px;"><li
style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; padding: 0px;">“ECMAScriptは、言語において使えるいくつかの機能の使い方を制限したいと考えているユーザがいる可能性があることを認識しています。”</li><li
style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; padding: 0px;">標準のものに追加してエラー条件が定義される</li><li
style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; padding: 0px;">実装中の注意<ul
style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 2em; padding: 0px;"><li
style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; padding: 0px;">パース時にでるエラーと実行時エラー</li><li
style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; padding: 0px;">パース時に出すエラーはパース時にstrict modeかどうかをみないといけない</li><li
style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; padding: 0px;">関数の先頭にstringリテラルが連続してる　== ディレクティブ プロローグ という<ul
style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 2em; padding: 0px;"><li
style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; padding: 0px;">この範囲にuse strictが入っていればstrict modeになる</li></ul></li><li
style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; padding: 0px;">ディレクティブ プロローグの最後に&#8221;use strict&#8221;;を書かれた場合などは、最初のほうのパースにもstrictを適応してエラーにする</li><li
style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; padding: 0px;">関数の引数はどっち(中、外)のstrict modeなのか?<ul
style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 2em; padding: 0px;"><li
style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; padding: 0px;">中のstrict modeが適応されるので、関数内がstrict modeなら、関数名にevalとかしてる時もエラーにするようにする(disccuss)</li><li
style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; padding: 0px;">body,param,functionName 全部strict modeに適応範囲とする</li></ul></li><li
style="margin-top: 0.5em; margin-right: 0px; margin-bottom: 0.5em; margin-left: 0px; padding: 0px;"><a
style="color: #4183c4; text-decoration: none; padding: 0px; margin: 0px;" title="Does 'use strict' in a FunctionBody apply strict mode FutureReservedWord restrictions to function name or arguments?" href="https://mail.mozilla.org/pipermail/es5-discuss/2011-January/003904.html">Does ‘use strict’ in a FunctionBody apply strict mode FutureReservedWord restrictions to function name or arguments?</a></li></ul></li></ul><h1 style="padding-top: 0.25em; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: initial; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 23px; border-top-style: none; border-top-color: initial; margin: 0px;"></h1><p>メモ: Mou + github.css</p>]]></content:encoded> <wfw:commentRss>http://efcl.info/2012/0407/res3047/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>カヤック社内勉強会でBusterJSについて発表してきた</title><link>http://efcl.info/2012/0324/res3020/</link> <comments>http://efcl.info/2012/0324/res3020/#comments</comments> <pubDate>Sat, 24 Mar 2012 08:14:05 +0000</pubDate> <dc:creator>azu</dc:creator> <category><![CDATA[javascript]]></category> <category><![CDATA[library]]></category> <category><![CDATA[test]]></category> <category><![CDATA[イベント]]></category><guid
isPermaLink="false">http://efcl.info/?p=3020</guid> <description><![CDATA[完全にノープランでしたが、唐突にカヤックの社内勉強会に参加してきて、今色々触っているJavaScriptのテストフレームワークのBuster.JSについて発表してきました。(部外者です&#8230;) JavaScrip [...]]]></description> <content:encoded><![CDATA[<p>完全にノープランでしたが、唐突にカヤックの社内勉強会に参加してきて、今色々触っているJavaScriptのテストフレームワークの<a
href="http://busterjs.org/">Buster.JS</a>について発表してきました。(部外者です&#8230;)</p><div
class="kwout" style="text-align: center;"><a
href="http://azu.github.com/slide/Kamakura/busterJS.html#slide1"><img
style="border: none;" title="JavaScript Testing FrameworkのBusterJSを使う" src="http://kwout.com/cutout/9/vs/8q/s2u_bor_rou.jpg" alt="http://azu.github.com/slide/Kamakura/busterJS.html#slide1" width="600" height="429" /></a><p
style="margin-top: 10px; text-align: center;"><a
href="http://azu.github.com/slide/Kamakura/busterJS.html#slide1">JavaScript Testing FrameworkのBusterJSを使う</a> via <a
href="http://kwout.com/quote/9vs8qs2u">kwout</a></p></div><p>スライド : <a
href="http://azu.github.com/slide/Kamakura/busterJS.html#slide1">JavaScript Testing FrameworkのBusterJSを使う</a></p><p>今JavaScriptのテストフレームワークは色々ありますが、<a
href="http://busterjs.org/">Buster.JS</a>は<a
href="http://code.google.com/p/js-test-driver/">JsTestDriver</a>と似た仕組みを持ったテストフレームワークです。<br
/>Nodeで書かれてる所が大きく違いますが、細かい仕組み等は<a
href="http://busterjs.org/docs/architecture/">Buster.JS Architecture overview</a>という文章が公開されているのでそこを見るのがいいです。</p><p>中心となってる作者の一人は<span
class="autopagerize_page_element"><a
href="http://sinonjs.org/" target="_blank">Sinon.JS</a>、<a
href="http://tddjs.com/" target="_blank">Test-Driven JavaScript Development</a>で有名なChristian Johansenですが、<br
/><a
href="http://www.amazon.co.jp/dp/4048707868/">テスト駆動JavaScript</a>で書かれてるようなノウハウが詰まった感じのテストフレームワークになっているので、触っていてとても楽しいツールになっている気がします。<br
/>また<a
href="http://code.google.com/p/js-test-driver/">JsTestDriver</a>はブラウザ向けという感じが強いですが、<a
href="http://busterjs.org/">Buster.JS</a>はNodeで書かれているのもあって、Nodeでテストを実行するという方法も行えるのでNodeのテストもできるようになっていると思います。 </span></p><p><span
class="autopagerize_page_element">まだ、<a
href="http://busterjs.org/changelog/beta2/">Beta 2</a>なので実装されてない部分やWindows未対応(Windowsで試すなら<a
href="https://github.com/mroderick/try-busterjs">try-busterjs</a>とか)などの点もありますが、<br
/>それ以上に勢いを感じられるので今後のテストフレームワークの選択肢の一つになってくれるんじゃないかなーと思います。</span></p><p><span
class="autopagerize_page_element">WebStormでも使いやすくするために、<a
href="http://azu.github.com/slide/Kamakura/busterJS.html#slide26">WebStorm Integrate</a>についてもスライドに少し書いてあります。</span></p><p> </p>]]></content:encoded> <wfw:commentRss>http://efcl.info/2012/0324/res3020/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>横浜JSTDDハンズオンでWebStormについて発表してきた</title><link>http://efcl.info/2012/0226/res3015/</link> <comments>http://efcl.info/2012/0226/res3015/#comments</comments> <pubDate>Sun, 26 Feb 2012 13:29:58 +0000</pubDate> <dc:creator>azu</dc:creator> <category><![CDATA[javascript]]></category> <category><![CDATA[イベント]]></category> <category><![CDATA[TDD]]></category> <category><![CDATA[WebStorm]]></category> <category><![CDATA[アウトライン]]></category><guid
isPermaLink="false">http://efcl.info/?p=3015</guid> <description><![CDATA[横浜JSTDDハンズオンに参加してきて、WebStormというIDEはどういうものなのかについて発表してきました。 WebStorm指南書 発表してきた資料置いておきます。 後から資料として見やすいように画像をたくさん入 [...]]]></description> <content:encoded><![CDATA[<p><a
href="http://atnd.org/events/25519">横浜JSTDDハンズオン</a>に参加してきて、WebStormというIDEはどういうものなのかについて発表してきました。</p><div
class="kwout" style="text-align: center;"><a
href="http://azu.github.com/slide/webstorm/webstorm.html#slide1"><img
style="border: none;" title="WebStorm指南書" src="http://kwout.com/cutout/b/v4/vx/5az_bor_rou.jpg" alt="http://azu.github.com/slide/webstorm/webstorm.html#slide1" width="600" height="515" /></a><p
style="margin-top: 10px; text-align: center;"><a
href="http://azu.github.com/slide/webstorm/webstorm.html#slide1">WebStorm指南書</a></p></div><p>発表してきた資料置いておきます。</p><p>後から資料として見やすいように画像をたくさん入れながらWebStormの機能紹介について書いたので、WebStormについて知りたい方は読むといいです。<br
/>また、最近出たばかりの<a
href="http://blog.jetbrains.com/webide/2012/02/phpstorm-webstorm-4-0-early-access-program-started/">WebStorm 4.0 Early Access Program</a>についても書いてあるので興味がある人はどうぞ。</p><p> </p><div
class="kwout" style="text-align: center;"><a
href="http://azu.github.com/slide/webstorm/webstorm.html#slide12"><img
style="border: none;" title="WebStorm指南書" src="http://kwout.com/cutout/9/97/aj/bqs_bor_rou.jpg" alt="http://azu.github.com/slide/webstorm/webstorm.html#slide12" width="600" height="439" /></a><p
style="margin-top: 10px; text-align: center;"><a
href="http://azu.github.com/slide/webstorm/webstorm.html#slide12">スライドの見方</a></p></div><p>スライドは上記のように機能の紹介がベースで、それの利用方法やこういう機能があって便利という感じのスライドになってます。</p><div
class="kwout" style="text-align: center;"><a
href="http://azu.github.com/slide/webstorm/webstorm.html#slide39"><img
style="border: none;" title="WebStorm指南書" src="http://kwout.com/cutout/f/7n/bp/mv7_bor_rou.jpg" alt="http://azu.github.com/slide/webstorm/webstorm.html#slide39" width="600" height="394" /></a><p
style="margin-top: 10px; text-align: center;"><a
href="http://azu.github.com/slide/webstorm/webstorm.html#slide39">WebStormの楽しさ</a></p></div><p>Web開発等JavaScript周りの環境も変化してきているので、それにあわせてエディタやIDEももっと変化するといいなーと思う部分にいろいろ挑戦してる感じがしてるのがWebStormが好きな所でもあります。<br
/>とりあえず、<a
href="http://www.jetbrains.com/webstorm/index.html">WebStorm</a>は<a
href="http://www.jetbrains.com/webstorm/download/index.html">30-day trial</a>なので、試してみるといいかもしれません。他のエディタ等もいろいろ競争して質が上がっていくといいなー。</p><hr
/><p><a
href="http://atnd.org/events/25519">横浜JSTDDハンズオン</a>の方ではJsTestDriverを使ったハンズオンをしたのでその時のアウトラインメモ。<br
/>Twitterのまとめは <a
href="https://yukar.in/note/ckFoT5">横浜JSTDDハンズオン #JSTDD つぶやきまとめ &#8211; Yukarin&#8217;Note</a> に</p><h1>TDDとは何か</h1><ul><li>プログラマが行うホワイトボックステスト</li><li>開発的なアプローチ(TDD)</li><li>ドキュメント的なアプローチ (サンプルコード</li></ul><h1>TDD</h1><ul><li>開発を行うためにテストを行う</li><li>コードカバレッジは考慮しない</li><li>先に大きなインターフェイスを書いて設計を行う</li></ul><h2>BDD</h2><ul><li>振る舞いを先に定義する</li><li>開発を始めるときは重要だけど、開発を進めるといらない</li></ul><h2>ドキュメントアプローチ</h2><ul><li>ドキュメントの代わりにテストを書く</li><li>キッチンシンクと言われたりするような主要な機能についてテストを書く</li><li>開発当初は微妙だけど、公開するにつれて重要になる。</li></ul><h2>品質的なアプローチ</h2><ul><li>コードカバレッジは管理していく段階で重要になる</li><li>コードカバレッジを重視すると、ドキュメント的な役割がし難く。</li></ul><h2>結合テスト</h2><p>Seleniumとかの話</p><h1>JsTestDriverのアーキテクチャ</h1><h1>JsTestDriverの使い方</h1><h3>setUp</h3><p>各テスト実行前に実行される</p><h3>tearDown</h3><p>各テストが終わる事に実行される</p><h3>AsyncTestCase</h3><p>引数で同期か非同期化を分けられるので、SyncTestCaseにもできる。</p><p>各テストにはqueueという引数がわたってくる 非同期テストはとても面倒</p><h2>sinon.js</h2><p>非同期テストを楽にするFakeテストができる</p><h2>JSTestDriverのエラーになりやすい所</h2><ul><li>serverオプションに/を付けるとエラー</li><li>複数人で同じサーバのJSTestDriverを使える(パブリックはやめとけ)</li><li>ブラウザでアクティブでないタブのsetTimeoutがゆっくりになるので、それぞれウィンドウで実行するのがよい</li></ul><h1>Sinon.js</h1><p>トロイの木馬の手引きをしたスパイの名前が由来</p><hr
/><p><strong>ツール</strong></p><ul><li><strong><a
href="http://www.inkcode.net/qute">Qute for PC/Mac</a></strong></li><li><a
href="http://www.jetbrains.com/webstorm/index.html">WebStorm</a></li></ul><p>書いたコードは <a
href="https://github.com/azu/YokohamaJSTDD">azu/YokohamaJSTDD &#8211; GitHub</a> に置いてあります。</p><p> </p>]]></content:encoded> <wfw:commentRss>http://efcl.info/2012/0226/res3015/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>今まで書いたJavaScript情報の読み方をまとめてみた</title><link>http://efcl.info/2012/0116/res2985/</link> <comments>http://efcl.info/2012/0116/res2985/#comments</comments> <pubDate>Mon, 16 Jan 2012 14:49:50 +0000</pubDate> <dc:creator>azu</dc:creator> <category><![CDATA[javascript]]></category> <category><![CDATA[イベント]]></category><guid
isPermaLink="false">http://efcl.info/?p=2985</guid> <description><![CDATA[もう既に見た人もいるかもしれませんが、オフライン勉強会でJSer.info一周年について発表してきた &#124; JSer.infoで今まで書いてた記事のまとめ的な発表をしてきました。 海外のJavaScript情報を見つけよう [...]]]></description> <content:encoded><![CDATA[<p>もう既に見た人もいるかもしれませんが、<a
href="http://jser.info/post/15883533195">オフライン勉強会でJSer.info一周年について発表してきた | JSer.info</a>で<br
/>今まで書いてた記事のまとめ的な発表をしてきました。</p><ul><li><a
title="海外のJavaScript情報を見つけよう" href="http://efcl.info/2011/0116/res2185/">海外のJavaScript情報を見つけよう</a></li><li><a
title="世界のJavaScript情報を読もう" href="http://efcl.info/2011/0117/res2229/">世界のJavaScript情報を読もう</a></li><li><a
title="今からRSS購読すべきタグと検索結果" href="http://efcl.info/2010/1025/res2018/">今からRSS購読すべきタグと検索結果</a></li><li><a
title="ブラウザの最新情報を知るために、Web開発者が読んでおくべきブログ" href="http://efcl.info/2011/0301/res2303/">ブラウザの最新情報を知るために、Web開発者が読んでおくべきブログ</a></li><li><a
href="http://azu.github.com/slide/HowToLearn/#slide1">HOW TO LEARN</a> (これだけ記事じゃないですが)</li></ul><p><a
href="http://azu.github.com/slide/offline_study/javascript_world.html#slide1">世界のJavaScriptを読もう @ 2012</a>を発表していた時、<a
href="http://azu.github.com/slide/offline_study/javascript_world.html#slide29">RSS購読フロー</a>の部分がなぜか<a
href="http://twitter.com/tatsuoSakurai/statuses/158419082654400512">受け</a>が<a
href="http://twitter.com/koichik/statuses/158542707378233344">良かった</a>ようなので、簡単な補足を書いておきます。</p><p><img
title="social_flow.png" src="http://efcl.info/wp-content/uploads/2012/01/social_flow.png" border="0" alt="Social flow" width="600" height="528" /></p><p>自分はRSSリーダを多用しているので、何でもRSSにしてとりあえずRSSリーダーに流れてくるような状況を作っています。<br
/>Webサイトを見ていて、Read It Latorなどで後で読むことにしても結局読むのを忘れてしまうことがあるため、Read It Latorに登録したリストがRSSとしてRSSリーダーに流れてくるといった感じです。</p><p>Pinboardやはてなブックマークや<a
href="http://azu.github.com/slide/offline_study/javascript_world.html#slide22">ソーシャルニュース</a>サイト等もRSSで購読していると、同じ記事を扱ったものが何度もRSSに出てきます。<br
/>これは<a
href="http://efcl.info/2010/1025/res2018/">今からRSS購読すべきタグと検索結果</a>でLDRの読み方にでも書いていましたが、SBMなどは量が多くなってしまうので、全て目を通そうとすると気疲れします。<br
/>そのため、SBMや検索結果等のRSSは高めのレートにして心理的に飛ばしやすい(LDRでいうSキーを押す)状態にしています。</p><blockquote><p>なんで検索結果のRSSは★4にしてるかというと、検索結果RSSで出てくるサイトは★3のサイトと被ったりすることがあるので、<br
/>★4で飛ばしても★3で出てくるからまあいいっかと適当な感じで読める安心感が生まれます。</p> <a
title="今からRSS購読すべきタグと検索結果 | Web scratch" href="http://efcl.info/2010/1025/res2018/">今からRSS購読すべきタグと検索結果 | Web scratch</a></blockquote><p>ここから、発表してたときにウケてた部分ですが、RSSリーダで読んでいるときに少しでも気になった記事は<br
/>とりあえずTwitterへ投稿しています。(<a
href="http://userscripts.org/scripts/show/46441">Post Now browsing to Twitter</a>がLDRから直接投稿できるようにしているのもその辺の関係)<br
/>一応軽くは目を通してからTwitterへ投稿していますが、専門的な記事や英語の記事など一度みるだけじゃ理解が出来なかったり、判断が難しい記事も多いと思います。</p><p>そういう時にTwitterのフォロワーから反応があると理解しやすかったりします。<br
/>またFavやRTがあったものが流れてくるようにRSSを購読しておけば、重要な記事 (少なくてもフォロワーが興味を持った記事)が再度RSSとして流れてくるようになります。</p><div><blockquote
class="twitter-tweet" lang="ja"><p>ありのまま今起こった事を話すぜ！『おれは奴が情報を選別してくれてると思ったらいつのまにか選別させられていた』 何を(ry という素晴らしいフィードバックを見た</p> — koichikさん (@koichik) <a
href="https://twitter.com/koichik/status/158542707378233344">1月 15, 2012</a></blockquote><script src="//platform.twitter.com/widgets.js"></script></div><p>こういう感じで、重要な記事は何度もRSSとして流れるようにして、読み忘れを減らしたり &amp; 心理的に軽い気持ちでフィードを読み飛ばしても大丈夫なように意識しています。<br
/>他の人の力も借りて手を抜きつつ、人があまり見ないようなところもチェックするようにして、いろいろな情報を共有できればいいかなと思います。</p><p>どういう所などをみているかについては<a
href="http://jser.info/post/15883533195">オフライン勉強会でJSer.info一周年について発表してきた | JSer.info</a>のスライドの方にもまとめたのでそちらを見てください。</p><ul><li><a
href="http://jser.info/post/15883533195">オフライン勉強会でJSer.info一周年について発表してきた | JSer.info</a></li></ul><p> </p><ul></ul>]]></content:encoded> <wfw:commentRss>http://efcl.info/2012/0116/res2985/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>第七回ありえるえりあ勉強会 アウトラインメモ</title><link>http://efcl.info/2011/1013/res2971/</link> <comments>http://efcl.info/2011/1013/res2971/#comments</comments> <pubDate>Thu, 13 Oct 2011 14:55:07 +0000</pubDate> <dc:creator>azu</dc:creator> <category><![CDATA[javascript]]></category> <category><![CDATA[イベント]]></category><guid
isPermaLink="false">http://efcl.info/?p=2971</guid> <description><![CDATA[第七回ありえるえりあ勉強会 〜JSで大規模・エンタープライズ開発〜に参加してきたので、その時のメモ。 「JavaScriptで大規模ゲーム開発」渋川 ソーシャルゲームの定義 ユーザー間で非同期のやり取りが発生する ngC [...]]]></description> <content:encoded><![CDATA[<p><a
href="http://partake.in/events/2de2385a-fe4a-42ea-98a4-a321c9249bcf">第七回ありえるえりあ勉強会 〜JSで大規模・エンタープライズ開発〜</a>に参加してきたので、その時のメモ。</p><h3>「JavaScriptで大規模ゲーム開発」渋川</h3><h5>ソーシャルゲームの定義</h5><ul><li>ユーザー間で非同期のやり取りが発生する</li></ul><h4>ngCore</h4><ul><li>マルチプラットフォーム<ul><li>同一ソースでAndroidとiOSに対応</li><li>テスト環境はFlashにも対応</li></ul></li></ul><h5>ゲームの構成</h5><ul><li>ngCore上にゲームロジック/JavaScript</li><li>サーバ/APach+FCGI上に認証とか結果の書き込みをMobageサーバに</li></ul><h5>役割分担</h5><ul><li>ngCoreのクライアント<ul><li>アクションシーン</li><li>サーバ側で作ったデータの再生</li></ul></li><li>ゲームサーバ<ul><li>パラメーター保持、変化</li><li>アイテム管理</li><li>ミッションのスロットの目の決定など</li><li>ずる防止をするためサーバ側でロジックがある</li></ul></li></ul><h5>ngCoreの開発サイクル</h5><ul><li>node.jsで書かれたビルドサーバでビルドを行う。<ul><li>ファイルの結合とか</li></ul></li></ul><h5>コード</h5><ul><li>CJSライクなモジュール</li><li>クラスを作るsubclass関数</li><li>ゲームはmain関数から始まる</li><li>Core.UpdateEmitter でゲームループを回す</li></ul><h5>ゲームの基本構成</h5><ul><li>シンプルなクラス群<ul><li>Sceneクラスを継承してシームを作っていく</li><li>Sceneを遷移してゲームの遷移が行われる</li></ul></li><li>サーバ側からjsonのジョブスタックを受け取る<ul><li>ミッション結果なども配列で返ってくる</li><li>知らないジョブが来たら無視が基本方針</li><li>クライアントは順番に再生していくだけ</li><li>新しいミッションも簡単に追加できる</li></ul></li><li>サーバエラーがおきたらホーム画面に強制的に戻る</li></ul><h5>DnLig/ngGo</h5><ul><li>DnLib<ul><li>ゲーム開発の共通ライブラリ</li></ul></li><li>ngGo</li></ul><h5>開発拠点</h5><ul><li>サンフランシスコ</li><li>日本</li><li><p>パキスタン</p></li><li><p>SKypeチャットが主なインフラ</p></li><li>git<ul><li>git flow</li></ul></li><li>ドキュメントSphinx</li></ul><h5>ngGo/ngBuilder</h5><ul><li>– データ駆動で行えるように</li><li>- パラメーターチューニングのしやすさ</li></ul><h5>デバッグとテスト</h5><ul><li>デバッグメニュー<ul><li>サーバにデバッグ用画面がある</li></ul></li><li>Jasmineを使ってる</li></ul><h5>今後のngCore</h5><ul><li>3D対応、HTML5対応</li></ul><h4>まとめ</h4><p>JavaScriptベースで</p><h3>オフラインWebアプリケーションの作り方 (白石)</h3><p>Google Gearsを使ってオフラインアプリケーションを作ったことがある。</p><h4>オフラインWebアプリケーション</h4><h5>Google Gears</h5><ul><li>Google Gears終了 –&gt; HTML5へ以降を推奨<ul><li>HTML5を中心にするようになった</li></ul></li></ul><h4>オフラインでも読めるアプリの作り方</h4><ul><li>それほど実装は難しくない</li><li>アプリケーションキャッシュを利用すればいい</li></ul><h5>アプリケーションキャッシュとは</h5><ul><li>静的なリソースをキャッシュすることができる機能</li><li>ローカルキャッシュの利点</li><li>IE以外のブラウザでは実装されてる</li></ul><h5>キャッシュマニフェスト</h5><ul><li>リソースのリストを作成する</li><li>Titanium Mobileのリファレンスはローカルキャッシュされてる</li></ul><h5>アプリケーションキャッシュのJavaScript API</h5><ul><li>window.applicationCacheにJavaScriptから操作できるアプリケーションキャッシュAPIがある。</li></ul><h5>アプリケーションキャッシュを利用する上での注意点</h5><ul><li>キャッシュマニフェストを更新しないとリロードで反映しない</li><li>キャッシュ容量が限られている<ul><li>モバイルとかだと10MBぐらい</li></ul></li></ul><h4>オフラインでも書けるアプリの作り方</h4><ul><li>割りと面倒なもの</li><li>デスクトップアプリとやりたい事はあんまり変わらない</li></ul><h5>オフラインWebアプリを作るポイント</h5><ul><li>基本はリッチクライアント+同期機能</li></ul><h5>利用できるローカルストレージ</h5><ul><li>Web Storage</li><li>Web SQL Database</li><li>Indexed Database API</li><li>File API<ul><li>ドメインごとに仮想的な空間</li><li>セキュリティ的なものがあるため</li></ul></li></ul><h5>双方向同期</h5><p>かなり難しく面倒くさい – フェールセーフ – 更新の衝突 – 同期のタイミング – ネットワーク状態、データの状態管理 – ローカルDBのスキーマ管理/サーバのスキーマと2つできてしまう – ローカルDBのクオータ(5MBぐらい)</p><pre><code>- 容量の限界がきたときにどうするか
</code></pre><h4>まとめ</h4><ul><li>オフラインアプリケーションといっても読む/書くの2つがある</li><li>書く/同期的なアプリケーションはかなり面倒臭い<ul><li>割り切ったほうがいい</li></ul></li></ul><h3>スケールするUIについて – @monjudoh</h3><p>Objective-Cで非同期処理のチェーンライブラリとか</p><h5>要素数</h5><p>ループの中でbind/unbindしてたので大量に追加されたときに重たかったのでliveメソッドに変更 bindはここの要素に付けるから、要素が多いと死ぬ。delegateとかliveはその枠の方にイベント一個張るだけだから軽くてすむ。</p><h5>D&amp;D</h5><ul><li>ユーザが触れる範囲だけにイベントを付ける</li><li>D&amp;Dは複数のイベントから成り立つので複雑(down-&gt;move-up)</li></ul><h5>要素の生成</h5><ul><li>UITableView<ul><li>表示範囲+ぐらいのみを描画してる</li><li>再利用してる</li></ul></li></ul><h3>JavaScriptのテスト事情 –  @os0x</h3><ul><li>JavaScriptのテスト<ul><li>まだまだ未成熟</li></ul></li><li>二種類<ul><li>JavaScriptのテスト<ul><li>JavaScriptだけなので比較的わかりやすい</li></ul></li><li>JavaScriptを含めたテスト<ul><li>UIとかも含むインテグレーションテスト</li></ul></li></ul></li></ul><h5>インテグレーションテスト</h5><ul><li>インテグレーションテストは書くのが大変</li><li>動いてあることが保証できるので重要<ul><li>後から追加修正とかも</li></ul></li></ul><h5>インテグレーションテストの定番 – Selenium</h5><ul><li>インテグレーションテストは遅い</li></ul><h5>テスト実行環境</h5><ul><li>カピバラさん + Webkit</li></ul><h5>QUnit,Jasmine</h5><ul><li>Jasmineの方がアプリケーションテストは向いてる</li></ul><h5>jasmine-headless-webkit</h5><ul><li>jasmine のspecをCUI環境で実行できる</li></ul><h3>Titanium Mobile – Masui Yuichiro</h3><ul><li>ココログ</li><li>liblis</li><li>AKB</li><li>サイボウズLiveの</li><li>MobSnap</li></ul><h4>Titanium Mobile</h4><ul><li>JavaScriptだけでアプリを作成できる</li><li>Titanium Mobile のモジュール売買できる<ul><li> mobile market place</li></ul></li></ul><h4>モバイルのUX</h4><ul><li>それぞれのプラットフォームに合わせた形に変換する</li><li>それぞれに合わせたUIはUXに</li><li>タブバーの位置がAndroid/iPhoneで逆になったり</li></ul><h4>飯食う</h4><ul><li>追加モジュールとサポートのみが有料</li><li>認定トレーニング</li></ul><ul></ul><p>感想</p><ul><li>ちょっと落ち着きがなかった気がするの</li><li>あまり掘り下げた感じにはならなかったのは少しもったいない気がした。</li></ul><p>メモ環境</p><ul><li><a
href="http://mouapp.com/">Mou</a></li></ul><p> </p><ul
style="margin-top: 0px; margin-right: 0px; margin-bottom: 18px; margin-left: 25px; font-weight: normal; font-style: normal; font-size: 13px; line-height: 1; font-family: inherit; list-style-type: disc; list-style-position: initial; list-style-image: initial; padding: 0px; border: 0px initial initial;"></ul>]]></content:encoded> <wfw:commentRss>http://efcl.info/2011/1013/res2971/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Mozilla 勉強会＠東京 6thのアウトラインメモ</title><link>http://efcl.info/2011/1003/res2967/</link> <comments>http://efcl.info/2011/1003/res2967/#comments</comments> <pubDate>Mon, 03 Oct 2011 14:01:06 +0000</pubDate> <dc:creator>azu</dc:creator> <category><![CDATA[Firefox]]></category> <category><![CDATA[javascript]]></category> <category><![CDATA[イベント]]></category> <category><![CDATA[アウトライン]]></category><guid
isPermaLink="false">http://efcl.info/?p=2967</guid> <description><![CDATA[2011年10月1日に行われたMozilla 勉強会＠東京 6thのメモ イベントのページ: Mozilla 勉強会＠東京 6thTwitterのまとめ: Mozilla 勉強会＠東京 6th &#8211; Toget [...]]]></description> <content:encoded><![CDATA[<p>2011年10月1日に行われた<a
href="https://dev.mozilla.jp/events/workshop11/">Mozilla 勉強会＠東京 6th</a>のメモ</p><p>イベントのページ: <a
href="https://dev.mozilla.jp/events/workshop11/">Mozilla 勉強会＠東京 6th</a><br
/>Twitterのまとめ: <a
href="http://togetter.com/li/195486">Mozilla 勉強会＠東京 6th &#8211; Togetter</a></p><ul
style="font-family: Arial;"><li>14:30 – 15:00: 開場、発表者準備</li></ul><ul
style="font-family: Arial;"><li>15:00 – 15:10: Opening</li></ul><p>自己紹介の流れ。</p><div
style="font-family: Arial;">■15:10 – 15:50: Firefox for Developers – 開発者ツール＆セキュリティ編</div><div
style="font-family: Arial;">発表資料: <a
rel="nofollow" href="http://www.slideshare.net/dynamis/firefox-developer-tools">開発者ツールの紹介</a></div><div
style="font-family: Arial;">Firefox開発者ツール &#8211; Web Console</div><ul
style="font-family: Arial;"><li>コマンドの補完</li></ul><p>Inspector</p><div
style="font-family: Arial;"><ul><li>DOM Inspectorみたいなもの</li><li>要素を調査するツール</li><li>Style Inspector(開発中)</li></ul> CSS Doctor</div><div
style="font-family: Arial;"><ul><li>CSSの間違いとか</li></ul> ScrachPad</div><div
style="font-family: Arial;"><ul><li>エディタ</li><li>選択行のコードだけを実行できたりする。</li></ul><div>GCLI</div><ul><li>ubiquityみたいな感じの</li><li>CUIとGUI</li></ul> Source Map</div><div
style="font-family: Arial;"><ul><li>CoffeeScriptのような変換コードと元コードをマッピングしたたものを作る</li><li>変換前の言語</li></ul> Tilt</div><div
style="font-family: Arial;"><ul><li>DOMマップを3D化するアドオン</li></ul> <strong>about:Firefox</strong></div><div
style="font-family: Arial;">セキュリティとプライバシーの話</div><div
style="font-family: Arial;">発表資料: <a
rel="nofollow" href="http://www.slideshare.net/dynamis/firefox-security-features">セキュリティ機能の紹介</a></div><div
style="font-family: Arial;">Same Origin Policy</div><div
style="font-family: Arial;">Content Security Policy</div><ul
style="font-family: Arial;"><li>次世代のセキュリティポリシー<ul><li>XSSの攻撃防止</li></ul></li><li>コンテンツ種別で読み込み制御<ul><li>画像やCSSやJSなども制御できるようにする</li></ul></li><li>Webkitではほぼ開発されてる</li></ul><ul
style="font-family: Arial;"><li>デフォルトセキュリティポリシーがいろいろ強化される</li><li>CSPの使い方<ul><li>X-Content-Security-PolicyのHTTPレスポンスヘッダを送信</li><li>HTMLのメタタグは書き換えできたりするものだからヘッダーで</li><li>Apache でCSPの設定</li></ul></li><li>CSP対応に移行する<ul><li>JS,CSSは外部ファイルに</li><li>evalを使わない</li><li>ポリシー違反レポートでどこがおかしいのかも確認できる<ul><li>ヘッダーでレポートを報告するURLを指定してログを残せる</li></ul></li><li>CSPブックマークレットもある</li></ul></li></ul><p>HTTP Strict Transport Security</p><div
style="font-family: Arial;"><ul><li>HTTPSでの接続を要求するヘッダ</li></ul> X-Frame-Options</div><div
style="font-family: Arial;"><ul><li>クリックジャッキングとか</li></ul> Cross-Origin Resource Sharing</div><div
style="font-family: Arial;"><ul><li>クロスドメインでの読み込み許可</li><li>他のドメインから読み込まれてもいい場合の設定</li><li>XHR2とか</li></ul> ユーザ追跡拒否ヘッダ</div><ul
style="font-family: Arial;"><li>Do-Not-Trackヘッダ<ul><li>ブラウザ側でサイトに通知する</li><li>IE,Safariも対応</li><li>Chromeだけ非対応</li></ul></li><li>受け取ったらユーザー追跡をしない</li></ul><div
style="font-family: Arial;"><div>■15:50 – 16:30: Pano って拡張機能 teramako</div><div>発表資料: <a
rel="nofollow" href="http://teramako.github.com/doc/modest-20111001/">Pano って拡張機能</a></div><div>Panorama</div><ul><li>Firefox4から導入された</li><li>タブグループを管理するビュー<ul><li>アクティブなタブグループの切り替え</li></ul></li></ul> タブの種類</div><div
style="font-family: Arial;"><ul><li>ピン止めタブ(AppTab)</li><li>グループの属するタブ</li><li>グループに属さないタブ(Firefox7で廃止)</li></ul> Pano できること</div><div
style="font-family: Arial;"><ul><li>グループの作成/削除</li><li>グループ名の変更</li><li>D&amp;D操作</li></ul> 実装の仕組み</div><div
style="font-family: Arial;"><ul><li>panoramade上で起こったイベントを拾ってビューを作ってる<ul><li>tabopenなど</li><li>起こらないイベントは上書きして起こす</li></ul></li><li>基本的にはビュー</li></ul> 頑張った所</div><div
style="font-family: Arial;"><ul><li>アイコンはSVG<ul><li>いろいろな場所で使われてる</li><li>使いまわしたい -&gt; SVGで作る</li></ul></li><li>SVG<ul><li>ベクターなので拡大縮小できる</li><li>ファイルサイズも小さい</li></ul></li><li>about:addonsでアイコンが表示されてない<ul><li>アイコンのサイズが指定されてなかった</li><li>SVG内にサイズの指定した</li></ul></li><li>タブ、Panoramaから発生するDOM Eventを拾う<ul><li>Panoramaから発生しないEvent<ul><li>グループが作成された</li><li>グループから削除された</li><li>グループから移動した</li></ul></li><li>取れないEventは無理やり発行させる<ul><li>Gropuが作成されたときに起きるイベントを上書きする</li></ul></li></ul></li><li>GroupItems.registerの上書き<ul><li>元関数を実行</li><li>DOM Eventを発行</li><li>コールバックシステムに関数を登録してDOM Eventを発行させる</li></ul></li></ul> 起動速度の改良</div><div
style="font-family: Arial;"><ul><li> 起動時のスクリプトは最小限<br
/><ul><li>必要なときにロードさせる</li><li>mozUSSubScriptLoaderの使用</li></ul></li><li>必要なときに取得<ul><li>getterの使用</li></ul></li><li>速い読み込み<ul><li>Firefox8 から mozUSSubScriptLoader もキャッシュされる</li></ul></li></ul> 実装方法<br
/><ul><li>最初の読み込みは必要最小限<ul><li>40行ほど</li><li>最初はロードするものを書いておいて、ロードしたときにそれを上書きする</li></ul></li><li>getterの使用<ul><li>XPCOMUtil.jsmを使用してgetterを使いやすくする</li><li>defineLazyGetter</li></ul></li></ul> コンテンツの遅延読み込み</div><div
style="font-family: Arial;"><ul><li>bartab<ul><li>起動したときはタブはできるが、ロードはされない</li><li>タブが選択されたときに初めてロードされる</li></ul></li><li>nsISessionStoreが鍵<ul><li>短いコードで実現する</li></ul></li></ul> 非アクティブなグループ内に開くには</div><div
style="font-family: Arial;"><ul><li>Panoramaとバッテングして上手く行かなった</li><li>上手い解決方法が見つからない<ul><li>setTimeoutでぐるぐるー</li></ul></li></ul> パネルでD&amp;Dするために</div><div
style="font-family: Arial;"><ul><li>パネルをドラッグする前に閉じないようにする<ul><li>noAutohide = true</li></ul></li><li>メニューボタンを押したときは閉じない様にする</li></ul><div>■16:40 – 17:20: restartless – 再起動不要なアドオンをSDK無しで作るフレームワーク &#8211; Piro</div><div>発表資料: <a
rel="nofollow" href="http://piro.sakura.ne.jp/xul/doc/20111001workshop11/">restartless – 再起動不要なアドオンをSDK無しで作るフレームワーク</a></div><div>Add-on SDKの目的</div><ul><li>誰でも開発できるようにする</li><li>高機能なアドオンの開発は目的ではなかった</li><li>今までのアドオン開発<ul><li>自由すぎた</li><li>敷居高い</li><li>何でもできた</li></ul></li><li>SDKを使えばある程度制限された状態で簡単作れるようになる</li></ul> Add-on SDKはGreasemonkeyスクリプトと同じような立ち位置</div><div
style="font-family: Arial;">restartlessの目的</div><div
style="font-family: Arial;"><ul><li>再起動不要なアドオンを今までの開発と同じ方式で作れるように</li><li>Mozilla特有の事情を必要なのも従来方式</li><li>対象も従来の開発者向け</li></ul><div>restartlessの使い方</div><ul><li>main.jsの内容<ul><li>startup()で読み込まれる</li><li>専用の名前空間で実行される</li><li>shutdown()を定義</li></ul></li><li>ユーティリティ<ul><li>location.href</li><li>load関数 = Cu.importと互換</li><li>require関数</li><li>existsでファイルの有無を調べる</li><li>resolve 相対パスの解決</li><li>EXPORTED_SYMBOLS</li><li>doAndWait<ul><li>非同期処理を同期的に扱うときに使用</li></ul></li><li>jstimer</li><li>pref</li><li>locale<ul><li>国際化</li></ul></li><li>config</li><li>WindowManager<ul><li>DOMWindowにアクセスする</li><li>ウィンドウのopenを監視</li></ul></li><li>KeyboardShortcut<ul><li>ショートカットの定義</li></ul></li><li>jsDefferred</li></ul></li></ul> restartlessの利用例</div><ul
style="font-family: Arial;"><li>ALT</li><li>back to owner tab</li><li>Fox Splitter</li></ul><p>restartlessのコードリーディング</p><div
style="font-family: Arial;"><ul><li>index.rdf<ul><li>bootstrap=&#8221;true&#8221;で再起動不要と認識される</li></ul></li><li>bootstrap.js<ul><li>モジュールのロードとか</li></ul></li><li>loader.js<ul><li>ユーティリティとかが定義されている</li><li>doAndWait<ul><li>スレッドをたててメインループを回す実装</li></ul></li></ul></li><li>main.js<ul><li>各アドオンのコード</li></ul></li><li>module<ul><li>各ライブラリが入ってるので、削除すれば消える</li></ul></li></ul><div>■17:20 – 18:00: Lightning Talk</div></div><ul
style="font-family: Arial;"><li><a
rel="nofollow" href="http://www.slideshare.net/knagato/mozilla-workshop-20111001-lt-addon-sdk">アドオン SDK を利用した初めてのアドオン開発</a>– by knagato<br
/><ul><li>初めてアドオン開発する人が対象</li><li>SDKを使ったアドオン開発を特徴<ul><li>HTMLやJavaScriptなどが中心で、XULやXPCOMなどMozilla特有の機能を使わなくても開発できる</li></ul></li><li>開発環境の種類<ul><li>Add-on BuilderをWeb上での開発<ul><li>再起動不要なのでその場で試せる</li></ul></li><li>Addon SDKを使った開発<ul><li>コマンドラインベース</li></ul></li></ul></li><li>Add-on SDKのチュートリアル</li></ul></li><li><a
rel="nofollow" href="http://www.p2pwf.com/">Thunderbirdアドオンによるワークフロー開発について</a>– by Nakashima<br
/><ul><li>提案するツール<ul><li>自分自身でのプロセス改善が可能</li><li>やり取りの簡略化ができる</li></ul></li><li><a
href="http://www.p2pwf.com/">http://www.p2pwf.com/</a> に仕様の詳細</li></ul></li><li><a
rel="nofollow" href="http://www.slideshare.net/saneyuki/forking-secure-login">Forking Secure Login</a> – by saneyuki_s<br
/><ul><li>Secure Loginアドオンのフォークの話<ul><li>現在はメンテナンスアップデートのみになってる</li><li>全面改装してる</li></ul></li><li>一部機能の省略</li><li>レガシーコードの除去</li><li>doorhanger対応<ul><li>Firefoxに入ってるSSLのポップアップするやつ</li></ul></li></ul></li><li><a
rel="nofollow" href="http://0-9.sakura.ne.jp/pub/lt/modest/start.html">jQueryで破棄されたrequestAnimationFrameとJSでのアニメーション実装で注意すること</a> – by <a
rel="nofollow" href="https://twitter.com/#%21/kyo_ago">kyo_ago</a><br
/><ul><li>requestAnimationFrame<ul><li>setIntervalの問題点としてアニメーション向けではない</li></ul></li><li>jQuery 1.6から削除された<ul><li>setIntervalとrequestAnimationFrameが衝突してキューがたまる</li><li>タブがバックグランドにあるときの挙動</li></ul></li></ul></li><li><a
rel="nofollow" href="http://d.hatena.ne.jp/mooz/20111002/p1">ES.next WeakMap</a>– by mooz (<a
rel="nofollow" href="https://twitter.com/#%21/stillpedant">@stillpedant</a>)<br
/><ul><li>WeakMap = 連想配列</li><li>Firefox6から利用可能</li><li>{}やObject()と比較して<ul><li>keyにオブジェクトが指定可能<ul><li>ハッシュはkeyに文字列しか指定できない(toStringされてる)</li><li>WeakMapはkeyにオブジェクトが指定可能<ul><li>オブエジェクトしか指定できない</li><li>プリミティブ値はエラー</li></ul></li><li>オブジェクトの外部拡張<ul><li>DOMノードに独自プロパティは危険</li><li>ES5ではオブジェクトの拡張がfreezeできる</li><li>オブジェクト自体は拡張しないで、外部に付加情報を持つ</li><li>WeakMapを利用する<ul><li>キーとして外部情報をもたせる</li></ul></li></ul></li></ul></li><li>keyに指定されたオブジェクトを弱く参照<ul><li>CGにたいして</li></ul></li></ul></li></ul></li><li>Firefox4以降のE4X– by teramako<ul><li>ワイルドカード<ul><li>*が指定子に使える</li></ul></li><li>属性アクセス<ul><li>@が使える</li></ul></li><li>Firefox3.6までは上記のものがE4X以外でも使えた<ul><li>Firefox4以降は禁止された</li><li>ざんねんでしたね</li></ul></li></ul></li></ul>]]></content:encoded> <wfw:commentRss>http://efcl.info/2011/1003/res2967/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Firebugを使ったページロード解析(Net panelの読み方)</title><link>http://efcl.info/2011/0612/res2855/</link> <comments>http://efcl.info/2011/0612/res2855/#comments</comments> <pubDate>Sun, 12 Jun 2011 10:37:50 +0000</pubDate> <dc:creator>azu</dc:creator> <category><![CDATA[Firefox]]></category> <category><![CDATA[javascript]]></category> <category><![CDATA[Firebug]]></category><guid
isPermaLink="false">http://efcl.info/?p=2855</guid> <description><![CDATA[Software is hard &#124; Page load analysis using Firebug の記事を元に書いています。 January 18th, 2010に書かれた時点での例を使用しているため、現在のブラウ [...]]]></description> <content:encoded><![CDATA[<p><a
href="http://www.softwareishard.com/blog/firebug/page-load-analysis-using-firebug/">Software is hard | Page load analysis using Firebug</a> の記事を元に書いています。 <br
/>January 18th, 2010に書かれた時点での例を使用しているため、現在のブラウザでは若干挙動が違うかもしれません。 <br
/>また、著者の<a
href="http://www.softwareishard.com/blog/about/">Jan Odvarko</a>さんに翻訳許可は頂いていますが、翻訳というより意訳や自分の理解のために書いていたので、いろいろ書き加えたりしています。 <br
/>Net panel(ネットパネル)について理解したいと思って書いたので、Net Panel自体の解説記事<a
href="http://www.softwareishard.com/blog/firebug/introduction-to-firebug-net-panel/">Software is hard | Introduction to Firebug: Net Panel</a>も一緒に読むといいかもしれません。</p><p>翻訳許可のメールをわずか15分で返してくれた著者の<em>Jan Odvarko</em>さんに感謝を。 <br
/>Thnak you, <em>Jan Odvarko.</em></p><span
id="more-2855"></span><hr
/><p>原文: <a
href="http://www.softwareishard.com/blog/firebug/page-load-analysis-using-firebug/">Software is hard | Page load analysis using Firebug</a></p><p>ページ読み込みパフォーマンスはWeb開発者にとって重要なトピックです。 <br
/>各ページロードの例において、FirebugのNet panelから得たデータをどのように解析するかを見ていきます。</p><p>このテストにおける例は<a
href="http://www.mozilla.com/en-US/firefox/all-beta.html">Firefox 3.6</a> + <a
href="http://getfirebug.com/releases/firebug/1.5X/">Firebug 1.5</a> + <a
href="http://www.softwareishard.com/blog/netexport/">NetExport 0.7</a>においてのNet Panelの結果をNetExportにより<a
href="http://groups.google.com/group/firebug-working-group/web/http-tracing---export-format">HAR</a>形式で出力したものをオンラインで表示しています。 <br
/>(<a
href="http://groups.google.com/group/firebug-working-group/web/http-tracing---export-format">HAR</a>形式はChromeのWeb Inspectorからも出力できます。)</p><ul><li><a
href="http://www.janodvarko.cz/har/viewer/">HTTP Archive Viewer 2.0.10</a>(オンラインビューアー)</li></ul><h4>Example 1: Simple Page Load</h4><p><iframe
class="harPreviewFrame" height="220" border="0" src="http://www.janodvarko.cz/har/viewer//loader.php?service=pagelist&amp;expand=true&amp;path=/har/examples/posts/analysis-using-firebug/simple-page-load.har" frameborder="0" width="518"></iframe></p><p>ここでは2つのリクエストが表示されています。 <br
/>1つめのリクエストではページは16msで取得できていて、load event (赤いライン)は58msで発生している事がわかります。ログ上にマウスオーバーさせると詳細な表示がされます。</p><p><a
href="http://efcl.info/wp-content/uploads/2011/06/image11.png"><img
style="background-image: none; border-right-width: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://efcl.info/wp-content/uploads/2011/06/image_thumb11.png" width="300" height="249" /></a></p><ul><li>青の縦線であるDOM Loaded はDOMContentLoaded event</li><li>赤の縦線であるPage Loaded はLoad event</li><li>灰色のReceiving がページの取得にかかった時間</li></ul><p><a
href="http://efcl.info/wp-content/uploads/2011/06/image12.png"><img
style="background-image: none; border-right-width: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://efcl.info/wp-content/uploads/2011/06/image_thumb12.png" width="158" height="77" /></a></p><p>同じように2つ目のリクエストを見てみると、5msでXHRが実行されています。 <br
/>そして合計経過時間は408msであることもわかります。</p><p><a
href="http://efcl.info/wp-content/uploads/2011/06/image13.png"><img
style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://efcl.info/wp-content/uploads/2011/06/image_thumb13.png" width="307" height="250" /></a></p><p>2つ目のリクエスト(XHR)上でもマウスオーバーで詳細な情報が表示されています。 <br
/>こちらでもload event を表していますが、こちらはXHRのリクエストからの相対値が表示されています。XHRが発生(Started)したのは403msなので 403 &#8211; 357 = 58msでload event が発生したことがわかります。(load eventはページの取得を見た方がわかりやすいからこう見る必要はない気がするけど)</p><h4>Example 2: Connection Limit</h4><p>各ブラウザは一つのページをダウンロードするのに同時接続制限あります。もし、同時接続の制限に達したとき、他のリソースは接続してるリソースが解放されるまでブラウザ内部のキューで待機させられます。 <br
/>次の2つのページログを見ると、同時接続制限数の違いで8つの画像をロードするのにどれぐらいの違いがでるかがわかります。</p><div
class="harPreviewBox"><iframe
class="harPreviewFrame" height="220" border="0" src="http://www.janodvarko.cz/har/viewer//loader.php?service=pagelist&amp;expand=true&amp;path=/har/examples/posts/analysis-using-firebug/browser-blocking-time.har" frameborder="0" width="518"></iframe></div><p><strong>#1 Cuzillion (同時接続制限 == 6)</strong></p><ul><li>Firefox 3.6の同時接続制限のデフォルト値は6で、最初の6つの画像をダウンロード開始した時点でドキュメントは利用可能(DOMContentLoaded event が発生する)</li><li>他の2つの画像はコネクションが空くまで待っている(light-brown 色の部分がblocking部分)</li><li>他の2つの画像がダウンロードされたときは緑色のconnectionフェーズ無いのは、最初の6つの画像をダウンロードに使用したconnectionを再利用しているためです。</li></ul><p><strong>#2 Cuzillion (同時接続制限 == 2)</strong></p><p>このテストだと、各画像ごとに2～3秒の時間がかかり、合計経過時間やload eventが発生時間に#1の2倍弱近くかかっていることがわかります。 <br
/>同時接続制限が2なのはIE7以下のものやモバイル向けのブラウザなどがあります。 <br
/>各ブラウザの同時接続数は<a
href="http://www.browserscope.org/?category=network">Home &#8211; Browserscope</a>を見るといいでしょう。 <br
/>Firefoxではabout:configのnetwork.http.max-persistent-connections-per-serverの設定から変更可能です。</p><p><a
href="http://efcl.info/wp-content/uploads/2011/06/image14.png"><img
style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://efcl.info/wp-content/uploads/2011/06/image_thumb14.png" width="514" height="240" /></a></p><p>同じように#2のポップアップされる詳細のログを見てみると、Blocking(light-brown 色)はページを取得(DOM Loaded)した時から4.63s待たされていて、リソースの取得は2.22sかかり、6.85sで完了している事がわかります。</p><h4>Example 3: Pipelining</h4><p>#2と同じページを使い、ブラウザの<a
href="https://developer.mozilla.org/ja/HTTP_Pipelining_FAQ">パイプライン処理</a>がONとなっている場合を見てみる。</p><div
class="harPreviewBox"><iframe
class="harPreviewFrame" height="220" border="0" src="http://www.janodvarko.cz/har/viewer//loader.php?service=pagelist&amp;expand=true&amp;path=/har/examples/posts/analysis-using-firebug/pipelining.har" frameborder="0" width="518"></iframe></div><p>Firefox(3.6)でパイプライン処理が有効(network.http.pipelining == true)になっている場合を比べてみると、実際にはload eventが発生するまでにかかる時間が増えていることがわかります。 <br
/>1から6の画像はそれぞれ異なる接続を利用していますが、7から8の画像は共有接続を利用してダウンロードしています。実際にどれと接続を共有しているかは明らかではありませんが(Firebugからそれを知るAPIはないため)、最後の2つの画像は接続を共有して合計時間を増加させているのは明らかです。</p><h4>Example 4: Persistent Connections</h4><p>このテストはHTTP <em>Connection</em>ヘッダーの効果を現しています。このヘッダーは既存の接続が閉じられているか将来のリクエストのために保持されているのかをサーバーに教えるために使われます。 <br
/>それぞれ<em>Keep-Alive</em> (default in HTTP/1.1) or <em>Close</em>でどのような違いが出るかを見てみましょう。</p><div
class="harPreviewBox"><iframe
class="harPreviewFrame" height="220" border="0" src="http://www.janodvarko.cz/har/viewer//loader.php?service=pagelist&amp;expand=true&amp;path=/har/examples/posts/analysis-using-firebug/persistent-connections.har" frameborder="0" width="518"></iframe></div><p>それぞれのログで、最初のページと3つのリクエストとで合計4つが表示されています。 <br
/><em>Connection</em>ヘッダーは3つ(file1.php, file2.php, file3.php)のリクエスト時に要求されます。</p><p><strong>#1 Test page (Connection: Keep-Alive)</strong></p><ul><li>一つ目のページのログでは、ページダウンロードのための一つの接続しか作られていないことがわかります。緑色のConnectionフェーズが一つだけになっていて接続が再利用されている事がわかります。</li></ul><p><strong>#2 Test page (Connection: close)</strong></p><ul><li>二つ目のログでは、ページダウンロードと<em>file1.php</em>のリクエストで接続が再利用されている事がわかります。しかし、他の接続ではConnection: closeなため、また接続を作り直す必要があります。</li></ul><h4>Example 5: Inline Scripts Block</h4><p>インラインスクリプトがページのダウンロードをブロックすることはよく知られていますが、ネットワークの観点から見るとどのように見えるかを調べてしましょう。</p><div
class="harPreviewBox"><iframe
class="harPreviewFrame" height="220" border="0" src="http://www.janodvarko.cz/har/viewer//loader.php?service=pagelist&amp;expand=true&amp;path=/har/examples/posts/analysis-using-firebug/inline-scripts-block.har" frameborder="0" width="518"></iframe></div><p><strong>#1 Cuzillion</strong></p><p>3番目と4番目のリクエストの間に隙間ができています。これは5秒間のインラインスクリプトの実行によりブロッキング発生しています。 (*ここで言うインラインスクリプトとは&lt;script&gt;/*実行スクリプト*/&lt;/script&gt;という感じで&lt;script&gt;タグ内で実行しているものを言う) <br
/><a
href="http://stevesouders.com/cuzillion/?ex=10100&amp;title=Inline+Scripts+Block">Inline Scripts Block</a>のページにて試すことができます。</p><p><a
href="http://efcl.info/wp-content/uploads/2011/06/image15.png"><img
style="background-image: none; border-right-width: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://efcl.info/wp-content/uploads/2011/06/image_thumb15.png" width="320" height="141" /></a> <br
/>Firefox5に試すとちょっと挙動が異なるけど、インラインスクリプトで隙間ができるのは同じ。 <br
/>どちらかというとChromeがログに近い動きをしていた。 <br
/>Firefox4からインラインスクリプトの実行タイミングが変わったのも関係するかもしれない。 <br
/>詳細は<a
href="http://www.softwareishard.com/blog/firebug/script-execution-analysis-in-firefox-4/">Software is hard | Script Execution Analysis in Firefox 4</a>に。</p><p><strong>#2 Cuzillion</strong></p><p>こちらはインラインスクリプトをページの底(&lt;/body&gt;前かな?)に置いた場合のログです。 <br
/>リクエストの合計時間は減っていますが、load eventは#1と同じくインラインスクリプトにより遅れていることがわかります。 <br
/>こちらは<a
href="http://stevesouders.com/cuzillion/?c0=bi1hfff1_0_f&amp;c1=bi1hfff1_0_f&amp;c2=bb0hfff0_5_f&amp;t=1307854749986">Cuzillion</a>のようなイメージだと思います。</p><p>特にこれをどうとらえるべきかについては元記事に記述はありませんでしたが、この例はリソースのダウンロード時間よりもload eventなどへブロックが発生している事が重要な気がします。 <br
/>負荷が大きいインラインスクリプトやdocument.writeなどのブロッキングを誘発するものがある場合loadやDOMContentLoadedイベントの発生を遅くしてしまいます。そのためdocument.writeそのものを避けることや、load eventなどイベントリスナーにして実行させるなどした方がページの表示は速くなるかと思います。</p><h4>Example 6: Redirects</h4><p>これはネットパネルにて、リダイレクトがどのように見えるかを表示した例。</p><div
class="harPreviewBox"><iframe
class="harPreviewFrame" height="220" border="0" src="http://www.janodvarko.cz/har/viewer//loader.php?service=pagelist&amp;expand=true&amp;path=/har/examples/posts/analysis-using-firebug/redirects.har" frameborder="0" width="518"></iframe><div
class="harPreviewResizer"></div></div><p><strong>#1 Final Page (one redirect)</strong></p><p>サーバーによって301リダイレクトが行われて、URLの末尾に/がついたことがわかります。</p><p><strong>#2 Final Page (infinite redirection)</strong></p><p>無限ループしているリダイレクトの例 <br
/>自分自身にリダイレクトしているのでいつまでもループしてしまいますが、Firefoxではデフォルトで20回で停止しています(<em>network.http.redirection-limit</em> の設定値)</p>]]></content:encoded> <wfw:commentRss>http://efcl.info/2011/0612/res2855/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>JavaScriptでAmazonからASINを取得する方法など</title><link>http://efcl.info/2011/0605/res2817/</link> <comments>http://efcl.info/2011/0605/res2817/#comments</comments> <pubDate>Sun, 05 Jun 2011 01:24:13 +0000</pubDate> <dc:creator>azu</dc:creator> <category><![CDATA[Greasemonkey]]></category> <category><![CDATA[javascript]]></category> <category><![CDATA[Amazon]]></category> <category><![CDATA[ASIN]]></category><guid
isPermaLink="false">http://efcl.info/?p=2817</guid> <description><![CDATA[一つの方法はinput要素から取得する方法 document.getElementById("ASIN").value Amazonはページ中のhiddenなinput要素にASINを持たせてるのでこういう手が取れる。  [...]]]></description> <content:encoded><![CDATA[<h4>一つの方法はinput要素から取得する方法</h4><div
id="codeSnippetWrapper"><pre id="codeSnippet" class="csharpcode">document.getElementById(<span class="str">"ASIN"</span>).value</pre></div><p>Amazonはページ中のhiddenなinput要素にASINを持たせてるのでこういう手が取れる。</p><div
id="codeSnippetWrapper"><pre id="codeSnippet" class="csharpcode">&lt;input id=<span class="str">"ASIN"</span> type=<span class="str">"hidden"</span> value=<span class="str">"4253196519"</span> name=<span class="str">"ASIN"</span>&gt;</pre></div><p>ページの構造が変わったらダメだけど、結構昔からこの部分は変わってないので意外と安定しているかもしれない。 <br
/>amazon.comだと構造が違うものがあって、<a
href="http://www.amazon.com/gp/product/B004LRPGPC/ref=s9_simh_gw_p351_d0_i2?pf_rd_m=ATVPDKIKX0DER&amp;pf_rd_s=center-3&amp;pf_rd_r=1GAMW69P6270WWBTEW98&amp;pf_rd_t=101&amp;pf_rd_p=470938811&amp;pf_rd_i=507846">Amazon.com: Buried Prey eBook: John Sandford: Kindle Store</a>のようにKindle Storeだとページ構造が違ってID=ASINがない代わりに次のようなものがある。</p><div><pre id="codeSnippet" class="csharpcode">&lt;input type=<span class="str">"hidden"</span> value=<span class="str">"B004LRPGPC"</span> name=<span class="str">"ASIN.0"</span>&gt;</pre></div><div>なので、inputを取得する場合は次のような形になる。</div><div
id="codeSnippetWrapper"><pre id="codeSnippet" class="csharpcode"><span class="kwrd">var</span> ASIN = document.getElementById(<span class="str">"ASIN"</span>) || document.getElementsByName(<span class="str">"ASIN.0"</span>)[0];</pre></div><h4>もう一つの方法はwindowオブジェクトのプロパティから取得する方法</h4><p>(2011年6月5日現在だと)</p><div
id="codeSnippetWrapper"><pre id="codeSnippet" class="csharpcode">window.sitbAsin;</pre></div><div>にASINの数値が入っている。(ちょっとできるタイミングが特殊な気がするから扱いにくいかも) <br
/>これはAmazon側のJavaScriptが生やしているので、ページのちょっとした構造の変化では変わらないと思うけど使うライブラリを変えたりJavaScriptが大きく変わると変更されることがある。 <br
/>以前はwindow.productTagsに入っていた。</div><ul><li><a
href="http://subtech.g.hatena.ne.jp/h2u/20090529/1243587848">Amazonの商品個別ページでASINを抜き出す &#8211; おれ ここ めも かきなぐる おまえ ここ よむ なぐる &#8211; subtech</a></li></ul><h4>最後はURLからASIN部分を切り出す方法</h4><p>URLにはASINが入ってるはずなので、ページに構造の変化には強いけど、少しパースが面倒なところがある。 <br
/>どのようなURLがあるかを把握する必要があるので、条件分けなども必要になる。 <br
/>まあASINのフォーマットは\w{10}と決まっているので、ある程度安定するのかもしれない。</p><p>ついでに、replaceStateを使ってリロードなしでAmazonのURLを/dp/ASINだけの短いURLにするGreasemonkey書いた。</p><ul><li><a
href="http://userscripts.org/scripts/show/104173">Amazon URL Cleaner for Greasemonkey</a></li></ul> ]]></content:encoded> <wfw:commentRss>http://efcl.info/2011/0605/res2817/feed/</wfw:commentRss> <slash:comments>1</slash:comments> </item> <item><title>JavaScriptのいろいろなコーディングルールをまとめてみた</title><link>http://efcl.info/2011/0527/res2764/</link> <comments>http://efcl.info/2011/0527/res2764/#comments</comments> <pubDate>Fri, 27 May 2011 13:20:55 +0000</pubDate> <dc:creator>azu</dc:creator> <category><![CDATA[javascript]]></category> <category><![CDATA[まとめ]]></category><guid
isPermaLink="false">http://efcl.info/?p=2764</guid> <description><![CDATA[JavaScriptの書き方はJavaScript自体がある程度自由なためいろいろな書き方ができますが、一貫性を持って書いた方がバグなども発生しにくくなるため、コーディングルールを定めておくのはよいことだと思います(特に [...]]]></description> <content:encoded><![CDATA[<p>JavaScriptの書き方はJavaScript自体がある程度自由なためいろいろな書き方ができますが、一貫性を持って書いた方がバグなども発生しにくくなるため、コーディングルールを定めておくのはよいことだと思います(特に複数人の開発の場合)</p><p>有名な企業やライブラリはコーディングルールも公開している事が多いので適当にまとめてみました</p><h4><a
href="https://developer.mozilla.org/ja/JavaScript_style_guide">JavaScript style guide &#8211; MDC Docs</a></h4><p>Mozilla/Firefox向けのものなので、一部ECMAScriptの範囲を超えたものも含まれています。 <br
/>多くの人が見ていると思うので、見たことない人は一度読んでみるといいです。</p><h4><a
href="http://google-styleguide.googlecode.com/svn/trunk/javascriptguide.xml">Google JavaScript Style Guide</a></h4><p><a
href="http://cou929.nu/data/google_javascript_style_guide/">Google JavaScript Style Guide 和訳 — Google JavaScript Style Guide 和訳</a>(日本語版) <br
/>Googleのコーディングルールですが、ルールを並べるだけではなくなぜ悪いのかについても触れているので、一読をお勧めします。 <br
/><a
href="http://code.google.com/intl/ja/closure/utilities/docs/linter_howto.html">Closure Linter</a>というチェックツールもあるため、採用しやすいかもしれない。</p><h4><a
href="http://docs.jquery.com/JQuery_Core_Style_Guidelines">JQuery Core Style Guidelines &#8211; jQuery JavaScript Library</a></h4><p>jQuery Coreのもの。 <br
/>Typeチェックの仕方についても触れている。</p><h4><a
href="http://dojotoolkit.org/community/styleGuide">Dojo Style Guide &#8211; The Dojo Toolkit</a></h4><p>Dojoのコーディングルール。 <br
/>コード例が豊富で、命名規則やホワイトスペースの扱いなど細かいところまで入ってる。</p><h4><a
href="http://nodeguide.com/style.html">Felix&#8217;s Node.js Style Guide</a></h4><p><a
href="http://popkirby.github.com/contents/nodeguide/style.html">Felix&#8217;s Node.js Style Guide(和訳)</a>(日本語版) <br
/>Node.jsにおけるコーディングルール。(公式なものではない。no official document) <br
/>Node.jsに限らず、クライアントサイドJavaScriptに置いても参考になる部分は多い。</p><h4><a
href="http://javascript.crockford.com/code.html">Code Conventions for the JavaScript Programming Language</a></h4><p>Douglas Crockfordによるもの。 <br
/>コーディングルールというよりは慣習的なもの。 <br
/>同作者による<a
href="http://www.jslint.com/">JSLint</a>も併用しましょう。(<a
href="http://www.jslint.com/">JSLint</a> or <a
href="http://www.jshint.com/">JSHint</a>は他のコーディングルールであっても採用してよいもの)</p><h4><a
href="http://jibbering.com/faq/notes/code-guidelines/">Code Guidelines for Rich Internet Application Development</a></h4><p>コーディングルールではなくてガイドライン的なものです、HTMLやCSS、JavaScriptについてのガイドラインを書かれている。</p><h4><a
href="https://developer.apple.com/library/mac/#documentation/ScriptingAutomation/Conceptual/JSCodingGuide/Introduction/Introduction.html">Introduction to Apple JavaScript Coding Guidelines</a></h4><p><a
href="http://developer.apple.com/jp/documentation/ScriptingAutomation/Conceptual/JSCodingGuide/">JavaScript Coding Guidelines for Mac OS X</a>(日本語版) <br
/>Appleによるコーディングのガイドライン。 <br
/>&#8220;JavaScriptのベストプラクティス&#8221;でコーディングで気をつける事について触れている。</p><h4><a
href="http://www.webkit.org/coding/coding-style.html">The WebKit Open Source Project &#8211; WebKit Coding Style Guidelines</a></h4><p>JavaScriptではありませんが、Webkitにおけるコーディングルール。 <br
/>ホワイトスペースやLine breakingの所はJavaScriptの場合でも参考になる。 <br
/>uupaaさんがこれをベースに一部分を変更した感じで使ってるそうです。</p><ul><li><a
href="http://code.google.com/p/uupaa-js/wiki/CodingStyle">CodingStyle &#8211; uupaa-js &#8211; JavaScript Coding Style Guide &#8211; JavaScript Library for Casual Creator &#8211; Google Project Hosting</a></li></ul><h4><a
href="http://d.hatena.ne.jp/amachang/20100917/1284700700">サイボウズで学んだこと &#8211; IT戦記</a></h4><p>amachangによるもの。 <br
/>大規模 JavaScript 開発におけるルールや命名規則、デバッグ、パフォーマンスについて触れています。 <br
/>コーディングルールを整えてどのように実践したかについて参考になります。</p><h4><a
href="http://www.amazon.co.jp/exec/obidos/ASIN/4873114888/book042-22/ref=nosim/">JavaScriptパターン</a> (オライリー本)</h4><h4></h4><div
class="azlink-box" style="margin-bottom: 0px;"><div
class="azlink-image" style="float: left;"><a
name="azlinklink" href="http://www.amazon.co.jp/exec/obidos/ASIN/4873114888/book042-22/ref=nosim/" target="_blank"></a><img
style="border-style: none;" src="http://ecx.images-amazon.com/images/I/51ZoMJ%2BrLhL._SL160_.jpg" alt="JavaScriptパターン ―優れたアプリケーションのための作法" /></div><div
class="azlink-info" style="line-height: 120%; float: left; margin-left: 15px;"><div
class="azlink-name" style="line-height: 120%; margin-bottom: 10px;"><a
name="azlinklink" href="http://www.amazon.co.jp/exec/obidos/ASIN/4873114888/book042-22/ref=nosim/" target="_blank"></a>JavaScriptパターン ―優れたアプリケーションのための作法<div
class="azlink-powered-date" style="line-height: 120%; margin-top: 5px; font-family: verdana; font-size: 7pt;">posted with <a
href="http://sakuratan.biz/azlink/dp/JavaScript%E3%83%91%E3%82%BF%E3%83%BC%E3%83%B3%20%E2%80%95%E5%84%AA%E3%82%8C%E3%81%9F%E3%82%A2%E3%83%97%E3%83%AA%E3%82%B1%E3%83%BC%E3%82%B7%E3%83%A7%E3%83%B3%E3%81%AE%E3%81%9F%E3%82%81%E3%81%AE%E4%BD%9C%E6%B3%95/4873114888/book042-22" target="_blank">AZlink</a> at 2011.5.27</div></div><div
class="azlink-detail">Stoyan Stefanov,豊福 剛 <br
/>オライリージャパン <br
/>売り上げランキング: 8213</div><div
class="azlink-link" style="margin-top: 5px;"><a
href="http://www.amazon.co.jp/exec/obidos/ASIN/4873114888/book042-22/ref=nosim/" target="_blank">Amazon.co.jp で詳細を見る</a></div></div></div><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>&nbsp;</p><p>この書籍の<a
href="http://efcl.info/adiary/JavaScriptPatterns/Chapter2Essentials">Chapter 2. Essentials</a>において、JavaScriptのコーディングルールが紹介されています。 <br
/>また避けるべき事やどう書くべきなのかについてもかなり深く書かれています。</p><p>コーディングルールは&#8221;どう書けばいいのか分からない&#8221;という人向けのものではないと思います。どう書いたらいいのか分からない人は、まずなぜそのように書いたらダメなのかを知るのがよいと思います。 <br
/>そのため、書き方に不安を持ってる人はなぜダメなのかについても触れている<a
href="http://cou929.nu/data/google_javascript_style_guide/">Google JavaScript Style Guide 和訳</a>を読むのがよいと思います。(読みやすい日本語版もあるしね) <br
/>コーディングルールはコードに一貫性を持つためにあると思います。頻繁にルールを変える必要はないと思いますが、必ずしもそのルールが、その時の(実行環境|JavaScript)において最適な書き方ではない場合もあります。そういうときはルールの更新をしましょう。</p><h4>おまけ</h4><p>自分の場合は<a
href="http://www.jetbrains.com/webstorm/">WebStorm</a>の<a
href="http://efcl.info/2010/1027/res2023/">自動整形</a>に任せている(といっても膨大なルール設定があるため、上記で紹介したコーディングルールを自動化できる)ので、基本的にはIDE任せという書き方にしています。 <br
/>セミコロン忘れなどについてはcomplete current statement機能(<a
href="http://blog.livedoor.jp/okashi1/archives/51751259.html"> [WebStorm]Complete Current Statementがとても便利な件(・∀・)</a>)を使ったり、<a
href="http://www.jetbrains.com/webstorm/">WebStorm</a>のシンタックスチェックはかなり優秀なのでエラーも書いてる途中で発見しやすいです。(シンタックスチェックも細かく制御できる) <br
/>そのため、やっぱり道具任せといった感じではありますが、WebStormを使用していない場合も同じコードが書けるようにある程度のルールは持っています。 <br
/><a
href="http://google-styleguide.googlecode.com/svn/trunk/javascriptguide.xml">Google JavaScript Style Guide</a> + <a
href="http://www.webkit.org/coding/coding-style.html">WebKit Coding Style Guidelines</a> に近いですが、ホワイトスペースなど見た目的なちょっとした違いにはそこまで厳しくしない感じで書いています。 <br
/>if, for, while, doなどの{}は省略しない(<a
href="http://www.memetodo.co.cc/2011/05/webstorm_29.html">WebStormの自動整形で中括弧を強制的につける</a>)、誰が見てもある程度読める感じにする、ブレークポイントを打ちやすい空間を作るように配慮するなどなどで、他のコーディングルールに書いてある事と同じようなものだと思います。</p> ]]></content:encoded> <wfw:commentRss>http://efcl.info/2011/0527/res2764/feed/</wfw:commentRss> <slash:comments>4</slash:comments> </item> </channel> </rss>
<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk: basic
Page Caching using disk: enhanced
Database Caching 4/11 queries in 0.106 seconds using disk: basic
Object Caching 748/763 objects using disk: basic

Served from: efcl.info @ 2012-05-22 12:38:47 -->
