<?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/"
		xmlns:xhtml="http://www.w3.org/1999/xhtml"
>

<channel>
	<title>おいぬま日報 &#187; DBIx::Thin</title>
	<atom:link href="http://tech.lampetty.net/tech/index.php/archives/category/perl/dbixthin/feed" rel="self" type="application/rss+xml" />
	<link>http://tech.lampetty.net/tech</link>
	<description>Apache, MySQL, Perl, WordPressあたり</description>
	<lastBuildDate>Sun, 18 Jul 2010 19:00:11 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>ja</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<xhtml:link rel="alternate" media="handheld" type="text/html" href="http://tech.lampetty.net/tech/index.php/archives/category/perl/dbixthin/feed" />
<atom:link rel="hub" href="http://pubsubhubbub.appspot.com"/><atom:link rel="hub" href="http://superfeedr.com/hubbub"/>		<item>
		<title>DBIx::ThinをCPANから削除</title>
		<link>http://tech.lampetty.net/tech/index.php/archives/364</link>
		<comments>http://tech.lampetty.net/tech/index.php/archives/364#comments</comments>
		<pubDate>Tue, 12 Jan 2010 17:18:02 +0000</pubDate>
		<dc:creator>oinume</dc:creator>
				<category><![CDATA[DBIx::Thin]]></category>
		<category><![CDATA[Perl]]></category>

		<guid isPermaLink="false">http://tech.lampetty.net/tech/?p=364</guid>
		<description><![CDATA[表題の通りですが、思うところがあってDBIx::Thinを削除しました。きっかけは、CPAN Ratingsのレビューです(以下引用)。

DBIx-Thin (0.05) **
 It strikes me as od [...]]]></description>
			<content:encoded><![CDATA[<p>表題の通りですが、思うところがあって<a href="http://github.com/oinume/p5-dbix-thin">DBIx::Thin</a>を削除しました。きっかけは、<a href="http://cpanratings.perl.org/dist/DBIx-Thin">CPAN Ratingsのレビュー</a>です(以下引用)。</p>
<blockquote><p>
DBIx-Thin (0.05) **</p>
<p> It strikes me as odd how almost most of Japanese authors (of course, except honourable and admirable authors) don&#8217;t write why they have written their modules and the intention of the modules.<br />
 So is the author of this module.<br />
 The module is yet another ORM module but unfocused one. What the heck is different from DBIx::Skinny? The explanation is nowhere to be found, but there is just an enumeration of methods. And yet could anyone else use the module?
</p></blockquote>
<p>言われてみればその通りで、PODにコンセプトも書いてなければ<a href="http://search.cpan.org/dist/DBIx-Skinny/">DBIx::Skinny</a>と違うところも良くわからないと。その辺に関しては<a href="http://github.com/oinume/p5-dbix-thin/blob/master/lib/DBIx/Thin.pm">モジュールのPOD</a>に書いておきましたが、それでもDBIx::Skinnyとあんまり変わらないし、現時点で自分以外の誰かが使っているとも思えないので、変な混乱を招かないようにCPANからは削除しました。んで<a href="http://github.com/oinume/p5-dbix-thin">github</a>では開発を継続していきます。</p>
]]></content:encoded>
			<wfw:commentRss>http://tech.lampetty.net/tech/index.php/archives/364/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<xhtml:link rel="alternate" media="handheld" type="text/html" href="http://tech.lampetty.net/tech/index.php/archives/364" />
	</item>
		<item>
		<title>DBIx::ThinというORMapperをリリースしました</title>
		<link>http://tech.lampetty.net/tech/index.php/archives/357</link>
		<comments>http://tech.lampetty.net/tech/index.php/archives/357#comments</comments>
		<pubDate>Tue, 29 Dec 2009 02:21:14 +0000</pubDate>
		<dc:creator>oinume</dc:creator>
				<category><![CDATA[DBIx::Thin]]></category>
		<category><![CDATA[Perl]]></category>

		<guid isPermaLink="false">http://tech.lampetty.net/tech/?p=357</guid>
		<description><![CDATA[今年のYAPC(9月)からすき間時間を使って作っていたDBIx::Thinという、DBIx::Skinnyインスパイアなモジュールを昨日やっとリリースしました。作った動機は単に自己満足の追求と車輪の再発明による個人のスキ [...]]]></description>
			<content:encoded><![CDATA[<p>今年のYAPC(9月)からすき間時間を使って作っていた<a href="http://search.cpan.org/dist/DBIx-Thin/lib/DBIx/Thin.pm">DBIx::Thin</a>という、<a href="http://search.cpan.org/dist/DBIx-Skinny/lib/DBIx/Skinny.pm">DBIx::Skinny</a>インスパイアなモジュールを昨日やっとリリースしました。作った動機は単に自己満足の追求と車輪の再発明による個人のスキルアップですが、前職で3年前ぐらいに自作したORMのコードを忘れないうちに改良して世に出したいなぁとずっと思っていたのです。SkinnyのAdvent Calendarが日々更新されているのを読み、途中で何度も「これSkinny使えばいいんじゃね？」って思って挫折しかけましたが、Skinnyも細かいところでは自分のポリシーと合わない部分があったりしたのと、とりあえず作ってしまったので世に出してみます。</p>
<p>特徴としては</p>
<ul>
<li>生SQL派にやさしい</li>
<li>Skinnyより書き方は冗長だと思うけど、コードを見て何をやっているかわかるようにした</li>
<li>依存モジュールが少ない(標準以外のものは3つ)</li>
<li>Schemaクラスを生成するジェネレータが標準添付(ただしまだMySQL以外のDBに対応していない)</li>
</ul>
<p>かなと思います。SQLはなんだかんだ言ってもまだWebエンジニアの共通言語だと思うので、ORMでゴリゴリJOINのコードを書くより生SQLの方がわかりやすい、と思っているので、生SQLなモジュールを作りました。</p>
<p>「Skinnyより書き方は冗長」というのは、例えばSkinnyだと</p>

<div class="wp_syntax"><div class="code"><pre class="perl" style="font-family:monospace;"><span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$iterator</span> <span style="color: #339933;">=</span> Your<span style="color: #339933;">::</span><span style="color: #006600;">Model</span><span style="color: #339933;">-&gt;</span><span style="color: #006600;">search</span><span style="color: #009900;">&#40;</span>
    <span style="color: #ff0000;">'user'</span><span style="color: #339933;">,</span>
    <span style="color: #009900;">&#123;</span>id <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span>
    <span style="color: #009900;">&#123;</span>order_by <span style="color: #339933;">=&gt;</span> <span style="color: #ff0000;">'id'</span><span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>と書きますが、2つ目の引数が何を表しているのかぱっと見わからないので、Thinの場合は</p>

<div class="wp_syntax"><div class="code"><pre class="perl" style="font-family:monospace;"><span style="color: #b1b100;">my</span> <span style="color: #0000ff;">$iterator</span> <span style="color: #339933;">=</span> Your<span style="color: #339933;">::</span><span style="color: #006600;">Model</span><span style="color: #339933;">-&gt;</span><span style="color: #006600;">search</span><span style="color: #009900;">&#40;</span>
    <span style="color: #ff0000;">'user'</span><span style="color: #339933;">,</span>
    where <span style="color: #339933;">=&gt;</span> <span style="color: #009900;">&#123;</span>id <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span> <span style="color: #666666; font-style: italic;"># これ</span>
    order_by <span style="color: #339933;">=&gt;</span> <span style="color: #ff0000;">'id'</span><span style="color: #339933;">,</span>
<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>と書くようにしています。もちろんSkinnyも学習すれば全然わかると思うので、細かいどうでもいいことかもしれませんが&#8230;</p>
<p>あとSkinnyと違う点は、</p>
<ul>
<li>SchemaクラスとレコードのRowクラスは分離されていますが、シンプルさを重視してあえて一緒のクラスにまとめているところ(Your::Model::UserみたいなクラスがSchema定義をしてさらにこれのインスタンスがRowオブジェクト)</li>
<li>Schemaクラスの書き方がSkinnyはinflateやutf8がルールベースで全テーブルに適用されますが、こっちは基本的にテーブルの各カラムごとに書くようにさせてます</li>
</ul>
<p>ところぐらいでしょうか。</p>
<p>最後に、Skinnyのコードはすごく綺麗で色々な部分を参考にさせてもらいました。作者の<a href="http://d.hatena.ne.jp/nekokak/">nekokakさん</a>、どうもありがとうございました。</p>
]]></content:encoded>
			<wfw:commentRss>http://tech.lampetty.net/tech/index.php/archives/357/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<xhtml:link rel="alternate" media="handheld" type="text/html" href="http://tech.lampetty.net/tech/index.php/archives/357" />
	</item>
	</channel>
</rss>
