<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
  <id>http://www.h3rald.com/</id>
  <title>H3RALD - Tag 'books' (Atom Feed)</title>
  <updated>2011-08-07T16:01:52Z</updated>
  <link rel="alternate" href="http://www.h3rald.com"/>
  <link rel="self" href="http://www.h3rald.com/tags/books/atom/"/>
  <author>
    <name>Fabio Cevasco</name>
    <uri>http://www.h3rald.com</uri>
  </author>
  <entry>
    <id>tag:www.h3rald.com,2011-08-07:/articles/ruby-compendium-020/</id>
    <title>Ruby Compendium v0.2.0 released</title>
    <published>2011-08-07T16:01:52Z</published>
    <updated>2011-08-07T18:12:23Z</updated>
    <link rel="alternate" href="http://www.h3rald.com/articles/ruby-compendium-020/"/>
    <category term="ruby-compendium" scheme="http://www.h3rald.com/tags/ruby-compendium/"/>
    <category term="books" scheme="http://www.h3rald.com/tags/books/"/>
    <category term="ruby" scheme="http://www.h3rald.com/tags/ruby/"/>
    <content type="html">
<![CDATA[

		<section class="section">
<p>The Ruby Compendium has been updated, and it now lists the most up-to-date versions of various Ruby implementatios, even more web sites, books, podcasts, and Rubyists. In addition to the <span class="caps">PDF</span> version, the book can now be read online <a href="/ruby-compendium/book/">here on H3RALD.com</a>.</p>
<p>Overall, this is a relatively minor update; however, I felt it was a good time to release it to keep the book up-to-date.</p>

<p>The <em>Ruby Compendium</em> is available free of charge, under the terms of the <a href="http://creativecommons.org/licenses/by-sa/3.0/">Creative Commons Attribution-ShareAlike 3.0 Unported License</a>, and you can help improving it! It was written using my very own <a href="http://www.h3rald.com/glyph">Glyph Framework</a>, and the entire source code is available on <a href="https://github.com/h3rald/ruby-compendium">GitHub</a>, for anyone to fork.</p>
<div style="text-align:center;margin:20px; auto;font-size: 18px; font-weight:bold;"><a href="https://github.com/downloads/h3rald/ruby-compendium/ruby-compendium.pdf">Download <span class="caps">PDF</span></a> | <a href="http://www.h3rald.com/ruby-compendium/book">Read Online</a></div>

</section>]]>
    </content>
  </entry>
  <entry>
    <id>tag:www.h3rald.com,2011-03-26:/articles/the-rails3-way-review/</id>
    <title>Book Review: The Rails 3 Way</title>
    <published>2011-03-26T12:16:46Z</published>
    <updated>2011-03-27T11:41:36Z</updated>
    <link rel="alternate" href="http://www.h3rald.com/articles/the-rails3-way-review/"/>
    <category term="review" scheme="http://www.h3rald.com/tags/review/"/>
    <category term="books" scheme="http://www.h3rald.com/tags/books/"/>
    <category term="rails" scheme="http://www.h3rald.com/tags/rails/"/>
    <content type="html">
<![CDATA[

		<section class="section">
<p>Obie did it, again. With the second edition of his former masterpiece, <em>The Rails Way</em>, he managed to outdo himself delivering a new, even more useful, Rails Bible. Wether you&#8217;re a Ruby on Rails professional like him or just an enthusiast, this book is pretty much everything you need to learn how to master the third release of <acronym title="David Heinameier Hansson"><span class="caps">DHH</span></acronym>&#8217;s Ruby web framework.</p>
<p><a href="http://tr3w.com/">The Rails 3 Way</a> is no ordinary second edition. If you already own <em>The Rails Way</em>, you&#8217;ll be pleasantly surprised that this is a different, more polished book. While something had to remain the same, there&#8217;s a lot of new content in its 708 pages, and even the old content has been rewritten or at least revised.</p>
<p>It doesn&#8217;t matter whether you already know Rails 2.x or you&#8217;re jumping straight into the Rails 3 world, if you use Rails, you can&#8217;t miss this book.</p>
<p>I started the <a href="http://www.h3rald.com/articles/the-rails-way-review/">review of the first edition</a> with a quote from my fiancée (now wife) on how pointless programming books are, especially those dealing with newish technologies: they tend to go out of date fairly quickly. While this still holds true, there&#8217;s not much you can do about it, except maybe purchasing a digital edition of the book instead. However, if you want to keep a good Rails reference book by your side, this has to be the one.</p>




<section class="section">
<header><h1 id="h_1">What's New</h1></header>
<figure style="float:left;"><img src="/img/pictures/books/rails3way/compare.jpg" /><figcaption>The Rails Way vs. The Rails 3 Way</figcaption></figure>
<p>If you put <em>The Rails 3 Way</em> and the original <em>The Rails Way</em> one next to the other, you can see that the new book is considerably shorter: about 200 pages less. This doesn&#8217;t mean it contains less information, quite the opposite: the new book contains a lot more stuff with less <em>fluff</em>. Obie managed to reduce digressions to a bare minimum and focus on providing more informative content to the readers using less text. Think of it as a <em>fat-free</em> book.</p>
<p>While no <em>What&#8217;s new in Rails 3</em> section is included in the book, Obie points out the new stuff when needed (but not always). An example is chapter 12, <em>Ajax on Rails</em>, in which changes introduced by Rails 3 clearly stand out, especially the section on Unobtrusive JavaScript (<span class="caps">UJS</span>).</p>
<p>Although the book is divided into chapters, it can also be divided into parts (each dealing with a specific theme) simply by looking at the front edge. According to this theme-based partitioning, Active Record makes up for nearly <em>a quarter</em> of the book (173 pages), followed by <em>Active Support <span class="caps">API</span></em> appendix and the <em>All About Helpers</em> chapter.</p>
<p>Another nice addition that can really make the difference when you&#8217;re in a hurry is the <em>Method Index</em>, which is separate from the main Index. It seems to account for all the methods in all (or at least the most important) classes in Rails. I didn&#8217;t check method by method, but it is pretty comprehensive nonetheless, based on some quick spot checking.</p>

</section>
<section class="section">
<header><h1 id="h_2">Contents</h1></header>
<figure style="float:right;"><img src="/img/pictures/books/rails3way/sections.jpg" /><figcaption>Active Record makes up for over 24% of the book</figcaption></figure>
<p>The first thing you notice once you read the first few pages, is that this book is <em>even more opinioned</em> than its predecessor.</p>
<blockquote>
<p>Even though Rails 3 is less opinionated than early versions, in that it allows for easy reconfiguration of Rails assumptions, this book is more opinionated than ever.</p>
</blockquote>
	<p style="margin-left: 4em">&ndash; Obie Fernandez, <cite>Introduction to <em>The Rails Way</em></cite></p>
<p>In other words, you won&#8217;t find an ERb view in the whole book (Haml rulez!) and if you don&#8217;t like RSpec&#8230; well, you&#8217;d better skip Chapter 18 altogether.</p>
<p>The other big difference with traditional Ruby and Rails books is the amount of reference to third-party code, mainly rubygems. Rails comes with no authentication functionality? So what: <a href="https://github.com/binarylogic/authlogic">Authlogic</a> and <a href="https://github.com/plataformatec/devise">Devise</a> are great for the job, go check them out! Do you need to test your Active Mailer emails? <a href="https://github.com/bmabey/email-spec">email-spec</a> is all you need.</p>
<p>I was actually surprised to find so much content not strictly related to Rails in this book: the first chapter starts off with <a href="http://gembundler.com/">Bundler</a> (now a Rails dependency, however), Chapter 2 (Routes) mentions <a href="http://rack.rubyforge.org/">Rack</a>, and so does Chapter 4 (Controllers). If you want a nice and to-the-point practical introduction to <a href="http://relishapp.com/rspec">RSpec</a>, the first part of Chapter 18 covers that.</p>

	<figure style="float:left;"><img src="/img/pictures/books/rails3way/reference.jpg" /><figcaption>About 40% of the book is reference material</figcaption></figure>
<p>Then there&#8217;s reference material. Plenty of it, a good 40% I daresay. The good thing is that (unlike the first edition) it won&#8217;t bore you to death: take Chapter 5 (Working with Active Record) for example, you&#8217;ll fly through find-related methods so swiftly you&#8217;ll regret when it&#8217;s over. Active Support? I didn&#8217;t read every line of Appendix B, but when I want to know something about inflection methods I will know exactly where to find them, and what to expect: the method signature, a few lines of text, and a short example at most.</p>
<p>My only regret? Cheat sheets. Or better, the lack of them. More tables, please! Granted, the web is full of Rails cheat sheets, but a few of them at the end of the book or even in a separate foldable add-on like in the <a href="http://www.pragprog.com/titles/tpp/the-pragmatic-programmer">Pragmatic Programmer</a> can&#8217;t hurt.</p>
<p>Finally, some words about the code examples. The code/text ratio is almost 1:1, but Obie&#8217;s choice of <em>not</em> turning this book into a huge tutorial by implementing a single example application was absolutely right: The code snippets used in throughout the book are concise and relevant to the text around them and won&#8217;t distrupt your reading. If you want to play with them, they&#8217;re even <a href="https://github.com/obie/tr3w_time_and_expenses">on GitHub</a> for you to clone and fork.</p>

</section>
<section class="section">
<header><h1 id="h_3">Organization and Writing Style</h1></header>
<figure style="float:right;"><img src="/img/pictures/books/rails3way/flick.jpg" /><figcaption>Yes, it&#8217;s a long book. But you don&#8217;t<br/>have to read it from start to finish!</figcaption></figure>
<p><em>The Rails 3 Way</em> is a book for Rails professionals. If you don&#8217;t know Ruby or if you never heard of Ruby on Rails, this book is <em>not</em> for you. It won&#8217;t teach you what <span class="caps">MVC</span> is, it won&#8217;t waste time on explaining <em>convention over configuration</em>, it won&#8217;t even describe the structure of a Rails app! If you&#8217;re newcomer to Rails&#8230; well, that&#8217;s what <a href="http://ruby.railstutorial.org/">The Rails Tutorial</a> is for.</p>
<p>To be honest, I&#8217;m with Obie on this. If this book had been beginner-friendly, it would have been even longer than the previous edition, and probably more boring. Instead, by assuming that the reader has been already initiated to the world of Ruby and Rails, the author can dive into the framework straight away. Moreover, chapters are not ordered by difficulty: they don&#8217;t need to be, they need to be ordered in a way that makes sense for a Rails developer.</p>
<p>Once again, this book includes personal sidebars used to voice the opinion of one of the co-authors or Rails gurus: there are plenty of &#8220;<em>Yehuda</em> says&#8221;, &#8220;<em>Xavier</em> says&#8221;, &#8220;<em>Durran</em> says&#8221;, and so on. Nothing new there, it&#8217;s just a nice way to provide the reader with authoritative opinions on some matters.</p>
<p>As I progressed through the book, I started noticing how Obie anticipated my questions and doubts: I found this to be a remarkable feature of this book, and an excellent way to make the readers feel they are on the same page with the author. If something should not be done because it may cause you problems, the author won&#8217;t hold back. See page 214, &#8220;Extra Columns on <strong>has_and_belongs_to_many</strong> Join Tables&#8221;, for example: it&#8217;s a cool feature, but it can cause all sort of annoyances, and the bottom line is: use <strong>has_many :through</strong> instead, if you need extra columns on join tables.</p>

</section>
<section class="section">
<header><h1 id="h_4">Conclusion</h1></header>
<p><em>The Rails 3 Way</em> remains the <em>de facto</em> reference book for Rails. I was quite pleased to see that Obie improved it so much, compared to the first edition. Sure, it cannot be recommended to absolute beginners, but it&#8217;s not a big problem: if you&#8217;re new to Rails, all you have to do is browse around and read a few basic tutorials first.</p>
<p>What I really missed was a <em>What&#8217;s New</em> section, or something like that. The new stuff that was introduced in Ruby on Rails v3 is seamlessly blended with all the rest, which is great if you&#8217;re tackling the framework for the first time, but not so much when you already read tons of books on Rails 2.&#215;. I would have tagged content specific to Rails 3 in some way at least, for example with labels on the side of each page. Or maybe have a short introductory chapter covering the new features, and directions on where to find them in the book.</p>
<p>Overall, <em>The Rails 3 Way</em> is a great book, and if you plan on using Rails 3 for your next web site, it deserves a special place on your desk.</p>

</section>

</section>]]>
    </content>
  </entry>
  <entry>
    <id>tag:www.h3rald.com,2011-02-05:/articles/reflections-on-management/</id>
    <title>Book Review: Reflections on Management</title>
    <published>2011-02-05T21:51:25Z</published>
    <updated>2011-03-27T11:41:35Z</updated>
    <link rel="alternate" href="http://www.h3rald.com/articles/reflections-on-management/"/>
    <category term="review" scheme="http://www.h3rald.com/tags/review/"/>
    <category term="books" scheme="http://www.h3rald.com/tags/books/"/>
    <category term="software" scheme="http://www.h3rald.com/tags/software/"/>
    <content type="html">
<![CDATA[

		<section class="section">
<p>When I was offered to review this book, I was a bit skeptical: a book on <em>management</em>? I normally read and review books on programming and software development methodologies. However, I work as a Documentation Technical Leader, and while I don&#8217;t technically <em>manage</em> a whole team yet (damn economic crisis!), someday I may end up doing just that, so I gave <a href="http://www.informit.com/store/product.aspx?isbn=032171153X">Reflections on Management</a> a try.</p>
<p><em>It&#8217;s short, after all, I&#8217;ll probably read it in a couple of weeks and move on</em> &mdash; I thought. Well, beware of short books: I thought exactly the same thing when I picked up <a href="http://en.wikipedia.org/wiki/The_Elements_of_Style">The Elements of Style</a>, and it still follows me around everywhere, so that I can re-read bits of it whenever I need to.</p>
<p>This short but dense masterpiece by Watts S. Humphrey and William R. Thomas is one those books you always end up carrying around in your pocket (or stored in your favorite ebook reader). It&#8217;s a short but very dense collection of tips and tricks to succeed as a leader and a manager &mdash; of <em>anything</em>: <q>Your Software Projects, Your Teams, Your Boss, and Yourself</q>, as the book subtitle says. It doesn&#8217;t &#8220;just&#8221; help forging great managers and leaders, it also explains, with practical examples and no-nonsense explanations, how to deal with those annoying people in suits who constantly keep asking you for impossible things&#8230;</p>



<section class="section">
<header><h1 id="h_1">About Watts S. Humphrey</h1></header>
<p>Generally, I don&#8217;t bother writing anything about the authors in my reviews: you can easily find this kind of information online if you want to. I&#8217;ll make an exception in this case, you&#8217;ll understand why as you read along.</p>
<p><a href="http://www.sei.cmu.edu/watts/index.cfm?WT.ac=watts">Watts S. Humphrey</a> was a true legend in Software Engineering, he&#8217;s often referred to as <em>The Father of Software Quality</em>. He worked at <span class="caps">IBM</span> for 27 years and eventually became Vice President of Technical Development. In the 80s, he arrived at the <a href="http://www.sei.cmu.edu/">Software Engineering Institute (<span class="caps">SEI</span>)</a> where he developed some key development processes of our time: the Software Capability Maturity Model (<span class="caps">CMM</span>), the Personal Software Process (<span class="caps">PSP</span>), and the Team Software Process (<span class="caps">TSP</span>). He received many awards, culminating with the <em>National Medal of Technology</em> in 2005.</p>
<p>He wrote several books focusing mainly on software development and managing software projects through his <span class="caps">PSP</span> and <span class="caps">TSP</span> methodologies. <em>Reflections on Management &mdash; How to Manage Your Software Projects, Your Teams, Your Boss, and Yourself</em> was the last book published while he was alive. <a href="http://www.informit.com/title/0321624505">Leadership, Teamwork, and Trust: Building a Competitive Software Capability</a>, co-authored with James W. Over, was published posthumously.</p>
<p>Watts S. Humphrey <a href="http://www.sei.cmu.edu/newsitems/Humphrey_obituary.cfm">died</a> on October 28, 2010.</p>

</section>
<section class="section">
<header><h1 id="h_2">Structure and Organization</h1></header>
<p>In many ways, <em>Reflections on Management</em> can be seen as the <em>summa</em> of Humphrey&#8217;s work on <span class="caps">PSP</span>, <span class="caps">TSP</span> and management of software projects, condensed in a very readable 288-page-book, co-written with <a href="http://www.sei.cmu.edu/about/people/wrt.cfm">William R. Thomas</a>, Senior Technical Writer and manager of SEI&#8217;s Technical Publications Team.</p>
<p><img src="/img/pictures/books/reflmgmt.jpg" style="float:right" /></p>
<p>I noticed the tech writer&#8217;s touch simply by flicking through the pages of the book when I first got it: its structure is impeccable.</p>
<p>Organized into four parts, totalling 8 chapters, an Epilogue and an Appendix, this book is a prime example of order and readability: pick any section title (just the title) of any section in any chapter, and you get a clear idea of their content and purpose, and a key principle of management. Examples? Sure:</p>
<ul>
	<li>Chapter 8: Learning to Lead
	<ul>
		<li>8.1 How You Behave Affects Your Team</li>
		<li>8.2 Leaders Set an Example for Their Teams</li>
		<li>8.3 Learn to Avoid the Symptoms of Poor Leadership</li>
		<li>[&#8230;]</li>
	</ul></li>
</ul>
<p>If you print the Table of Contents alone you get a priceless cheat sheet on management and leadership. If you want slightly more detail, each chapter contains a summary table of all its sections, with a two-line summary of its contents. There are no subsections, only first-level sections, which make the book much easier to understand and &#8220;digest&#8221;.</p>
<p>You can read it all at once, then you should keep it readily available for consultation. It will take you only a few seconds to look through the contents and pick the most relevant section in a time of need.</p>

</section>
<section class="section">
<header><h1 id="h_3">Writing Style</h1></header>
<p>The book is very clear and simple to read, always. Each section is self-contained, and always aims to make a point, usually expressed right in its title. If I were to find a common pattern in most of the chapters of this book, it would be the following:</p>
<ol>
	<li>Identification of the problem &ndash; a particular situation or aspect is described in a way that problems are self-esplanatory.</li>
	<li>Labeling and classification &ndash; the situation is analized and often a set of causes are presented to the reader, often labeled or classified.</li>
	<li>List of possible solutions &ndash; a list possible solutions is presented to the reader, often as a definition list.</li>
	<li>Solution details &ndash; more details are provided to prove the effectiveness of the solution, often including personal anecdotes.</li>
</ol>
<p>By doing so, the author makes sure that everything he writes about can be easily understood and accepted, because proven by personal experience.</p>

</section>
<section class="section">
<header><h1 id="h_4">Contents</h1></header>
<section class="section">
<header><h1 id="h_5">Part I: Managing Your Projects</h1></header>
<p>The book starts with a general introduction on Software Quality. If you are new to the subject (and you <em>shouldn&#8217;t</em> be), this is probably one of the best and to-the-point overviews you&#8217;ll ever find, written by the man who almost came up with the concept.</p>
<p>The second chapter is about planning. Actually, the whole book is about planning at different levels, so no, you should not dismiss this part. <em>Good</em> plans are important, and they are your best weapon against management, if you excuse the expression.</p>
<p>Someone may object that if you&#8217;re working in an <em>agile</em> team, you shouldn&#8217;t spend a lot of energy in long-term planning, but rather focus on dealing with frequent requirement changes and deliver often and regularly. While this can be true, planning is still important: you won&#8217;t produce any rigorous schedule or design documents, but you still have to be able to provide accurate estimates and very often!</p>

</section>
	
	<section class="section">
<header><h1 id="h_6">Part II: Managing Your Teams</h1></header>
<p>The second part of the book focuses the <em>Team</em>, the people in it, their roles, their responsability and its leadership. Chapter 3 introduces Tom DeMarco&#8217;s concept of <em>Jelled Team</em>, i.e. a team that is more than the sum of its parts, and is characterized by cohesion, challenging goals, frequent feedback, a common working framework and good communication.</p>
<p>The Holy Grail. The dream of every team leader and its members. The good news is, it can be done. Any team can jell, and teams <em>like to jell</em> furthermore, if the proper conditions exist, and the three chapter in this third part will teach you everything from being a good team member to becoming a great team leader.</p>
<p>In many ways, this was my favorite part of the book. It&#8217;s amazing how a lifetime of experience is distilled in just a few pages. Chapter 5 (Leading and Coaching your Teams) is very, very inspiring and very helpful in understanding how to become a good team leader, how to motivate and involve people, and how to manage them rationally.</p>
<p>The story of Humphrey&#8217;s high school wrestling coach Umbach is a classic example of a truly dedicated, inspiring, and successful leader:</p>
		<blockquote>&#8220;The workouts were so tough that the matches seemed easy. By the end of the year, several of us were undefeated, the team took the 13-state championship, and we were campus heroes. All of this from a ragtag bunch of inexperienced recruits. It was Coach Umbach who made the team.<br />
<br />
Our coach&#8217;s dedication, commitment and energy were amazing, but what I found most inspiring was that he really cared about how each of us did. I have always remembered how he made a small band of raw recruits into a championship team and how he fostered the kind of cohesive team spirit that made losing simply unthinkable.&quot;</blockquote>

</section>
	
	<section class="section">
<header><h1 id="h_7">Part III: Managing Your Boss</h1></header>
<p>The third part consists of a single chapter: <em>Negotiation your projects and defending your plans</em>. It doesn&#8217;t matter if you want to pretend otherwise: as soon as you become a team leader and you have to deal with management, you&#8217;ll have to deal with complex internal politics.</p>
<p>This chapter is about learing to be pragmatically diplomatic and deal with management. It&#8217;s about creating good plans that can survive confrontation with your managers, no matter what their demands are.</p>
<p>There&#8217;s no silver bullet: I appreciated the honesty of the author when providing solutions. Section 6.6 (What to do when a project is doomed) is an example of this:</p>
<blockquote>
<p>You&#8217;re on a project and it&#8217;s headeing south. While everubody is trying their hardest, and you&#8217;re doing your level best to help, you can feel it in your bones: the project is doomed to fail. What can you do? You have three choices.</p>
<ol>
	<li>Keep plugging away and hope things will improve.</li>
	<li>Look for another job.</li>
	<li>Try to fix the problems.<br />
		</blockquote><br />
That&#8217;s right. Look for another job. That almost made me laugh, but it made me understand that in some extreme situation that may just be the best solution.</li>
</ol>

</section>
	
	<section class="section">
<header><h1 id="h_8">Part IV: Managing Yourself</h1></header>
<p>The last part of the book is about you. I would probably have moved it earlier on in the book, maybe right after the first part, but it serves as a good ending for the book. Chapter 7 (Taking Control of Your Work) is a must-read for anyone. It teaches you how to manage your working life, from time management (The 18 Hour Work Week) to psychological aspects (What Do You Want From Life?).</p>
<p>Chapter 8 (Learning to Lead), is a nice writeup on the essence of Leadership, and what it measn to be a good leader rather than a manager. A great read.</p>

</section>

</section>
<section class="section">
<header><h1 id="h_9">Final Thoughts</h1></header>
<p>Reading certain sections of this book felt a little bit weird at first. <span class="caps">TSP</span>, <span class="caps">PSP</span>, heavy planning and documents&#8230; are they still relevant in a &#8220;real world&#8221; now dominated by <em>agile</em> practices, Scrum, Kanban and similar? Do you really have to provide detailed plans and documentation to convince management?</p>
<ul>
	<li>You may not have detailed design documents, but you still have user stories.</li>
	<li>You may not be required to plan ahead of 6 months, but you still have to plan frequently and provide accurate estimates.</li>
	<li>You may not be required to trace and track everything you do, but at the very least you have to monitor your <em>velocity</em> and produce <em>burndown charts</em>.</li>
</ul>
<p>Yes, you read &#8220;<span class="caps">PSP</span>&#8221; and &#8220;<span class="caps">TSP</span>&#8221; everywhere in the book, but they are just labels. The methodologies and processes may change, but <em>the principles</em> will always remain true. This book is about understanding the very essence of management and leadership, and it will remain an invaluable resource for anyone who wants to build a career in the Software Industry.</p>

</section>

</section>]]>
    </content>
  </entry>
  <entry>
    <id>tag:www.h3rald.com,2011-01-23:/articles/introducing-ruby-compendium/</id>
    <title>Introducing the Ruby Compendium</title>
    <published>2011-01-23T17:02:15Z</published>
    <updated>2011-08-07T15:59:17Z</updated>
    <link rel="alternate" href="http://www.h3rald.com/articles/introducing-ruby-compendium/"/>
    <category term="ruby-compendium" scheme="http://www.h3rald.com/tags/ruby-compendium/"/>
    <category term="books" scheme="http://www.h3rald.com/tags/books/"/>
    <category term="ruby" scheme="http://www.h3rald.com/tags/ruby/"/>
    <content type="html">
<![CDATA[

		<section class="section">
<p>Learning a programming language can be hard and time consuming. You normally have to go through a bunch of tutorials, ask questions, read books&#8230; Ruby is no exception: there are plenty of resources out there about it, but it is often hard to find what you&#8217;re looking for. So, as a weekend project, I decided to create a <em>Ruby Compendium</em>, a short book about the Ruby Ecosystem.</p>
<p>I guarantee that you <em>will not</em> be able to code in Ruby after reading this book. Yes, you read it right, this book is not about coding, it&#8217;s about learning what&#8217;s out there for you that can help you to learn how to program in Ruby. Information on Ruby implementations, versions, web sites, books, podcasts, a handful of Ruby gems to solve common problems&#8230; it&#8217;s all in there.</p>

<p>The <em>Ruby Compendium</em> is available free of charge, under the terms of the <a href="http://creativecommons.org/licenses/by-sa/3.0/">Creative Commons Attribution-ShareAlike 3.0 Unported License</a>, and you can help improving it! It was written using my very own <a href="http://www.h3rald.com/glyph">Glyph Framework</a>, and the entire source code is available on <a href="https://github.com/h3rald/ruby-compendium">GitHub</a>, for anyone to fork.</p>
<div style="text-align:center;margin:20px; auto;font-size: 18px; font-weight:bold;"><a href="https://github.com/downloads/h3rald/ruby-compendium/ruby-compendium.pdf">Download (<span class="caps">PDF</span>)</a></div>

</section>]]>
    </content>
  </entry>
  <entry>
    <id>tag:www.h3rald.com,2010-12-27:/articles/leading-lean-software-development/</id>
    <title>Book Review: Leading Lean Software Development</title>
    <published>2010-12-27T13:15:45Z</published>
    <updated>2011-03-27T11:41:33Z</updated>
    <link rel="alternate" href="http://www.h3rald.com/articles/leading-lean-software-development/"/>
    <category term="review" scheme="http://www.h3rald.com/tags/review/"/>
    <category term="books" scheme="http://www.h3rald.com/tags/books/"/>
    <category term="software" scheme="http://www.h3rald.com/tags/software/"/>
    <content type="html">
<![CDATA[

		<section class="section">
<p>If you already heard the names Mary and Tom Poppendieck, chances are that you already know what <em>Lean Software Development</em> is. If you don&#8217;t, start from <a href="http://en.wikipedia.org/wiki/Lean_software_development">this Wikipedia page</a>. Mary and Tom coined this term with their first book on the subject <a href="http://www.amazon.com/exec/obidos/ASIN/0321150783/poppendieckco-20">Lean Software Development: An Agile Toolkit</a>, that was followed three years later by <a href="http://www.informit.com/store/product.aspx?isbn=0321437381">Implementing Lean Software Development: From Concept to Cash</a>, and finally by this book: <a href="http://www.informit.com/store/product.aspx?isbn=0321620704">Leading Lean Software Development: Results Are not the Point</a>.</p>
<p>Unlike the two other books, this one is focused about making lean software practices succeed. In some way, it can be compared to <a href="http://www.h3rald.com/articles/succeeding-with-agile-review/">Succeeding with Agile</a>, but while Mike Cohn&#8217;s book focuses entirely on Scrum, this book has a much broader scope. Moreover, the book contains a lot of digressions and stories &mdash;even not directly related to software development&mdash; aimed at understanding particular aspects of Lean Software Development and the Lean movement in general.</p>
<p>The focus is, as the title suggests, on leadership: how can you be a good leader in these difficult, ever-changing times? How can you be agile without loosing your team? How can you improve the existing processes so that they can help you achieve your goals? If you ever asked yourself these questions, this is the right book for you&#8230;</p>

<section class="section">
<header><h1 id="h_1">Structure and Organization</h1></header>
<p>This book is extremely well-structured. Its Table of Contents follows some very rigid rules which make this book one of the most organized texts I&#8217;ve ever come across. It is divided into six chapters, each organized as follows:</p>
<ul>
	<li>A <em>snapshot</em> or an introductory story for the chapter&#8217;s main topic</li>
	<li>Four <em>frames</em>, each describing a lean practice or personal quality</li>
	<li>A <em>portrait</em> of a leader</li>
	<li><em>Your Shot</em>, i.e. some questions and exercises for the readers</li>
</ul>
<p><img src="/img/pictures/books/leadingleanswdev.jpg" style="float:right" /></p>
<p>In total, the book contains 24 frames constituting the &#8220;Big Picture&#8221;, which is actually a very powerful framework for lean software leadership. You can read the book&#8217;s <span class="caps">TOC</span> <a href="http://www.poppendieck.com/llsd.htm">online</a> on the Poppendieck website and read the book&#8217;s Introduction (<a href="http://www.poppendieck.com/pdfs/LLSD_intro.pdf"><span class="caps">PDF</span> link</a>) on the whole concept of <em>framing</em> (yes, both the authors do love photography!).</p>
<p>When I started my career as a technical writer I used to love carefully-structured, simmetrical manuals. After a while, however, I understood that such rigorous structuring can even be dangerous if it becomes an obsession: you end up adding extra &#8220;padding writing&#8221; to make sections roughly match in length, or you start cutting down some other parts, for the same reason. Writing well-balanced books is hard, but I must say that the authors do a very good job with this book: it flows very naturally while keeping to its rigorous structure.</p>

</section>
<section class="section">
<header><h1 id="h_2">Chapter 1: Systems Thinking</h1></header>
<p>The first chapter is about customers, what they want and the goals of your system. It describes some interesting high level concepts like <em>failure demand</em> and <em>policy-driven waste</em>, and how to spot opportunities to improve the process.</p>
<p>What I found particularly interesting was the usage of <a href="http://www.cps.gov.uk/publications/finance/process_mapping.html">process maps</a> to analyze an existing process and find bottlenecks or leaks (in terms of time). I was instantly sold on this practice after reading the success story of how a company manage to reduce the overall time to process and solve customer issues simply by connecting customers directly to developers instead of tech support engineers. This is something you can&#8217;t apply everywhere, but after creating a process map for that specific case, the solution was evident.</p>
<p>More generally speaking, this chapter provides a recipe/checklist outlining the sequence of the phases of process improvement and problem solving:</p>
<ol>
	<li><em>Understand</em></li>
	<li><em>Observe</em></li>
	<li><em>Visualize</em></li>
	<li><em>Evaluate</em></li>
	<li><em>Implement</em></li>
</ol>

</section>
<section class="section">
<header><h1 id="h_3">Chapter 2: Technical Excellence</h1></header>
<p>This is the only chapter focusing primarily on technical topics and knowledge. It starts with a very lengthy digression on the history of programming methodologies, aimed at understanding <em>what works and what doesn&#8217;t</em>. Some examples of IT stuff that worked include the Internet, PCs and &#8230;Open Source Software.</p>
<p>This chapter provides a general overview on Software Development as a whole. It contains some interesting information on software complexity and dealing with architectural dependencies, comprehensive sections on testing and continuous integration, and just a half page on refactoring (understandable, seeing that there are already plenty of excellent books on the subject).</p>

</section>
<section class="section">
<header><h1 id="h_4">Chapter 3: Reliable Delivery</h1></header>
<p>The <em>Race to the Sky</em> section at the beginning of Chapter 3 is by far the most fascinating of the non-IT stories included in this book. It describes the construction of the Empire State Building in 1930, how it was planned out, what strategies were followed, and why it succeeded (why <em>the construction</em> succeeded: the building itself remained totally unprofitable for quite some time).</p>
<p>There are <a href="http://en.wikipedia.org/wiki/Empire_State_Building#Further_reading">plenty</a> of books on the subject, but Tom and Mary Poppendieck well summarize the key points of this modern-day epic achievement: how to build the tallest skyscraper in the world in a single year. This story teaches us how to work under very tight deadlines, by designing a system to fit constraints, rather than estimating up-front.</p>
<p>This story was perfect to introduce, in the same chapter, concepts like <a href="http://en.wikipedia.org/wiki/Kanban">Kanban</a>, <em>pull scheduling</em> and <em>adaptive control</em>, which only recently have been seriously considered in the world of Software Development but they are becoming more and more relevant.</p>

</section>
<section class="section">
<header><h1 id="h_5">Chapter 4: Relentless Improvement</h1></header>
<p>Chapter 4 starts with a brief history of the checklist, which was invented in 1935, to be used by airplane pilots. It then moves on to its usage in hospitals, describing how checklists helped dropping infections caused by inserting central venous catheters incorrectly. Why all this? To focus on the concept of <em>process standards</em>, or better, how <em>we</em> can improve processes to accomplish our goals.</p>
<p>Basically, this us what Toyota does: regulations should not be written on stone, but they should reviewed and updated frequently for continuous improvement or <a href="http://en.wikipedia.org/wiki/Kaizen">Kaizen</a>.</p>
<p>Finally, this chapter also briefly introduces a few different ways to perform root-cause analysis, such as using <a href="http://en.wikipedia.org/wiki/Ishikawa_diagram">fishbone diagrams</a>.</p>

</section>
<section class="section">
<header><h1 id="h_6">Chapter 5: Great People</h1></header>
<p>This chapter and the last one are actually focused on people and management. In this chapter, an unusual (for this kind of books, that is) but intriguing analysis on different countries using the following dimensions:</p>
<ul>
	<li>power distance</li>
	<li>individualism</li>
	<li>masculinity</li>
	<li>uncertainty avoidance</li>
	<li>long-term orientation</li>
</ul>
<p>Turns out that individualism is abundant in the Western world but not so much in the Far East (who would have thought!), but the opposite applies to power distance. A bit stereotypical, if I may, but not too much: the results are not surprising, especially when it comes to considering different cultures as a whole. Once more, the focus is again on Toyota&#8217;s Kaizen and their culture of <em>respect for the people</em>.</p>
<p>On page 198, the meaning of the subtitle of the book (Results Are not the Point) is revealed: <q>developing the people and the system so that together they are capable to achieve successful results is the point</q>. Agile is precisely about this: focusing on the people.</p>
<p>But what about leaders? This is an aspect of the whole Agile philosophy that I keep stumbling upon: if you want <em>The Team</em> to be in charge, what happens to leadership? As I found out myself working in and with Agile Teams, often there&#8217;s a serious lack of strong leaders. <q>Leadership needs to be gently refactored into Agile</q>, that&#8217;s what Mary and Tom recommend. How? It depends on each specific case, but it must always be done <em>gently</em>.</p>

</section>
<section class="section">
<header><h1 id="h_7">Chapter 6: Aligned Leaders</h1></header>
<p>The final chapter begins with the history of <em>Agile@IBM</em>, or how to turn the biggest software company in the world into a massive agile machine. It wasn&#8217;t a top-down decision, the <span class="caps">CEO</span> didn&#8217;t just wake up one morning and decided that everyone should go Agile. Quite the opposite: it was something that was <em>pulled</em> by developers rather than <em>pushed</em> at them.</p>
<p>In cases like this, companies should be focusing on developing people, including good leaders, instead of particular initiatives and processes. Leaders in turn should shift their focus from details to more high-level decisions. When it comes to facing changes, leaders should look at the <a href="http://www.bbrt.org/beyond-budgeting/bbprinc.html">12 principles</a> of the <a href="http://www.bbrt.org/"><span class="caps">BBRT</span></a> leadership model.</p>
<p>The final portrait, <em>Leaders at all Levels</em>, well summarizes the key to successful leadership: <q>leadership is about example, coaching and helping others to achieve their goals</q>.</p>

</section>
<section class="section">
<header><h1 id="h_8">Final Thoughts</h1></header>
<p>If you&#8217;re looking for a manual on implementing Lean Software Development in detail, this is probably not the best book on the subject. If you&#8217;re a developer at the start of your career, with no management responsibilities, you&#8217;d want more technical juice, so probably you should read the other two books by the Poppendiecks on the subject first.</p>
<p>On the other hand, if you have been working in IT for a few years, and maybe you already started to climb up the corporate ladder, reading this book could make the difference between being successful leader or not. This book does not go very in-depth with any particular methodology or process, but it does provide an excellent overview of a lot of them.</p>
<p>To get the best out of <em>Leading Lean Software Development</em>, you should read it a least once sequentially, skipping the parts that are not relevant to you (right now), taking notes on the more interesting frames, and then go back over them to digest them properly. Do <em>not</em> skip the introduction of each chapter though, for one because they are always pleasant to read between frames, and also because they do teach some very important values or strategies that you <em>must</em> assimilate.</p>
<p>The general message that stands out when reading this book is <em>focus on people</em>. Customers, of course, but also employees: every single successful company mentioned in this book, from Toyota to Southwest Airlines, became successful because they always focused on developing people <em>first</em>, and <em>then</em> products.</p>

</section>

</section>]]>
    </content>
  </entry>
  <entry>
    <id>tag:www.h3rald.com,2010-09-25:/articles/making-it-big-in-software/</id>
    <title>Book Review: Making it Big in Software</title>
    <published>2010-09-25T09:21:41Z</published>
    <updated>2010-09-28T21:14:24Z</updated>
    <link rel="alternate" href="http://www.h3rald.com/articles/making-it-big-in-software/"/>
    <category term="review" scheme="http://www.h3rald.com/tags/review/"/>
    <category term="books" scheme="http://www.h3rald.com/tags/books/"/>
    <category term="software" scheme="http://www.h3rald.com/tags/software/"/>
    <content type="html">
<![CDATA[

		<section class="section">
<p>When this book came out, it was immediately followed by a lot of buzz. Positive reviews started popping up almost instantly, a lot of people blogged about it, it was surrended by a lot of&#8230; what&#8217;s that word again? Oh yes, <em>hype</em>. The title pissed me off really: who on Earth wants to title his book <a href="http://bit.ly/b08auR">Making it Big in Software</a>? Steve Jobs? Bill Gates?</p>
<p>No, just a guy named <a href="http://lightstone.x10hosting.com/">Sam Lightstone</a>. When I was offered a review copy, I was a bit reluctant to even bother: I thought it was one of those overly-hyped titles that claim to make you famous and successful, but all they do stating the obvious: work hard, be innovative, use your money wisely, etc. Well, this book is not one of them.</p>
<p>When I got my copy, I immediately read the author&#8217;s bio on the second-last page of the book: Sam Lightstone runs a site called <a href="http://makingitbigcareers.com/">Making it Big Careers</a> (again, I got instantly worried by this), <em>but</em> also happens to be one of the brightest minds in <span class="caps">IBM</span>, a <a href="http://en.wikipedia.org/wiki/IBM_Master_Inventor"><span class="caps">IBM</span> Master Inventor</a>, author and co-author of 30+ patents.</p>
<p><img src="/img/pictures/books/making-it-big.jpg" class="right" /><br />
The 17 exclusive interviews with software gurus, visionaries, minor and major deities of the IT world are definitely worth the 24.99$ this book costs <em>on their own</em>. This was one of the major selling points of the book itself (as the merry-looking pictures of Marissa Mayer, James Gosling, Steve Wozniak and John Schwarz on the cover suggest), but far from being the only one. The interviews are strategically placed throughout the book, as supporting material for the author&#8217;s advice: if you don&#8217;t believe him, you will believe those who <em>made it</em>. Anyhow, let&#8217;s say something about the book itself, shall we?</p>
<p><em>Making it Big with Software</em> is divided into three parts:</p>
<ul>
	<li><strong>Part I: Fundamentals</strong> &#8212; all you need to know to get hired. Finish school, learn new things, and get a job in the Software industry.</li>
	<li><strong>Part II: Leadership</strong> &#8212; tips on what to do to start climbing the corporate ladder, from junior to senior manager.</li>
	<li><strong>Part <span class="caps">III</span>: Greatness</strong> &#8212; go beyond a successful career and become a luminary in IT, an example for future generations (and earn the big bucks).</li>
</ul>

	<section class="section">
<header><h1 id="h_1">Part I: Fundamentals</h1></header>
<p>After two introductory chapters, aimed at answering questions like &#8220;Why bother?&#8221; or &#8220;What do big shots in software do?&#8221;, the book starts analyzing what graduates get when they get out of school. I was really taken by the following paragraph, outlining the main difference between school and work:</p>
<blockquote>
<p>[&#8230;] although schools encourage students to do their own work, on penalty of expulsion or severe reprimand, professional work is saturated with the ubiquitous mantra of &#8220;teamwork.&#8221; In school, your success depends on individual effort, whereas professional life depends frequently on your ability to work in teams.</p>
</blockquote>
<p>So true. I never thought about it until I read it in this book. And this is a common causes of failure in the workplace: not being able to work in a team. It&#8217;s understandable: after years of striving to be the best, to do things for yourself, you&#8217;re suddenly asked to work for and with others.</p>
<p>The author gives junior graduates some useful tips to get a job in software development (or the software industry in general), with some useful tips on how to create a proper r&eacute;sum&eacute;, how to survive interviews, the usual. Hell I wish I had this book when I started!</p>
<p>Readers like me who already have a job should not dismiss this part. Maybe skim through the first few chapters, but towards the end there are some useful suggestions on how to build essential interpersonal skills and a nicely-written chapter about <em>career killers</em>.</p>

</section>

	<section class="section">
<header><h1 id="h_2">Part II: Leadership</h1></header>
<p>The second part of the book opens with <strong>Chapter 9</strong>, Working the Org, which I found most amusing for the funny, but insightful, <em>Negotiating 101</em> section. Again, particular emphasis is put on non-technical skills, which are however essential for success. I particularly enjoyed reading this part of the book, because I could relate to it, being a Technical Leader myself.</p>
<p><strong>Chapter 12</strong> is a must-read, as the author himself says:</p>
<blockquote>
<p>If you read only one chapter in this book, this should probably be the one.</p>
</blockquote>
<p>If you never read anything about time management, you rhave to read this, as it helps you realize how much time you waste, why, and what you can do to improve the situation. I attended a course on the subject at work, a while ago, and I was shocked to read most of the stuff I learned at that course so tidily organized in no-nonsense prose in this chapter. Granted, it doesn&#8217;t substitute a time management course or practical experience with managing your priorities, but it is a good starting point.</p>
<p><strong>Chapter 14</strong> deals with <em>Zen and the critical art of balance [between work and personal life]</em>. The diagram on page 249 scared the hell out of me. Here it is, transposed in tabular form:</p>
<table>
<tr>
		<th>Desired State</th>
		<th>Current State</th>
</tr>
<tr>
		<td>Work: 9 hours</td>
		<td>Work: 13 hours</td>
</tr>
<tr>
		<td>Sleep: 8 hours</td>
		<td>Sleep: 6 hours</td>
</tr>
<tr>
		<td>Travel: 1 hour</td>
		<td>Travel: 2 hours</td>
</tr>
<tr>
		<td>Family &amp; Leisure: 4 hours</td>
		<td>Family &amp; Leisure: 1 hours</td>
</tr>
<tr>
		<td>Chores &amp; Hygiene: 2 hours</td>
		<td>Chores &amp; Hygiene: 2 hours</td>
</tr>
</table>
<p><em>Thirtheen hours</em>? Really? If <em>you</em> work 13-hour days then you have to read this chapter <em>and put it into practice</em> instantly or you&#8217;ll regret it. Luckily <em>I</em> manage to work most of the time for 8 hours a day (as everyone should, by law).</p>
<p>Another chapter I particularly enjoyed (and will re-read periodically) is <strong>Chapter16</strong>, which contains the best definition of leadership I ever came across:</p>
<blockquote>
<p>&#8220;Leadership is communicating to people their worth and potential so clearly that they come to see it in themselves.&#8221;</p>
</blockquote>
	<p style="margin-left: 4em">&ndash; Stephen Covey</p>
<p>Again, this chapter teaches you the basics on leadership and management. If you didn&#8217;t take a course on the subject yet, it&#8217;s definitely worth a read.</p>

</section>

	<section class="section">
<header><h1 id="h_3">Part III: Greatness</h1></header>
<p>I particularly enjoyed the first two chapters of this last part: <strong>Chapter 17</strong> and <strong>Chapter 18</strong> are about <em>innovation</em>, which I found to be the fastest and best way to get noticed in a company.</p>
<p>These two chapters won&#8217;t teach you to become a genius or an inventor, but they do provide help on the subject: why innovating is important, how to innovate and what to do once your idea gets a shape. The <em>Patenting</em>, <em>Publishing</em> and <em>Public Speaking</em> sections in chapter 8 are useful and practical, and deserve a good read. Again, the book does not go too in-depth, but the author provides just enough information to make you aware of the main issues.</p>
<p>The final chapters of the book felt a bit distant from my current work reality. Business talk, stock options, startups, acquisitions&#8230; They may interest some readers with an enterpreneurial mindset, but not me, at least not now. Nonetheless, business and politics pay a very important role in any IT job, so it&#8217;s wise to be aware of them.</p>

</section>
<section class="section">
<header><h1 id="h_4">The Interviews</h1></header>
<p>The 17 interviews with software gurus, miracle workers and other extremely successful chaps make up for about the 20% of the book. They are carefully placed by the author in specific places of the book where they make the most sense (well, most of the time). Every person had to answer a similar set of questions, like &#8220;How did you get started in software&#8221;, &#8220;How do you stay on top of technology trends and innovation?&#8221; or &#8220;Technical leaders and executives are famous for being time-strapped. What strategies do you use to stay sane and use your time effectively?&#8221;.</p>
<p>Every interviews has at least one personal anecdotes. Some feel almost legendary, like the following:</p>
<blockquote>
<p>In 1967, at the age of 12, I dreamed of making a difference in the field of computer science. I went off to the local <span class="caps">IBM</span> office, literally knocked on their door, and said, &#8220;I will do anything for the summer-empty trash cans, you name it.&#8221; They said, &#8220;Go away kid.&#8221; But there was a sales guy who took pity upon me and threw me a nice Fortran IV [<span class="caps">IBM</span> Mathematical Formula Translating System] manual, with the expectation that I&#8217;d probably read it and get bored and never come back. But much to his surprise, I came back the following Monday and said, &#8220;Hey, this is cool! I just wrote a program and I want to run it.&#8221; The sales guy was so impressed that he found me an open computer to work on where I could teach myself how to keypunch, program, and debug for what I still recall as a delightful summer.</p>
</blockquote>
	<p style="margin-left: 4em">&ndash; Grady Booch, <span class="caps">IBM</span> Fellow and Chief Scientist for Software Engineering, <span class="caps">IBM</span> Research</p>
<p>Every interview provides at least a good piece of advice for newcomers to the field. The last chapter of the book summarizes the interviews attempting to draw the profile of the successful IT professional: some founded their own companies, other climbed up the corporate ladder, a few contributed with key inventions (email, the Internet, &#8230;) that changed society as we know it. Different levels of greatness, and different ways to reach it: this is what this book is really about.</p>

</section>
<section class="section">
<header><h1 id="h_5">Final Thoughts</h1></header>
<p><em>Making it Big in Software</em> is very well organized, in its three main parts. Unless you&#8217;re already the <span class="caps">CEO</span> of a multi-million-dollar company, you can learn something from this book, and even if you are, learning how other people <em>made it</em> is always beneficial.</p>
<p>It is not a specialized book, and as such it does not go in depth on anything specific. This is a good thing though, because after you read some of the chapters you feel motivated to learn more about this or that particular topic, skill or problem. In a way, it can be a good surrogate for more specialized books about r&eacute;sum&eacute; creation, job interviews, time management, leadership etc.</p>
<p>Overall, I recommend this book to everyone who wants to become successful in the software industry. Success can come to different degrees of course (or not come at all), but if you&#8217;re motivated enough and interested in your work, it is definitely within your grasp. <em>Be goal oriented</em>. It&#8217;s not enough, but it&#8217;s a good start.</p>

</section>

</section>]]>
    </content>
  </entry>
  <entry>
    <id>tag:www.h3rald.com,2010-06-22:/articles/distributed-programming-with-ruby-review/</id>
    <title>Book Review: Distributed Programming with Ruby</title>
    <published>2010-06-22T11:30:00Z</published>
    <updated>2011-03-27T11:41:31Z</updated>
    <link rel="alternate" href="http://www.h3rald.com/articles/distributed-programming-with-ruby-review/"/>
    <category term="review" scheme="http://www.h3rald.com/tags/review/"/>
    <category term="books" scheme="http://www.h3rald.com/tags/books/"/>
    <category term="ruby" scheme="http://www.h3rald.com/tags/ruby/"/>
    <content type="html">
<![CDATA[

		<section class="section">
<p>Back when I read <em><a href="http://www.pragprog.com/titles/ruby/programming-ruby">Programming Ruby</a></em> for the first time, I distinctly remember a short reference to <a href="http://ruby-doc.org/stdlib/libdoc/drb/rdoc/index.html">dRb</a>, the <strong>D</strong>istributed <strong>R</strong>u<strong>b</strong>y library included in the Standard Library.</p>
<p><em>&#8220;Cool!&#8221;</em>  &#8212; I thought</p>
<p>&#8230;and that was pretty much it. The documentation for DRb was pretty much nonexistent (at the time), I didn&#8217;t need it, so I pretty much forgot about it altogether until this book came out.</p>
<p><em><a href="http://www.informit.com/store/product.aspx?isbn=0321638360">Distributed Programming with Ruby</a></em> fills a very particular niche of the Ruby programming world: <em>distributed</em> programming. Moreover, this book is somehow <em>justified</em> by the scarce documentation on the subject:</p>
<blockquote>
<p>Although these libraries [DRb and rinda] have been included with Ruby for many years now, they have received little or no attention (or documentation). This has led to a lot of <span class="caps">FUD</span> (fear, uncertainty, and doubt) about what these libraries can and cannot do, and when they are appropriate to use (if at all).</p>
</blockquote>
<p style="padding-left:4em;">&#8212; Mark Bates, <em><a href="http://www.informit.com/store/product.aspx?isbn=0321638360">Distributed Programming with Ruby</a></em></p>
<p>But there&#8217;s more. This book gives the reader a complete overview of what&#8217;s out there, in the Ruby world, to support distributed programming. This includes quite a few gems and libraries besides the ones provided in the standard library.</p>
<section class="section">
<header><h1 id="h_1">Overview</h1></header>
<img src="/img/pictures/distributed-programming-with-ruby.jpg" style="float:right;" />
	<p>The book is organized into four parts, each dealing with a particular set of Ruby libraries related to distributed programming.</p>
<p>The author, <a href="http://www.metabates.com/">Mark Bates</a>, does a good job maintaining a sort of continuity in the examples throughout the book: you&#8217;ll get accustomed to a <em>Logger</em> class of some kind being punctually re-implemented more or less once per chapter, using a different library.</p>
<p>Additionally, the libraries described in the book are ordered by &#8220;reverse preference&#8221; in each part of the book, so normally the libraries described later on in a part fix some of the shortcomings of the preceding ones.</p>


	
	<section class="section">
<header><h1 id="h_2">Part I: Standard Library</h1></header>
<p>This part is the most important of all: it gives you the very basics about Distributed Programming and it describes the &#8220;building blocks&#8221; (<a href="http://ruby-doc.org/stdlib/libdoc/drb/rdoc/index.html">DRb</a> and <a href="http://ruby-doc.org/stdlib/libdoc/rinda/rdoc/index.html">Rinda</a>) used in nearly all the other libraries described in the book. If you want you can skip some chapters in the other parts of the book, but make sure this part is crystal clear in your head before proceeding any further.</p>

</section>	
	
	<section class="section">
<header><h1 id="h_3">Part II: Third-Party Frameworks and Libraries</h1></header>
<p>If you read part I, you&#8217;re probably a bit disappointed by DRb and Rinda and the amount of code you have to write to make simple things work in a distributed environment. The good news is that there are some Ruby gems out there that can make life simpler:</p>
<ul>
	<li><a href="http://seattlerb.rubyforge.org/RingyDingy/">RingyDingy</a></li>
	<li><a href="http://rufy.com/starfish/doc/">Starfish</a></li>
	<li><a href="http://github.com/markbates/distribunaut">Distribunaut</a></li>
	<li><a href="http://github.com/mperham/politics">Politics</a></li>
</ul>

</section>	
	
	<section class="section">
<header><h1 id="h_4">Part III: Distributed Message Queues</h1></header>
<p>In this part, the author introduces more in detail the concept of distribute message queues, and also the technologies and protocols available not only in the Ruby world but elsewhere. It focuses on two libraries:</p>
<ul>
	<li><a href="http://rubyforge.org/projects/starling/">Starling</a>, originally used by Twitter.</li>
	<li><a href="http://github.com/tmm1/amqp"><span class="caps">AMQP</span></a>, an implementation of the <a href="http://www.amqp.org/"><span class="caps">AMQP</span></a> protocol in Ruby, that can be used in conjunction with <a href="http://www.rabbitmq.com/">RabbitMQ</a>, an Erlang-based messaging system.</li>
</ul>

</section>	
	
	<section class="section">
<header><h1 id="h_5">Part IV: Distributed Programming with Ruby on Rails</h1></header>
<p>The book ends somewhat abruptly with this last part that deals with distributed programming in the Rails world. It feels a bit like a last-minute addendum that I would have left for an appendix, nevertheless it briefly introduces <a href="http://backgroundrb.rubyforge.org/">BackgrounDRb</a> and <a href="http://github.com/tobi/delayed_job">Delayed Job</a>.</p>

</section>

</section>

<section class="section">
<header><h1 id="h_6">Technical Analysis</h1></header>
<p>Unlike other technical books, this one can (must?) be read sequentially. Generally each chapter focuses on a library, describes how to install it and use it, and highlights its pros and cons. Typically, the &#8220;cons&#8221; are solved in the following chapter by another library, and so on&#8230;</p>
<p>The book is not meant to contain a full technical reference of each library, and it&#8217;s quite short (256 pages), so you really get the most out of it if you read it all, from start to finish. I didn&#8217;t realize there were so many different libraries in this particular niche of Ruby programming, and Mark does a good job demistifying some of them.</p>
<p>One thing that really struck me out of this book is the focus on gems. We&#8217;re not talking about <em>mainstream</em> frameworks like Rails or Merb here, but rather of some rather specialized, smaller libraries that fullfill very specific tasks. Personally, I don&#8217;t remember any other Ruby book doing this in the same way, and I was quite happy about it.</p>
<p>On the other hand, gems are a double-edged sword: while some of them are really cool and well-maintained, others may disappear tomorrow with no prior notice. I was actually very surprised to see even some of the <em>quirks</em> of these gems documented in the book:</p>
<p><strong>p91</strong>: <em>&#8220;Notice that we added client { } to the bottom of the server file. The reason for this appears to be a bug or flaw in the Starfish architecture.&#8221;</em></p>
<p>Really? Hasn&#8217;t it be fixed now? Apparently not, that&#8217;s the way it works, so no, you can&#8217;t blame the author of the book for this.</p>

	<section class="section">
<header><h1 id="h_7">Formatting and Readability</h1></header>
<p>As I pointed out earlier, this book is somehow meant to be read sequentially, and Mark does a good job making sure you don&#8217;t get bored. Chapters and sections are quite short and there&#8217;s a good text/code ratio: the examples are short and clear, and you don&#8217;t have to try them out yourself, because most of the time the author does it for you. It&#8217;s not infrequent for the author to tell you to run &#8220;wrong&#8221; code, but that&#8217;s a great way to show you how to do the right thing right afterwards.</p>
<p>Sidebars and boxes are used properly and they do provide actual value-added content: some information on a non-Ruby technology, some tips and tricks on how to run things smoothly, etc. On the other hand, one thing I couldn&#8217;t stand were the <em>endnotes</em>. I must say I don&#8217;t like endnotes at the best of times, but when they are pointless I just can&#8217;t suffer them. Each chapter has its own fair share of endnotes, but unfortunately most of them are just URLs to Wikipedia pages or RubyForce/GitHub projects: I would have preferred the URLs inline with the rest of the text, but that&#8217;s just me.</p>

</section>
	<section class="section">
<header><h1 id="h_8">Style and Contents</h1></header>
<p>Mark has a nice, informal writing style. Exactly what you expect from a programming book nowadays, even if sometimes it feels a bit too informal:</p>
<p><strong>p86</strong>: <em>&#8220;I think I understand what Eric means by all that. However, that is as deep as the documentation goes on the subject. I have not been able to test what I think he means, so I won&#8217;t make any grand promises about what the library can and cannot do in regards to expiring/renewing registrations.&#8221;</em></p>
<p>Although this is not something you&#8217;d see in a professional book everyday, it definitely helps to connect with the reader: Mark is one of us after all, even if he happens to have created quite a few <a href="http://github.com/markbates">interesting projects</a>, like the Mack framework, the Distribunaut library (which is also mentioned in his book, but in a very impartial way) and Configatron. From his book you understand that he&#8217;s neither one of those rockstar developers nor one of those famous authors who just writes books for a living: he&#8217;s a competent programmer who knows quite a bit about a particular, but relevant, niche of Ruby programming.</p>

</section>

</section>

<section class="section">
<header><h1 id="h_9">Final Thoughts</h1></header>
<p>This is one of those books I&#8217;d like to see a second edition of. Partly because there are some relatively new gems which have been left out (<a href="http://github.com/kwi/BrB">BrB</a>, for example), partly because this is a rather hot topic at the moment, and different solutions are popping out at a rather extreme rate.</p>
<p>The decision to write about mainly about gems was bold but necessary, and I&#8217;d really like to see more authors doing that, but with extra care. From reading this book, you understand that there&#8217;s no <em>silver bullet</em> when it comes to Distributed Programming, but rather different tools to do different jobs.</p>
<p>The thing I missed the most? A proper conclusion to the book. You&#8217;re left with two chapter about Rails-specific libraries which could have easily become appendixes, and nothing else. I would have liked a sort of &#8220;summing up&#8221; end chapter (re-)highlighting the pros and cons of each library and a sort of feature matrix.</p>
<p>Nevertheless, it was well worth my time and it proved to be a very good resource to get started in writing distributed Ruby programs.</p>

</section>

</section>]]>
    </content>
  </entry>
  <entry>
    <id>tag:www.h3rald.com,2010-04-25:/articles/succeeding-with-agile-review/</id>
    <title>Book Review: Succeeding with Agile</title>
    <published>2010-04-25T12:16:28Z</published>
    <updated>2011-03-27T11:41:30Z</updated>
    <link rel="alternate" href="http://www.h3rald.com/articles/succeeding-with-agile-review/"/>
    <category term="review" scheme="http://www.h3rald.com/tags/review/"/>
    <category term="productivity" scheme="http://www.h3rald.com/tags/productivity/"/>
    <category term="books" scheme="http://www.h3rald.com/tags/books/"/>
    <category term="software" scheme="http://www.h3rald.com/tags/software/"/>
    <content type="html">
<![CDATA[

		<section class="section">
<blockquote>
<p>&#8220;This is not a book for those who are completely new to <em>Scrum</em> or <em>agile</em>. There are other books, classes, and even websites for that. If you are completely new to <em>Scrum</em>, start with one of those.&#8221;</p>
</blockquote>
<p style="padding-left:5em;">&#8212; Mike Cohn, <em>Succeeding with Agile</em></p>
<p>Great. That&#8217;s just great. Good job I started with the <em>Introduction</em> first, otherwise the first chapters of this book would have been way too overwhelming!</p>
<p><a href="http://www.succeedingwithagile.com/"><em>Succeeding with Agile</em></a> is a book that <em>doesn&#8217;t</em> teach you about <em>Scrum</em> or <em>agile</em> methodologies, it won&#8217;t give you a definition of ScrumMaster, sprint, or backlog&#8230; instead, it takes all that for granted and teaches how to pragmatically adopt &#8212; or better, <acronym title="Awareness, Desire, Ability, Promotion, Transfer"><span class="caps">ADAPT</span></acronym> to &#8212; <em>Scrum</em>, in the context of yourself, your team, and even your entire organization.</p>
<blockquote>
<p>&#8220;[&#8230;] this book draws on my experience with <em>Scrum</em> over the past 15 years, but especialle the last 4. For the last 4 years, every evening after I spent the day with one of my clients, I would go back to my hotel room and make notes about problems they were facing, the question they asked, and the advice I gave.&#8221;</p>
</blockquote>
<p>Indeed, this book is a gold mine of information, anecdotes, tips and tricks about everything you could possibly want to know about making <em>Scrum</em> work, at any level. If you have some knowledge about <em>agile</em> development you definitely have some questions: <em>will it work?</em> &#8230; <em>is it really more productive?</em> &#8230; <em>how can I make my boss understant this?</em>. This book has all the answers you need. Most definitely, it also answer questions you didn&#8217;t think of.</p>
<p>If you don&#8217;t know what all this is about, then you&#8217;d better do your homework first:</p>
<ul>
	<li><a href="http://www.mountaingoatsoftware.com/topics/scrum">Introduction to <em>Scrum</em> &#8211; An Agile Process</a></li>
	<li><a href="http://en.wikipedia.org/wiki/_Scrum__(development)"><em>Scrum</em> (Wikipedia Page)</a></li>
	<li><a href="http://www.scrumalliance.org/"><em>Scrum</em> Alliance</a></li>
	<li><a href="http://www.scrum.org/"><em>Scrum</em>.org</a></li>
</ul>

<section class="section">
<header><h1 id="h_1">Overview</h1></header>
<img src="/img/pictures/succeeding-with-agile.jpg" style="float:left;" />
<p>The book is organized into five parts of different length, ranging from 20 to over 100 pages. If you read the book from the start till the very end, you&#8217;ll notice that the start of each part is like a new milestone in <em>Scrum</em> adoption: first the author makes sure that <em>you</em> are prepared (Part 1), then moves on to deal with individuals and initial resistance (Part 2), then teams (Part 3) and finally the whole organization (Part 4), until you can finally taste the fruits of you labor (Part 5).</p>
<p>In a way, you may well want to carry this book in your briefcase every day you go to work, and read it bit by bit, as you make progress in your quest for <em>Scrum</em> adoption.</p>

	<section class="section">
<header><h1 id="h_2">Part I: Getting Started</h1></header>
<p>Part I is about making sure you know <em>why</em> becoming gile is important and beneficial to you and your work environment. It will teach you how to promote <em>Scrum</em>, its advantages and challenges, and the different ways to go about it: Start Small or Go All In? Stealth or Public Display? Things like that. Pointless theory? Not really: everything is well documented, with success stories to support one way or the other.</p>

</section>	 

	<section class="section">
<header><h1 id="h_3">Part II: Individuals</h1></header>
<p>This part was very interesting from a psychological point of view: it deals with individuals and their possible reactions to becoming <em>agile</em>. You&#8217;ll meet <em>skeptics</em>, <em>followers</em>, <em>saboteurs</em> and <em>diehards</em> &#8212; no hope? Well, of course not: you&#8217;ll learn how to deal with each one of them in the best way possible. This part will also introduce you to new roles and responsabilities related to <em>Scrum</em>.</p>

</section> 

	<section class="section">
<header><h1 id="h_4">Part III: Teams</h1></header>
<p>Up next, Teams. You&#8217;re no longer dealing with single-minded individuals, but with more complex groups. New challenges emerge, mostly related to communication and people interactions. I particularly enjoyed <strong>Chapter 13 &#8212; The Product Backlog</strong>, which provides invaluable insights on this important everyday tool. <strong>Chapter 15 &#8212; Planning</strong> is another interesting read: it teaches you a lot about planning vs. estimating, and coming to compromises to meet deadlines.</p>

</section> 

	<section class="section">
<header><h1 id="h_5">Part IV: The Organization</h1></header>
<p>If you made it up to here, then you&#8217;re nearly done. You probably know most of the tricks by now, but there&#8217;s still a lot to learn. <strong>Chapter 17 &#8212; Scaling <em>Scrum</em></strong> is definitely worth reading, even just for the analysis between <em>formal</em> and <em>informal communities</em>, while <strong>Chapter 19 &#8212;Cohexisting with Other Approaches</strong> almost feels heretical at times: mixing <em>Scrum</em> with Waterfall? Is that even conceivable? Yes. Sometimes it&#8217;s the only way, especially when you have to deal with compliance to standards like ISO9001. Once again, the author has a nice success story on how a company passed an ISO9001 audit by providing documentation in form of photocopied notes and by adding a single failing test to persuade the auditor that the automated test suite was not rigged. Priceless.</p>

</section> 

	<section class="section">
<header><h1 id="h_6">Part V: Next Steps</h1></header>
<p>Only two chapters in this part of the book, which mainly deals with (self) assessment and progress analysis. Still worth a read, but you can safely leave it out for when you succeeded with <em>agile</em>.</p>

</section>

</section> 

<section class="section">
<header><h1 id="h_7">Technical Analysis</h1></header>
<p>I&#8217;m not exaggerating when I say that this is <em>by far</em> the best book I&#8217;ve read in the past few years when it comes to the way it is organized. Start by reading the <a href="http://my.safaribooksonline.com/9780321660534?portal=informit">table of contents</a>: if you take each chapter out and make a bulletted list of each section you&#8217;ll end up with a handy (and free!) cheat sheet on how to promote and adopt Agile methodologies.</p>
<p>This doesn&#8217;t mean the book isn&#8217;t a worthwhile read, but rather that it can also be used as a reference when needed.</p>

<section class="section">
<header><h1 id="h_8">Formatting and Readability</h1></header>
<p>From a technical writing point of view, this book is spotless. I should keep it on my desk to remind me how technical documentation should be written, except that&#8230; it&#8217;s not a technical manual of course. But the formatting and the way content is laid out can make the most skilled technical writer very jealous: there&#8217;s never a huge blob of boring text, never a series of pointless pictures: Mike Cohn (or his editors) did a terrific job composing this book.</p>
<p>You can start reading it from any point and it still makes sense, diagrams are simple and clear, and yet extremely useful, and so are the reference tables and spreadsheets. They never hurt, they are always in the right place, at the right time. And bold text is aptly used at the start of list items, so that even if you skim through the key concepts will still make it to your brain. Excellent.</p>

</section>

<section class="section">
<header><h1 id="h_9">Style and Contents</h1></header>
<p>Reading this book is like listening to a seminar hold by some charismatic icon like <a href="http://en.wikipedia.org/wiki/David_Allen_(author)">David Allen</a> or <a href="http://en.wikipedia.org/wiki/JoAnn_Hackos">JoAnn Hackos</a>: you never get bored, and you constantly learn something. Mike&#8217;s informal and conversational style is one of the main reasons why you should read this book instead of others on the subject: he is a great communicator, and he knows how to make his point across.</p>
<p>As an added value, Mike also uses two types of <em>boxes</em> throughout the book:</p>
<ul>
	<li><strong>Things to try now</strong> &#8212; Whenever a new strategy or practice is introduced, you&#8217;ll find one of these boxes containing a bulleted list. <em>&#8220;Commit to running the next two or three sprints without any overtime&#8221;</em>, &#8220;Do you understand what motivates every other person on your team? If not, find out. How? Ask them.&#8221;, &#8230; these are just examples of some of the author&#8217;s reccommendations to put you in the right track.</li>
	<li><strong>Objection</strong> &#8212; Either actual quotes from customers and employees, or possible statements which may come out throughout the process of adopting <em>Scrum</em>. Things like <em>&#8220;If the product includes less than what we&#8217;ve planned, no one will buy it&#8221;</em>, or <em>&#8220;My team won&#8217;t self organize; team members are too passive and look to me to lead&#8221;</em>, &#8230; of course, what makes these objection boxes valuable is not the statement themselves, but the tips on how what to do about them. There&#8217;s not a single one left unanswered: you really feel you&#8217;re covered in any situation.</li>
</ul>

</section>

</section>

<section class="section">
<header><h1 id="h_10">Final Thoughts</h1></header>
<p>I really enjoyed this book. It took me ages to read it, not only because it&#8217;s quite long (450 pages), but also because it&#8217;s very dense of information. Another author could have made it three times longer, but I was glad Mike didn&#8217;t. I&#8217;m pretty certain I&#8217;ll keep it near me and read bits from it when I need to: it&#8217;s pretty much the Bible of <em>Scrum</em> adoption.</p>
<p>What&#8217;s wrong with it then? Not much. Perhaps the only thing I really missed was an introductory 50-page-chapter on <em>Scrum</em> and <em>agile</em>. I know this is not meant to be a book for beginners, but some basic glossary or <em>Scrum</em> cheat sheet would have made it accessible to an even wider audience, at virtually no cost for the author or the readers, who could have just skipped that part.</p>
<p>Anyhow, I give it a 9 out of 10.</p>

</section>

</section>]]>
    </content>
  </entry>
  <entry>
    <id>tag:www.h3rald.com,2010-01-22:/articles/refactoring-ruby-edition-review/</id>
    <title>Book Review: Refactoring - Ruby Edition</title>
    <published>2010-01-22T14:40:36Z</published>
    <updated>2010-01-22T18:01:58Z</updated>
    <link rel="alternate" href="http://www.h3rald.com/articles/refactoring-ruby-edition-review/"/>
    <category term="ruby" scheme="http://www.h3rald.com/tags/ruby/"/>
    <category term="books" scheme="http://www.h3rald.com/tags/books/"/>
    <category term="review" scheme="http://www.h3rald.com/tags/review/"/>
    <content type="html">
<![CDATA[
<p>Refactoring, like testing, is an activity that should be very familiar to all programmers, especially Rubyists. Actually, programs written in Ruby don&#8217;t need as many refactorings as, say, Java programs. However Rubyists are traditionally more <span class="caps">TDD</span> oriented and they like writing clear and elegant code.</p>
<p><a href="http://www.informit.com/store/product.aspx?isbn=0321603508">Refactoring: Ruby Edition</a> is actually a rewrite of the more revolutionary &#8212; at the time &#8212; <a href="http://www.informit.com/store/product.aspx?isbn=0201485672">Refactoring: Improving the Design of Existing Code</a>, written by Martin Fowler &amp; others to teach Java programmers about refactoring. Jay Fields and others decided to <em>port</em> this historical title to Ruby to fill a gap: there was no authoritative book about refactoring for this language, so what&#8217;s better than translating the Bible on the subject?</p>
<p>If you already own the Java book you shouldn&#8217;t buy this one. This is not my personal opinion (I never read the original), it&#8217;s actually written in the Preface of the book itself. I really like honest authors, and luckily this seems to have become a trend, lately: programmers don&#8217;t like reading bullshit after all. By the authors&#8217; own admission, this book contains roughly the same material and the same examples of the original Java book, plus some slightly more Ruby-specific content.</p>
<h3>Getting started</h3>
<p style="float:right;"><img src="/img/pictures/refactoring-ruby-ed.jpg" alt="" /></p>
<p>The first chapter, <em>Refactoring, a first example</em>, is not a first chapter. Well, it is in a literal sense, but it doesn&#8217;t look like one: no theory, no padding, you&#8217;re immediately thrown in the middle of the battle, dealing with a small program in desperate need of refactoring. It literally contains quite a lot of code: the same program is rewritten over and over with changes in bold to teach you what refactoring means. The most intimidating thing is reading names of refactoring techniques capitalized and used in a natural way, like if the reader was supposed to know them already. In all fairness though, they are self-explanatory most of the time, e.g. <em>Replace Array with Object</em>.</p>
<p>What makes this chapter even more unusual is the clever usage of white space: <em>before</em> and <em>after</em> code snippets are shown on separate page, which makes it much more immediate to see the changes in code (but it won&#8217;t work very well if you bought the ebook instead of the hardback).</p>
<p>By contrast, the second chapter <em>Principles in Refactoring</em> is all about theory: it should have been the first chapter, but it&#8217;s better this way. Here you&#8217;ll learn the basics: a bit of history, when to refactor and when not to, and so on. I bet it was taken almost verbatim from the Java book; see for example: <em>&#8220;[&#8230;] If your building APIs for outsid consumption, as <strong>Sun</strong> does [&#8230;]&#8221;</em>.</p>
<p>Chapter 3, <em>Bad Smells in Code</em>, is probably the most important and useful chapter in the entire book. It&#8217;s somethig you should read over and over until you can spot a code smell right after coding.</p>
<blockquote>
<p>&#8220;You should use this chapter and the table on the inside back cover as a way to give you inspiration whn you&#8217;re not sure what refactorings to do.&#8221;</p>
</blockquote>
<p>Precisely what you have to do. Except that there is no table on the inside back cover, so I guess <a href="http://docs.google.com/viewer?url=http://www.industriallogic.com/papers/smellstorefactorings.pdf">this one</a> will have to do. Pity.</p>
<p>Chapter 4, <em>Building Tests</em>, is the usual, compulsory chapter about unit testing, i.e. the usual intro to Test::Unit. As I said, it&#8217;s essential for the book to make sense, but you can safely skip it if you know how to test already.</p>
<p>Finally, chapter 5 (<em>Toward a Catalog of Refactoring</em>) is a 2.5 page intro to the bulk of the book, nothing more than glue to ease the transition. I would have removed it completely, but that&#8217;s because I&#8217;m a merciless technical writer I guess.</p>
<h3>Diving in</h3>
<p>From chapter 6 onwards, specific refactoring techniques are described. Each chapter starts with a brief overview of the following sections (which should have been a list, but I&#8217;m just being pedantic now), so you know what to expect.</p>
<p>Each technique described has a very meaningful and immediate name that reflects its purpose, like Extract Method or Split Temporary Variable. A code example introduces the code smell and the proposed refactoring, followed by a <em>Mechanics</em> section with a list of actions to perform and an explanatory <em>Motivation</em> section.</p>
<p>Tipically, each refactoring has its own, self-contained code snippets. Depending on the complexity of the refactoring technique examined, the authors may spend half to five or six pages just to show all code iterations to get to the result. When things get too complicated, <span class="caps">UML</span> diagrams are used to make the technique easier to understand, but only when it&#8217;s strictly necessary.</p>
<p>Even if the original techniques were though for Java, the authors (in particlar Jay Fields, I guess) do a great job making sure that the Ruby code doensn&#8217;t look like Java code in disguise: the result of the refactoring always follows Ruby&#8217;s philosophy and idioms. I particularly liked the following:</p>
<ul>
	<li>Replace Dynamic Receptor with Dynamic Method Definition (Chapter 6), a nice example of metaprogramming.</li>
	<li>Decompose Conditional/Recompose Conditional (Chapter 9), very useful and very common</li>
	<li>Replace Nested Conditional with Guard Clause (Chapter 9), another way to deal with a very common problem with conditionals</li>
	<li>Extract Module (Chapter 11), very Rubyesque way to tidy up busy classes</li>
</ul>
<p>This doesn&#8217;t mean that <em>every</em> refactoring described in the book is a programmer&#8217;s epiphany, some of the techniques are indeed pretty obvious and some portion of code in need of refactoring indeed smell very, very bad! E.g.:</p>
<ul>
	<li>Inline Class (Chapter 7): Who on Earth would ever create a class containing a single method returning a telephone number?</li>
	<li>Replace Magic Number with Symbolic Constant (Chapter 8): Why would you use integers for constants? Didn&#8217;t Matz give us Symbols to avoid just that?</li>
</ul>
<h3>The big picture</h3>
<p>By the end of chapter 11 you should be familiar with nearly all the best possible way to get rid of code smells. That&#8217;s all good, but what happens if <em>the entire program</em> stinks? Chapter 12 (<em>Big Refactorings</em>) claims to have some answers to some common pitfalls. The techniques defined in this chapter are by no means sufficient to solve all problems caused by bad design, but they can help especially to rewrite legacy code, or programs developed by Ruby newbies:</p>
<ul>
	<li>Tease Apart Inheritance</li>
	<li>Convert procedural design to objects</li>
	<li>Separate domain from presentation</li>
	<li>Extract hierarchy</li>
</ul>
<p>They are basically all about reducing bloat and unnecessary complexity, and &#8212; to me, that is &#8212; they all sounded pretty obvious. <em>Of course</em> I&#8217;m going to separate domain from presentation! Didn&#8217;t Rails teach us anything at all? I must say I was somehow disappointed by this chapter. I was going to bet there was something slightly more advanced, maybe something about replacing traditional object instantiation with an internal <span class="caps">DSL</span>? Nope, sorry.</p>
<p>Chapter 13, on the other hand, is an excellent conclusion to the book: it really helps the reader to understand when to refactor and how to do so, depending on the situation.</p>
<h3>Conclusion</h3>
<p>This and <a href="http://www.h3rald.com/articles/design-patterns-in-ruby-review/">Design Patterns in Ruby</a> are now my favorite Ruby books. I believe they complete each other: Russ Olsen&#8217;s book is more about designing your programs properly from the start, while <em>Refactoring: Ruby Edition</em> can help to make things better at a lower level. <br />
Ruby developers don&#8217;t need to refactor as much as Java developers, mainly because of Ruby itself, nevertheless, this is an excellent read for anyone who wants to get serious about programming in Ruby, and is determined to do so by following the Ruby Way.</p>
<p>I&#8217;ll definitely keep this book near me when I&#8217;m coding: I do believe it is much more helpful when you start using it as a reference, when you already read about all the refactoring techniques and want to put them in practice. Also, I&#8217;ll probably re-read chapter 3 on a regular basis, to get accustomed to recognize code smells, and deal with them accordingly.</p>]]>
    </content>
  </entry>
  <entry>
    <id>tag:www.h3rald.com,2009-11-17:/articles/the-merb-way-review/</id>
    <title>Book Review: The Merb Way</title>
    <published>2009-11-17T10:15:36Z</published>
    <updated>2009-11-17T12:26:56Z</updated>
    <link rel="alternate" href="http://www.h3rald.com/articles/the-merb-way-review/"/>
    <category term="ruby" scheme="http://www.h3rald.com/tags/ruby/"/>
    <category term="books" scheme="http://www.h3rald.com/tags/books/"/>
    <category term="review" scheme="http://www.h3rald.com/tags/review/"/>
    <content type="html">
<![CDATA[
<p>When I first picked up this book I was surprised by its length. Somehow, after reading <a href="/articles/the-rails-way-review">The Rails Way</a>, I got stuck in my mind that <a href="http://my.safaribooksonline.com/9780321601636">The Merb Way</a> had to be almost equally voluminous. Instead, this book is about 300 page long, roughly as long as the sum of the chapters devoted to <em>ActiveRecord</em> in Obie Fernandez&#8217;s acclaimed Rails bible.</p>
<p>Apparently it only takes 300 pages to describe a web framework nowadays! I couldn&#8217;t help but feeling a bit skeptical at first. Even in the foreword, Obie Fernandez presents the book &ndash; and the whole <a href="http://www.merbivore.com">Merb</a> framework &ndash; with some initial skepticism: isn&#8217;t Ruby on Rails enough? Why do we need yet another Ruby web framework? And above all, seeing that Merb is going to eventually be <a href="http://weblog.rubyonrails.org/2008/12/23/merb-gets-merged-into-rails-3">merged into Rails 3</a>, why on Earth do we need a book about Merb, <em>now</em>?</p>
<p>Needless to say, Foy Savas proved that both Merb and its book cannot be dismissed just like that.</p>
<h3>Getting started</h3>
<p style="float:right;"><img src="/img/pictures/therailsway.jpg" alt="" /></p>
<p>The book starts with the original <a href="http://pastie.org/14416">Merb Pastie</a>, a single page of Ruby code able to sort out <span class="caps">HTTP</span> requests, dispatch them to the appropriate controllers and render a web page. This piece of code is enough to convey what Merb is: a new breed of web framework, almost as simple as it can get but very poweful and flexible at the same time.</p>
<p>As you start diving in through the first chapter, you realize you&#8217;re reading about a <em>Hacker&#8217;s Web Framework</em>. That&#8217;s precisely what Merb is: a very versatile tool to get the job done, in the simplest way possible. Similarly, <em>The Merb Way</em> immediately feels like a <em>Hacker&#8217;s Handbook</em> rather than an ordinary guide on how to develop web applications. You won&#8217;t learn what <span class="caps">MVC</span> is by reading this book, and don&#8217;t expect to be taught what a <em>mixin</em> is; you are reading a book about a Ruby web framework that was born after the <em>Rails Revolution</em>, so it is safe (for the author) to assume that:</p>
<ul>
	<li>You know the Ruby programming language</li>
	<li>You know what Ruby on Rails is and you tried it out, at the very least</li>
</ul>
<p>The first few chapters are about the core functionalities provided by an an <span class="caps">MVC</span> framework: after a comprehensive first chapter about Merb&#8217;s fundamentals (from the layout of a Merb application to an overview of Merb internals) you are quite abruptly &#8220;introduced&#8221; to routing, controllers, views and models. These chapters do not aim to provide a comprehensive description of each component, they simply tell you: <em>here&#8217;s how Merb does this</em>.</p>
<p>Out of the first five chapters, favorite is definitely the one about <em>Models</em>. Although Merb is <span class="caps">ORM</span>-agnostic, DataMapper is the <em>de facto standard</em> for Merb applications, and it fully embrace the framework&#8217;s design and extreme flexibility without being <em>in the way</em> of your code.<br />
Foy does an excellent job in this chapter by strategically describing DataMapper&#8217;s code from the top to the very bottom, from the highest abstractions to raw <span class="caps">SQL</span> code, using a plethora of snippets taken from the actual Merb code.</p>
<h3>It&#8217;s about how Merb works, not how to work with Merb</h3>
<p>After reading the <em>Models</em> chapter I decided to go back and re-examine the previous chapters. I didn&#8217;t notice until then, but the author sneakily <em>smuggled</em> a consistent amount of Merb source code into this book. This is rather unusual for books about web frameworks: they normally tell you how to use the framework, not how it was built! While this can be disappointing for people used to read Rails books, it came as a very pleasant surprise to me.</p>
<p>About 40-50% of this entire book (and I&#8217;m not exaggerating) is Ruby source code. In a good way, it feels like a collection of strategically-positioned code snippets glued together with explanations of the most tricky bits and digressions on how the framework was <em>designed</em>. In other words, it probably contains just enough text to make sure that the average reader understands the code, but remember that the <em>average reader</em> of this book must know Ruby failry well.</p>
<p>There is no pointless prose in this book, no explanations of obvious methods, no fancy words, no useless boasting on how cool the framework is: just an objective description of how Merb works and of the key design decisions behind it. If I may, the only thing that doesn&#8217;t feel quite right with this book is its title: <em>Merb Internals</em> would have been a better choice. Once you realize this, the book suddenly makes sense, and can even make you a better Ruby programmer.</p>
<p><em>The Merb Way</em> does an excellent job in describing how to design a web framework, or any real-world Ruby application for that matter. It teaches you that modularity is the key to flexibility by showing how the Merb stack is organized. Sure, it doesn&#8217;t teach you how to create a blog in five minutes, but perhaps a thorough explanation of how anthentication is implemented (Chapter 9) will actually be useful in two months time, when you&#8217;ll have to create your own Merb plugin from scratch.</p>
<h3>Some constructive criticism</h3>
<p>The idea behind this book is clever but a bit dangerous. I flipped through the pages in front of my wife and asked her what was wrong with it. <em>&#8220;There&#8217;s too much code!&#8221;</em> she said, without hesitation. Precisely.</p>
<p>It is damn good Ruby code, but sometimes you wish there was more text describing how to use it in practice. Or maybe some code examples on <em>using</em> the framework on a real-world application. Not a chance. Of all that holy code, there&#8217;s not much featuring something other than Merb itself. Basically the exact opposite of all the other books about Rails or other web frameworks!</p>
<p>Even accepting the fact that you are not reading a book about developing web applications, there are two more things which could be improved:</p>
<ul>
	<li>Merb&#8217;s design is very intriguing, and you grasp the essentials by reading this book, but a few diagrams here and there and more in-depth digressions on the subjects would have been nice.</li>
	<li>Besides DataMapper, what I really wanted to read about were Slices and Parts &ndash; unfortunately the chapters about them are far too short and shallow. The reasoning behind this is that <em>their future may be uncertain</em> due to the Rails 3 merge. Pity.</li>
</ul>
<h3>Conclusion</h3>
<p>The death of Merb has been greatly exaggerated. Too bad I <a href="/articles/take-back-your-site-with-nanoc/">gave up web frameworks altogether</a> for my site, because after reading this book I would have gone for Merb <em>today</em> rather than waiting to see the wonders of Rails 3 <em>tomorrow</em>. Even a book with this title could have been written in a very different way, I would still recommend it if you want to become a better Ruby programmer by learning from the best: Merb code really stands out, even compared to Rails, and Foy Savas does a great job presenting and describing it.</p>]]>
    </content>
  </entry>
  <entry>
    <id>tag:www.h3rald.com,2009-04-27:/articles/log-apr-2009/</id>
    <title>Personal Log - April 2009</title>
    <published>2009-04-28T04:11:00Z</published>
    <updated>2009-09-06T18:10:45Z</updated>
    <link rel="alternate" href="http://www.h3rald.com/articles/log-apr-2009/"/>
    <category term="personal_log" scheme="http://www.h3rald.com/tags/personal_log/"/>
    <category term="ruby" scheme="http://www.h3rald.com/tags/ruby/"/>
    <category term="books" scheme="http://www.h3rald.com/tags/books/"/>
    <category term="wedding" scheme="http://www.h3rald.com/tags/wedding/"/>
    <content type="html">
<![CDATA[
<p>April is tratidionally a rather busy month: Easter, public holidays, and &mdash; always &mdash; some deadline to meet at work. Moreover, my birthday is also in April which makes it even more busy! Let&#8217;s see what happened this year&#8230;h3. Using Ruby in a corporate environment</p>
<p>I&#8217;ve been using Ruby at work for a while now. I started off writing some automation script for my own needs, then someone noticed it and asked me if by chance I could develop some scripts for them, for automating part of their own job, and so on. My boss ultimately noticed it, and she liked the idea of me investing a small portion of my time to make other people save huge amount of <em>their</em> time, so now I am <em>officially</em> in charge of workflow improvements and automation (it&#8217;s even in my job description!).</p>
<p>This month a colleague of mine and I had to figure out a way to write some documents <strong>once</strong> in <span class="caps">XML</span> format and then produce different kind of outputs (other <span class="caps">XML</span> files, PDFs, etc.) using the <a href="http://dita-ot.sourceforge.net/"><span class="caps">DITA</span> Open Toolkit</a>. Originally we thought the toolkit would do most of the job, but we soon realized we needed to tweak and change a lot more than what we usually expected.</p>
<p>We ended up hacking together a <em>system</em> using:</p>
<ul>
	<li><a href="http://office.microsoft.com/en-us/infopath/default.aspx">Microsoft Infopath</a> as <span class="caps">XML</span> editor for the end users (the company buys it by default, so no worries there)</li>
	<li>A Ruby program to parse and manipulate the original <span class="caps">XML</span> and produce <span class="caps">DITA</span>-compatible <span class="caps">XML</span> files.</li>
	<li>Some <a href="http://ant.apache.org/">Apache Ant</a> tasks available in the open toolkit to produce an <span class="caps">XSL</span>-FO file</li>
	<li><a href="http://xmlgraphics.apache.org/fop/">Apache <span class="caps">FOP</span></a> to produce the <span class="caps">PDF</span> from the <span class="caps">XSL</span>-FO file&#8230;</li>
</ul>
<p>The thing seems to work fine (after a lot of tweaking), and I really enjoyed creating the Ruby program to <em>glue</em> everything together. I even got a chance to introduce my colleagues to the wonderful world of <a href="http://hobix.com/textile/">Textile</a> (they are so happy that they don&#8217;t want to use <span class="caps">WYSIWYG</span> editors anymore!).</p>
<h3>Easter in London</h3>
<p>As usual, Roxanne and I spent our Easter holidays in London, at her brother&#8217;s place. This year we actually had 9 days to go around <del>squandering money</del>  spending <em>wisely</em> in food, books, clothes and entertainment.</p>
<p>Most notably, I managed to drag Roxanne to <a href="http://www.foyles.co.uk/">Foyles</a> and I got myself a copy of <a href="http://www.pragprog.com/the-pragmatic-programmer">The Pragmatic Programmer</a>, which I&#8217;m reading avidly. If it was up to me I was going to buy half of the computing section, but Roxanne <em>kindly pointed out</em> that I could get all of them from Amazon for half the price. <br />
And she was right: for my birthday I preordered a copy of <a href="http://www.amazon.com/Programming-Language-Pragmatics-Third-Michael/dp/0123745144">Programming Language Pragmatics, 3rd Ed.</a>, which should be shipped soon.</p>
<h3>Wedding planning</h3>
<p>My spreadsheets for the wedding guests, wedding expenses (!) and &#8230;suit sizes are getting bigger and bigger. We managed to book a lot of flights to Ireland to my parents, us, relatives etc., but there are still quite a few things to do for the wedding. The most urgent thing to do right now is sending the invites: we had them printed with the words <em><span class="caps">RSVP</span> within May</em> on them, so they <em>have</em> to be out in one or two weeks at most.</p>
<p>The other thing which must be sorted soon are the suits. According to English (and Irish) tradition, the groom, the bestman, the father of the groom, the father  of the bride and the ushers have to wear the same type of suit, with minor differences (the color of the waistcoats?). In my case, this means getting 7 (<span class="caps">SEVEN</span>) <em>morning suits</em> off eBay, in the right sizes! Hopefully I&#8217;ll be able to get them by the end of next week (if my bestman manages to let me know his sizes).</p>
<h3>XBox 360 Gaming</h3>
<p>Now that our new XBox 360 finally came through, Roxanne and I have a lot of hours of hard core week end gaming ahead of us! This, added to the physiological increase of stress due to the wedding, may result in a temporary slowdown of my coding and writing activities.<br />
Right now we&#8217;re playing <a href="http://xbox360.ign.com/objects/949/949455.html">Mirror&#8217;s Edge</a>, <a href="http://xbox360.ign.com/objects/718/718963.html">Mass Effect</a>, and <a href="http://xbox360.ign.com/objects/746/746631.html">Unreal Tournment <span class="caps">III</span></a>. The last one was a special surprise present from Roxanne (<em>&#8220;&#8230;so we can kill each other!&#8221;</em> &mdash; she&#8217;s really lovely at times!).</p>
<h3>Other tech-related tidbits</h3>
<ul>
	<li>I can&#8217;t wait to go to the cinema to watch <a href="http://www.imdb.com/title/tt0796366/">Star Trek XI</a></li>
	<li>I started using <a href="http://www.shelfari.com/">Shelfari</a></li>
	<li>I started using <a href="http://start.io">Star.io</a> as my personal, bare-bones start page.</li>
	<li>I recently <a href="http://www.h3rald.com/articles/concatenative-020">released Concatenative 0.2.0</a>.</li>
	<li>I&#8217;m currently evaluating the possibility to create a Ruby-based <em>Document Authoring Framework</em>. Stay tuned.</li>
</ul>]]>
    </content>
  </entry>
  <entry>
    <id>tag:www.h3rald.com,2009-01-04:/articles/the-rails-way-review/</id>
    <title>Book Review: The Rails Way</title>
    <published>2009-01-04T08:03:00Z</published>
    <updated>2009-11-17T11:12:53Z</updated>
    <link rel="alternate" href="http://www.h3rald.com/articles/the-rails-way-review/"/>
    <category term="rails" scheme="http://www.h3rald.com/tags/rails/"/>
    <category term="books" scheme="http://www.h3rald.com/tags/books/"/>
    <category term="review" scheme="http://www.h3rald.com/tags/review/"/>
    <content type="html">
<![CDATA[
<blockquote>
    <p>"Programming books are pointless: you buy them, you read them and you chuck them because they're already out-of-date!"</p>
</blockquote>

<p>This is a quote from my fiancée, who always pointed out the ephemeral nature of programming books and therefore <em>highly discouraged me</em> from buying any more. The sad thing is that this is partly true: if you buy a new programming book it <em>will</em> eventually become outdated pretty quickly, especially if it's about newish technologies like <a href="http://rubyonrails.org/">Ruby on Rails</a>.  </p>

<p><em><a href="http://www.informit.com/store/product.aspx?isbn=0321445619">The Rails Way</a></em> is no exception: Rails 2.2 has been out for a while and introduced a few new features &ndash; most notably Internationalization support &ndash; which are not mentioned neither in this book nor in others.</p>

<p>That being said, <em>The Rails Way</em> by <a href="http://obiefernandez.com/">Obie Fernandez</a> is still the best and most comprehensive book on Rails v2 currently on the market. It's the book you simply cannot afford to ignore, if you are using (or are planning to use) this popular Ruby web framework.</p>

<h3>Contents</h3>

<div style="float:right"><img src="/files/therailsway.jpeg" alt="cover" /></div>

<p>Before proceeding any further, I'd like to point out that is probably one of the longest programming books I've ever come across. With its 910 pages, <em>The Rails Way</em> definitely cannot fit in your pocket and you cannot take it around with you easily. It's a book made to sit on your desk constantly and remain there, ready to be accessed at the right time, when needed. 
Unlike with other books I reviewed, this time I won't even attempt to go through every chapter and every section: it would not be meaningful for the review and it will probably bore you to death. For completeness' sake, however, here's a very trimmed-down table of contents listing <em>only</em> the first level headings:</p>

<ul>
<li>Introduction</li>
<li>Chapter 1 - Rails Environment and Configurations  </li>
<li>Chapter 2 - Working with Controllers  </li>
<li>Chapter 3 - Routing  </li>
<li>Chapter 4 - REST, Resources, and Rails  </li>
<li>Chapter 5 - Reflecting on Rails Routing  </li>
<li>Chapter 6 - Working with ActiveRecord  </li>
<li>Chapter 7 - ActiveRecord Associations  </li>
<li>Chapter 8 - ActiveRecord Validations  </li>
<li>Chapter 9 - Advanced ActiveRecord  </li>
<li>Chapter 10 - ActionView  </li>
<li>Chapter 11 - All About Helpers  </li>
<li>Chapter 12 - Ajax on Rails  </li>
<li>Chapter 13 - Session Management  </li>
<li>Chapter 14 - Login and Authentication  </li>
<li>Chapter 15 - XML and ActiveResource  </li>
<li>Chapter 16 - ActionMailer  </li>
<li>Chapter 17 - Testing  </li>
<li>Chapter 18 - RSpec on Rails  </li>
<li>Chapter 19 - Extending Rails with Plugins  </li>
<li>Chapter 20 - Rails Production Configurations  </li>
<li>Chapter 21 - Capistrano  </li>
<li>Chapter 22 - Background Processing  </li>
<li>Appendix A ActiveSupport API Reference</li>
<li>Appendix B Rails Essentials</li>
<li>Afterword What Is the Rails Way (To You)?</li>
</ul>

<p>If you already know <em>Rails</em>, these titles will be self-explanatory to you. If not, you'll just have to trust my words when I say that this book covers every possible aspect of the framework, and 99% of the notions you need to know to start developing almost any Rails-powered web application.</p>

<p>What really pleased me were chapters 17 through 22, i.e. something <em>not</em> strictly related to Rails Core. Normally, books about Ruby and Ruby on Rails don't deal with anything even a little bit outside their scope: as a result, topics such as Rubygems, RSpec and Capistrano are often not mentioned at all, or if they are, they are relegated to one or two pages at maximum, leaving the reader to look on the Internet for more information. 
By contrast, <em>The Rails Way</em> covers these ancillary but still very important topics very in-depth. Sure, you won't know the inside-out of RSpec after reading this book (although a whole chapter is devoted to it), but you will certanly know your way around it <em>enough</em> to use it properly.</p>

<p>What's missing in this book then? Maybe a <em>Chapter 0</em> to guide the absolute beginner through the very basics of Rails and Ruby. Probably this goes beyond the scope of the book though, as the author clearly states that the book _"[...] is not a tutorial or basic introduction to Ruby or Rails. It is meant as a day-to-day
reference for the full-time Rails developer. "_. 
Still, 100 pages about the Magic of Scaffolding &amp; other tricks to astonish the children wouldn't have damaged the book, especially considering that Chapter 1 starts at page <em>60</em> after a lot of <em>pages intentionally left blank</em>, Introduction, Foreward, Acknowledgements and similar padding material.</p>

<h3>Organization and writing style</h3>

<blockquote>
    <p>"Before going on, I should mention that part of what makes Rails exceptional is that it is opinionated software, written by opinionated programmers. Likewise, this is an opinionated book, written by opinionated writers."</p>
</blockquote>

<p>This sentence in the <em>Introduction</em> sounded very familiar. Almost an echo of Zed Shaw's own words in the <em><a href="http://www.h3rald.com/articles/mongrel-shortcut-review">Mongrel Digital Shortcut</a></em>. After all this book is part of the <em><a href="http://www.informit.com/imprint/series_detail.aspx?ser=2124042">Addison-Wesley Professional Ruby Series</a></em>, of which Obie is the Series Editor.
Like the other books in the series, this book contains all the stylistic conventions and distinctive features which make them very enjoyable to read:</p>

<ul>
<li><em>Informal, almost personal style</em> &ndash; reading this book is almost like hearing Obie telling you what <em>he</em> thinks about Rails, and sharing with you his own tips and tricks.</li>
<li><em>Honest, even humble at times</em> &ndash; This book doesn't glorify Rails or Ruby: on the contrary, pitfalls are acknowledged and dealt with. Rails lacks an inbuilt authentication system? No problem, a whole chapter is devoted to the <em>act_as_authenticated</em> plugin. You almost feel it's part of the core itself.</li>
<li><em>"[Person] says" sidebars</em> &ndash; The book's co-authors occasionally have their saying in special sidebars, all throughout the book. A way to evaluate different opinions and take a break from the book's main flow.</li>
<li><em>Code snippets</em> &ndash; Not too many, not too few, just about the right amount. Granted, you won't find any sample application in this book, but the snippets provided are more than enough to get to the point.</li>
</ul>

<p>Although this book is meant to be a reference, this doesn't mean it only contains reference material, it means that if you don't know about a particular feature of Rails or its satellites (Capistrano, RSpec, testing in general, etc.) you can open the book at any chapter and read through an in-depth discussion which will, most likely, answer all your questions.  </p>

<p>Even if what you're looking for is not strictly related to Rails but can just <em>be used with it</em>, you'll find it in the book. Some examples include a 23-page-long exhaustive dissertation on <a href="http://www.prototypejs.org/">Prototype</a>, a whole Chapter on RSpec, another on Capistrano and even information on XML parsing through REXML.</p>

<p>What you won't find in the book, unfortunately, is how to get something which was not meant to be seamless integrated with Rails to work, like <a href="http://jquery.com/">JQuery</a>, for example. But again, this is understandable, as such topics would have made the book three times longer, at least.</p>

<h3>Some constructive criticism</h3>

<p>As a technical writer, I was somehow unhappy of the way reference material was presented in the book, i.e. more or less as ordinary chunks of text:</p>

<blockquote>
    <p><code>execute(sql_statement)</code><br/>
    Executes the SQL statement provided in the context of this connection. This method is abstract in the DatabaseStatements module and is overridden by specific database adapter implementations. As such, the return type is a result set object cor-
    responding to the adapter in use.</p>
    
    <p><code>insert(sql_statement)</code><br/>
    Executes an SQL INSERT statement and returns the last autogenerated ID from the affected table.</p>
</blockquote>

<p>You'll find plenty of pages like this in the book. Although all essential the information about each specific method is there, it is not organized properly. When I'm coding and I want to look up something quick, chances are that I can just hop over to <a href="http://apidock.com/rails">APIdock</a> or other similar services and query Rails documentation in a much more efficient way.<br/>
On the other end, if reference material was added for completeness' sake, it would have been much better included at the end of the book, more succinctly, through some carefully constructed reference tables. If the aim was instead to help the reader memorize all the method he <em>must</em> know to work productively with Rails everyday, the author should have included some diagrams or any other type of visual aid.</p>

<p>Similarly, the <em>Stack Checklist</em> included in Chapter 20 is not actually a list at all, but rather a sequence of titled paragraphs which is definitely a good read <em>the first time</em>, but it won't be as useful when you need to just refresh your memory.</p>

<p>I admit, I noticed these things because part of my daily job as Technical Writer consists in making sure that reference material is well presented in the most minimalist, direct and useful way to the reader. Maybe a year ago I wouldn't have thought anything of it, but now I felt compelled to point this out hoping the next edition of the book will deal also with this aspect of the book. </p>

<p>Since the book came out in 2007, the organization and presentation of Rails Documentation has been significantly improved by third-party services: I hope the authors and editors will try to make sure, next time, that the reference material is more <em>usable</em> by the readers.</p>

<h3>Conclusion</h3>

<p>Overall, the book is a good read. It's even possible to read it sequentially (even if the author discourages this practice) and still get the most out of it &ndash; a rare trait in programming books nowadays.<br/>
No other book will go so in-depth about Rails or about everything you need to know to get your site up and running in a<em>real</em> production environment. That's the reason why <em>The Rails Way</em>is the perfect companion for web development professionals who must ensure their applications are tuned up to perform and scale well.</p>

<p>This doesn't mean that beginners should be discouraged from reading this book, quite the opposite. This is actually the only book newcomers to Rails need once they are done reading all those awesome beginner-oriented tutorials freely available on the Internet. Everyone interested in Rails, at some point, has to follow <em>The Rails Way</em>.</p>]]>
    </content>
  </entry>
  <entry>
    <id>tag:www.h3rald.com,2008-06-16:/articles/firefox3-revealed/</id>
    <title>Firefox 3 Revealed</title>
    <published>2008-06-17T02:46:00Z</published>
    <updated>2009-09-06T18:10:43Z</updated>
    <link rel="alternate" href="http://www.h3rald.com/articles/firefox3-revealed/"/>
    <category term="firefox" scheme="http://www.h3rald.com/tags/firefox/"/>
    <category term="browsers" scheme="http://www.h3rald.com/tags/browsers/"/>
    <category term="writing" scheme="http://www.h3rald.com/tags/writing/"/>
    <category term="review" scheme="http://www.h3rald.com/tags/review/"/>
    <category term="books" scheme="http://www.h3rald.com/tags/books/"/>
    <content type="html">
<![CDATA[
<p>When the SitePoint staff asked me to write an article summing up all the new features of Firefox 3, I gladly accepted: I wrote about Firefox before, and I thought it was just going to be a 2-3 hours job maximum. <br />
After diving deeper into Firefox 3 development, reading dozens of different blogs and scouting Mozilla&#8217;s web sites, I realized I was wrong: Firefox 3 introduced <em>a lot</em> of new things, and keeping track of all of them, I admit, was quite a hard task.</p>
<p>Nevertheless, I wrote the article and delivered it to SitePoint in time fore the release, but my editor &#8220;complained&#8221; that 8,300+ words was about 3 times over the minimum requirements for a feature article! <br />
<em>&#8220;I don&#8217;t really think that people can read the whole thing online&#8221;</em> &mdash;, he said, and I somehow agreed.</p>
<p>In the end, they decided to pack my &#8220;article&#8221; into a 30-pages <span class="caps">PDF</span> eBook which can be downloaded <em>absolutely free of charge</em> from SitePoint web site as well, so here it is:</p>
<p style="float:left;"><img src="/files/ff3-revealed.png" alt="" /></p>
<p><br /><br />
<span style="font-size: 1.5em;"> <strong><a href="http://firefox.s3.sitepoint.com/ff3-revealed.zip">Firefox 3 Revealed</a></strong> </span></p>
<p>If you prefer though, you can still read the article directly on SitePoint, <a href="http://www.sitepoint.com/article/firefox-3-whats-new-whats-hot">here</a>.</p>
<p>This guide aims to give you a comprehensive overview of virtually <em>all</em> the new features and improvements introduced by Firefox 3.</p>
<p><br /><br /></p>
<p>I would like to thank the whole SitePoint staff for giving me the opportunity to write this eBook, and in particular <strong><a href="http://magain.com/blog/">Matthew Magain</a></strong> for his help and support (and for creating the <span class="caps">PDF</span> on a Sunday evening!).<br />
Additionally, I would also like to thank the Mozilla Development Team for their awesome job with Firefox 3 and everyone else who made this eBook possible.</p>
<p><strong>Update:</strong> Feel free to <strong><a href="http://digg.com/software/FireFox_3_Revealed_Free_ebook_from_SitePoint">digg</a></strong> this eBook!</p>]]>
    </content>
  </entry>
  <entry>
    <id>tag:www.h3rald.com,2008-04-10:/articles/design-patterns-in-ruby-review/</id>
    <title>Book Review: Design Patterns in Ruby</title>
    <published>2008-04-11T03:41:00Z</published>
    <updated>2010-01-22T18:01:53Z</updated>
    <link rel="alternate" href="http://www.h3rald.com/articles/design-patterns-in-ruby-review/"/>
    <category term="ruby" scheme="http://www.h3rald.com/tags/ruby/"/>
    <category term="review" scheme="http://www.h3rald.com/tags/review/"/>
    <category term="books" scheme="http://www.h3rald.com/tags/books/"/>
    <content type="html">
<![CDATA[
<p>I finally got my hands on a shiny new copy of <em>Design Patterns in Ruby<sup class="footnote" id="fnr1"><a href="#fn1">1</a></sup></em>. The book itself is not brand new and it was already widely praised by many different people online, so I wanted to take a look for myself.</p>
<p>To my surprise, the book is a hardcover edition, which makes it look more professional and more durable than the average programming book<sup class="footnote" id="fnr2"><a href="#fn2">2</a></sup>. It&#8217;s also smaller and shorter than the average programming book<sup class="footnote" id="fnr2"><a href="#fn2">2</a></sup> (340 pages), which makes it much easier to carry around and less intimidating to read. It&#8217;s also <em>not</em> meant to be a reference book, so it is actually pleasant an easy to read all in one go, as you&#8217;ll soon find out.</p>
<p>What is it about? &mdash; well, design patters in the Ruby language of course. But it&#8217;s not the usual brainwash of programming theory you would expect by a typical book on patters, it has <em>plenty</em> of examples of real code. When I say <em>real code</em> I don&#8217;t mean the usual Dog/Cat/Horse/&lt;insert animal here&gt; classes or juke-box simulations which don&#8217;t work at all etc. etc., I mean actual snippets from well known Ruby applications, like RubyGems, FXRuby and, of course, Rails.<br />
OK well, there&#8217;s an exception perhaps: Russ <em>did</em> include a few wild life simulations (ponds with frogs and similar), but it&#8217;s only for your own good, and for the sake of tradition.</p>
<p>Anyhow, let&#8217;s start from the beginning&#8230;</p>
<h3>Part I: Patters and Ruby</h3>
<p>The first part of the book serves as a general introduction to the other two parts. If you know the basics of both design patterns and Ruby, you can safely skip this as you won&#8217;t find anything of overwhelming interest here.</p>
<p>Personally I really liked <strong>Chapter 1</strong> though, &#8220;Building better Programs with Patterns&#8221;, in which Russ does a great job in summarizing the original GoF book<sup class="footnote" id="fnr3"><a href="#fn3">3</a></sup> into four points:</p>
<p style="float:right;"><img src="/files/design_patterns_in_ruby.jpg" alt="" /></p>
<ul>
	<li><em>Separate our the things that change from those that stay the same.</em></li>
	<li><em>Program to an interface, not an implementation.</em></li>
	<li><em>Prefer composition over inheritance.</em></li>
	<li><em>Delegate, delegate, delegate.</em></li>
</ul>
<p>Also, although it does not come from the Design Patterns book but from building real systems, the author adds the <span class="caps">YAGNI</span> (You Ain&#8217;t Gonna Need It) principle<sup class="footnote" id="fnr4"><a href="#fn4">4</a></sup> as a reminder to resist the temptation of implementing things which <em>may</em> be needed <em>later on</em>, even if they are not needed right now.<br />
The chapter ends with an outline of the patterns which will be presented throughout the book: 14 out of the original 23 patterns by the Gand of Four will be discussed in Part II and 3 bonus &#8220;Ruby-only&#8221; patterns will be examined in Part <span class="caps">III</span>, as a special treat.</p>
<p><strong>Chapter 2</strong> (<em>Getting started with Ruby</em>) feels perhaps a bit out of place. As others pointed out<sup class="footnote" id="fnr5"><a href="#fn5">5</a></sup>, why does a book on advanced Ruby programming techniques include a 35-page-long introduction on the Ruby language? The answer was given by Russ himself in an interview<sup class="footnote" id="fnr6"><a href="#fn6">6</a></sup>:</p>
<blockquote>
<p>&#8220;The reason that I included the introductory chapter about Ruby in there was to make the book accessible to folks with little or no Ruby background.<br />
Now honestly, I don’t think that you could come to my book with no background in Ruby and walk away from it an expert Ruby programmer &mdash; it’s not really that kind of introductory book.<br />
But I do think that someone with experience in other languages could read my book and come away knowing about Ruby, understanding what all the shouting is about.&#8221;</p>
</blockquote>
<p>I admit, I skipped this chapter during my first reading because I was eager to move on to the main part of the book, but I did read it afterwards (I had to write this review after all!). It&#8217;s quite a nice introduction aimed at the average .<span class="caps">NET</span>/Java developer: Russ provides a step-by-step presentation of the main features of the language while holding the reader by hand when something weird or scary comes about:</p>
<blockquote>
<p>The slightly strange-looking syntax in this code is actually a tip-off something deep and important: In Ruby, everythng &mdash; and I mean <em>everything</em> &mdash; is an object.</p>
</blockquote>
<p>Of course Chapter 2 won&#8217;t turn you into a Ruby guru, but it definitely fulfills one of the author&#8217;s goals: bringing developers of other languages closer to Ruby, and give them a tiny taste of how Ruby can be <em>wickedly powerful</em>.</p>
<h3>Part II: Patterns in Ruby</h3>
<p>Part II constitutes the bulk of the book, describing 14 GoF patterns in 220 pages. The patterns covered are the following:</p>
<ul>
	<li>Template Method</li>
	<li>Strategy</li>
	<li>Observer</li>
	<li>Composite</li>
	<li>Iterator</li>
	<li>Command</li>
	<li>Adapter</li>
	<li>Proxy</li>
	<li>Decorator</li>
	<li>Singleton</li>
	<li>Factory Method</li>
	<li>Abstract Factory Method</li>
	<li>Builder</li>
	<li>Interpreter</li>
</ul>
<p>Why not covering all 23? Well, because to be honest, they are rarely used in Ruby. Furthermore, in some cases some of the ones examined in the book may feel a bit <em>unnatural</em> to the average Rubyist: how many times did you ever think about using an External Iterator when <code>each</code> is normally available as default internal iterator for any Array-like class?</p>
<p>Each chapter in this part is devoted to a particular pattern and it is organized in more or less the same way, as outlined in the following sections.</p>
<h4>Introduction and Personal Anecdotes</h4>
<p>Most chapters start with a personal anecdote involving the author: it may be a memory related to his first job at the local grocery store (Chapter 8), or about the day he decided to buy his son a bike (Chapter 14):</p>
<blockquote>
<p>&#8220;I remember the day we bought my son his first bike.&#8221; [&#8230;] I spent hours trying to pull together a minor junkiard of parts according to instructions that would have baffled the entire National Security Agency. As it turned out, picking the bike was the easy part: putting it together was the real challenge.</p>
</blockquote>
<p>This was used to introduce the Builder pattern, and how to use it to configure objects which include different logical parts.<br />
Personally I find this technique particularly useful to introduce a particular problem from a different, more mundane prospective instead of starting off with an abstract theorethical description of the pattern itself. <br />
The anecdote is then followed by the description of the actual programming problem for which the specific pattern will be used.</p>
<h4>Description of the Pattern and Initial Implementation</h4>
<p>An initial implementation of the pattern in Ruby will be provided more or less immediately after the introduction of each chapter, often accompanied by a simple <span class="caps">UML</span> diagram.<br />
This implementation normally has quite a few conceptual flaws, which are then examined and corrected step-by-step the chapter to obtain a more &#8220;Ruby-friendly&#8221; solution.</p>
<h4>A More Rubyfied Version of the Pattern</h4>
<p>The final implementation of each pattern is often very different from the initial attempt, and it may contain quite a lot of Ruby-specific code. The author does an excellent job in suggesting pattern implementations which often use blocks, <code>Proc</code> objects or method redefinitions when needed, to make the code more succint and more readable at the same time, as all Ruby code should be.</p>
<p>By doing so, even people who are still learning Ruby will understand how to use some very useful Ruby idioms which can be a bit difficult to grasp otherwise.</p>
<h4>Using and Abusing &lt;Pattern&gt;</h4>
<p>Patterns are often overused and misused, and some people normally end up wondering if they should be used at all, after all. This section (present as a matter of fact in <em>every</em> chapter of part II an <span class="caps">III</span>) examines the pitfalls of the pattern and the most common mistakes developer make when applying it.<br />
It is by far the most useful section of each chapter, and that&#8217;s what I&#8217;ll be reading and re-reading every time I&#8217;m thinking about using a particular pattern in my code. As a matter of fact, these sections make you realize that <em>every</em> pattern has its own inherent flaws and dangers, and that it is far from being a Silver Bullet. Even when you&#8217;re <em>supposed</em> to use a pattern to accomplish something, be aware that <em>something nasty</em> can happen unless you&#8217;re extra careful: this, perhaps, is the true Golden Rule conveyed throughout the whole book.</p>
<h4>&lt;Pattern&gt;s in the Wild</h4>
<p>This is another very interesting section which is included in every chapter of part II and <span class="caps">III</span>. After describing what a pattern does, how it <em>can</em> be used and how it <em>should</em> be used, you&#8217;ll finally find some interesting examples taken from real world applications.<br />
By &#8220;real world application&#8221; I mean something like ActiveRecord<sup class="footnote" id="fnr7"><a href="#fn7">7</a></sup> (Observer, Command, Adapter, &#8230;), DRb<sup class="footnote" id="fnr8"><a href="#fn8">8</a></sup> (Proxy) or FXRuby<sup class="footnote" id="fnr9"><a href="#fn9">9</a></sup> (Composite), for example, i.e. important programs and libraries which are used in production environments.<br />
Personally, I was really glad to find such examples in this book: it definitely helps you feeling design patterns as something more practical and useful than pure software architecture theories.</p>
<h4>Wrapping it Up</h4>
<p>&#8220;Wrapping it Up&#8221; is the title of the last section of each chapter of Part II and <span class="caps">III</span>. It&#8217;s basically a summary of the whole chapter and thus a useful way to recap the most important concepts. I found this section particularly useful when using the book as a design pattern reference, after reading it for the first time: this section provides a quick and essential overview of each pattern &#8212; and the most important DOs and DON&#8217;Ts, too.</p>
<h3>Part <span class="caps">III</span>: Patterns for Ruby</h3>
<p>By the time you get to Part <span class="caps">III</span> you&#8217;ll definitely feel that Ruby can do <em>more_. Some of the Ruby implementation of certain patterns described in the book make extensive use of blocks and Proc objects, and the @method</em>missing@ method (although potentially dangerous unless extra care is taken) gives us a more immediate way to obtain delegation, for example when creating Proxies. <br />
Also the fact that objects can be modified at runtime by adding and removing methods &#8220;as needed&#8221; seems quite an underused feature in traditional patterns, simply because those patterns were first conceived for languages which are very different from Ruby and are perhaps less <em>liberal</em> than Ruby when it comes to dynamic features<sup class="footnote" id="fnr10"><a href="#fn10">10</a></sup>.</p>
<p>These particular Ruby features can be used (and abused, of course) to implement more Ruby-esque patterns, such as the ones included in this part of the book:</p>
<ul>
	<li>Internal Domain-Specific Languages</li>
	<li>Meta-Programming</li>
	<li>Convention Over Configuration</li>
</ul>
<p>These are just examples, of course some may complain because the Active Record or <span class="caps">ORM</span> pattern are missing, but this is understandable as it may be considered too specific compared to the others. <br />
Each pattern is examined in detail, and I particularly like way the <span class="caps">DSL</span> pattern was described: Chapter 16 explains how to develop a simple but effective Ruby <span class="caps">DSL</span> from scratch for creating file backups. This can be particularly useful for people who never tried creating DSLs before, but also for developers who tried, but want to improve their skills.</p>
<p>Chapter 18 (Convention Over Configuration) is sufficiently clear and detailed, perhaps even too much if you already know how Rails was developed (and all the hype which follwed).</p>
<p>On the other hand, I was a bit disappointed by Chapter 17 (Meta-Programming). Maybe it&#8217;s because I built up extremely high expectations about it while reading the rest of the book, but it just felt too short and not detailed enough for my liking. If I had to write such a chapter (which would have been actually very hard), I would have started from an excellent post by Ola Bini<sup class="footnote" id="fnr11"><a href="#fn11">11</a></sup> which introduces <em>eleven</em> meta-programming techniques, and built up content and examples from there. The only reason why &#8212; I think &#8212; Russ didn&#8217;t do it in his book was length/balance constraint: a <em>properly detailed</em> chapter about meta-programming in Ruby could easily take up over forty pages!</p>
<h3>The Verdict</h3>
<p>As I said in the beginning: this is not meant to be a complete, in-depth, reference book on everything you may want to know about design patterns in Ruby. That&#8217;s why, as a matter of fact, you can actually read this book all the way through without getting utterly bored. Russ uses an informal, yet appropriate style to turn potentially complex, theorethical computer science principles into easy-to-understand, <em>useful</em> tools which can truly improve the way you code.</p>
<p>The whole book flows very very nicely. I actually recommend reading this book in sequence, without skipping chapters, because each pattern is described in a way that is somehow linked to the following ones, so that you can understand and learn about the pros and cons of each one in a more natural and useful way.</p>
<p>OK, I would have loved to see Part <span class="caps">III</span> as long as Part II, probably, but overall I&#8217;m very, very satisfied of what the book taught me. The only problem is that it also made me suddenly realize all the naive design mistakes I&#8217;ve been making when coding in Ruby, so I&#8217;ll now feel compelled to fix at least some of them&#8230;</p>
<p>Definitely a worthwhile read, I just hope to see more books like this, or even a second edition of this one soon!</p>
<h3>Notes</h3>
<p class="footnote" id="fn1"><a href="#fnr1"><sup>1</sup></a> <a href="http://www.informit.com/store/product.aspx?isbn=0321490452">Design Patterns in Ruby</a> by Russ Olsen, Addison Wesley Professional, 2007.</p>
<p class="footnote" id="fn2"><a href="#fnr2"><sup>2</sup></a> Think of <a href="http://www.pragprog.com/titles/ruby">Programming Ruby: The Pragmatic Programmer&#8217;s Guide, 2nd Ed.</a> by Dave Thomas with Chad Fowler and Andy Hunt, Pragmatic Programmers, 2004.</p>
<p class="footnote" id="fn3"><a href="#fnr3"><sup>3</sup></a> <a href="http://www.informit.com/store/product.aspx?isbn=0201633612">Design Patterns: Elements of Reusable Object-Oriented Software</a>, by By Erich Gamma, Richard Helm, Ralph Johnson, John M. Vlissides (a.k.a. the <em>Gang of Four</em>), Addison Wesley Professional, 1994.</p>
<p class="footnote" id="fn4"><a href="#fnr4"><sup>4</sup></a> For more information on the <span class="caps">YAGNI</span> principle, visit <a href="http://www.xprogramming.com/Practices/PracNotNeed.html">You&#8217;re <span class="caps">NOT</span> gonna need it</a>, Ronald E Jeffries.</p>
<p class="footnote" id="fn5"><a href="#fnr5"><sup>5</sup></a> See <a href="http://on-ruby.blogspot.com/2007/12/design-patterns-in-ruby-review.html">Design Patterns in Ruby, a review</a>, <em>On Ruby</em>blog.</p>
<p class="footnote" id="fn6"><a href="#fnr6"><sup>6</sup></a> See <a href="http://on-ruby.blogspot.com/2008/01/russ-olsen-interview.html">Russ Olsen Interview</a>, <em>On Ruby</em>blog.</p>
<p class="footnote" id="fn7"><a href="#fnr7"><sup>7</sup></a> <a href="http://ar.rubyonrails.com/">ActiveRecord</a> is an implementation of the Object-Relational Mapping (<span class="caps">ORM</span>) pattern used by the Ruby on Rails framework.</p>
<p class="footnote" id="fn8"><a href="#fnr8"><sup>8</sup></a> Distributed Ruby, see <a href="http://chadfowler.com/ruby/drb.html">Intro to DRb</a> by Chad Fowler.</p>
<p class="footnote" id="fn9"><a href="#fnr9"><sup>9</sup></a> <a href="http://www.fxruby.org/">FXRuby</a>, a graphical toolkit written in Ruby.</p>
<p class="footnote" id="fn10"><a href="#fnr10"><sup>10</sup></a> This can be a good or bad thing depending on the way you look at it, and what you want to use the language for. The fact that Ruby is dynamically typed makes it easier to do things which are totally impossible in C++ or Java, but it also introduces a whole new set of potential dangers.</p>
<p class="footnote" id="fn11"><a href="#fnr11"><sup>11</sup></a> <a href="http://ola-bini.blogspot.com/2006/09/ruby-metaprogramming-techniques.html">Ruby Metaprogramming Techniques</a>, Ola Bini: Programming Language Synchronicity.</p>]]>
    </content>
  </entry>
  <entry>
    <id>tag:www.h3rald.com,2008-01-20:/articles/efficient-ruby-code-shortcut-review/</id>
    <title>Book Review: Writing Efficient Ruby Code</title>
    <published>2008-01-21T04:47:00Z</published>
    <updated>2009-09-06T18:10:41Z</updated>
    <link rel="alternate" href="http://www.h3rald.com/articles/efficient-ruby-code-shortcut-review/"/>
    <category term="ruby" scheme="http://www.h3rald.com/tags/ruby/"/>
    <category term="review" scheme="http://www.h3rald.com/tags/review/"/>
    <category term="books" scheme="http://www.h3rald.com/tags/books/"/>
    <content type="html">
<![CDATA[
<p style="float:right;"><img src="/files/efficient_ruby_shortcut.jpeg" alt="" /></p>
<p>The second shortcut from Addison-Wesley Professional series I&#8217;m going to review is called <a href="http://www.informit.com/store/product.aspx?isbn=0321540034">Writing Efficient Ruby Code</a>. A very promising title, especially considering that this book is only 50 pages long.</p>
<p>As usual, this shortcut can be intended as a sort of programmer-friendly detailed cheatsheet: like the other ones in this series it sports a monitor-friendly landscape layout and does not go to deep into the details unless strictly necessary to understand a particular concept.</p>
<h3>The Author</h3>
<p><a href="http://railsexpress.de/blog/">Dr. Stefan Kaes</a>, the author, contributed a lot to improve Ruby on Rails&#8217; performance by refactoring portions of its core and try to &#8220;get maximum speed out of performance-critical sections of code&#8221;. This short but interesting shortcut groups together a lot of performance tweaks, tips and tricks but also some &#8220;anti-patterns&#8221; Kaes was able to identify through his career as programming teacher Ruby software consultant and key Rails contributor.</p>
<h3>The Contents</h3>
<p>Like with the previously-covered <a href="/articles/mongrel-shortcut-review">Mongrel shortcut</a>, <em>Writing Efficient Ruby Code</em> always goes straight to the point when it comes to identify problems. The first one mentioned is of course that the <em>Ruby Interpreter is Slow</em>, most people are aware of that, due to their direct experience or because this argument is normally used by non-Rubyists to argue the language&#8217;s usability in commercial projects. What you may not know is why that is so, and that&#8217;s where the first part of this book comes into play.</p>
<blockquote>
<p><em>&#8220;Ruby is a highly dynamic language: Almost all language entities are first-class citizens in that they can be created, changed, and destroyed at runtime. This comprises classes, modules, methods, constants, and class and instance variables. Only local variables are second-class citizens in Ruby: Whether a name refers to a local variable is determined at parse time.</em></p>
</blockquote>
<p>This makes Ruby extremely flexible, but also more complex. Whever you use a name to refer to an object, Ruby has to search for the object it refers to, and this costs in terms of processing time.</p>
<p>As a matter of fact, one of the most recurring tips in the book to improve code performance is the following:</p>
<p style="text-align:center;"><strong>Method calls are expensive, use variables directly when possible.</strong></p>
<p>Keep this in mind: <code>self.something</code> is <em>not</em> the same as <code>@something</code>. The end result is the same, but the first way costs more in terms of performance because Ruby has to look up the method name.<br />
Similarly, <strong>local variables <em>should</em> be introduced as a way to &#8220;cache&#8221; the result of method calls</strong>. Often you may feel &#8220;guilty&#8221; to introduce a new variable and keep calling the same method over and over: this should definitely be avoided.</p>
<p>Other useful tips include, for example:</p>
<ul>
	<li>Use syntax constructs (e.g. assignments) as expressinons. Use evaluation precedences.</li>
	<li>Use interpolated strings <code>"... #{string_variable}"</code> (there&#8217;s also no performance difference if constant strings are used between <code>"</code> or <code>'</code>)</li>
	<li>Use operators which update the data structure without copying it (when possible). Use <code>update</code> or <code>merge</code> to update hashes.</li>
	<li>Iterating using <code>for a in  A</code> is slightly faster than performing the same iteration using <code>each</code>, (it is the opposite in Ruby 1.9 though)</li>
	<li>do not use <code>return</code> unless you have to</li>
	<li>test in order of expected case frequency</li>
	<li>Use parallel assignment (<code>a, b = 5, 6</code>) where applicable</li>
	<li>If a module gets included in only one other class (or module), it’s preferable to open the class instead.</li>
</ul>
<p>I deliberately chose not to elaborate any further on the tips listed above because otherwise I&#8217;ll give a big chunk of the contents of the book itself. If you know Ruby enough, you may already know why such reccommendations make sense, but if you don&#8217;t, <em>Writing Efficient Ruby Code</em> can be a short but very interesting read.</p>
<h3>The Good</h3>
<p>For each of the 30 &#8220;coding patterns&#8221; (and consequent anti-patterns) described in the book, the author does a great job explaining the reasons of doing something in a particular way, also through examples and benchmarks, where possible.</p>
<p>Furthermore, this <em>shortcut</em> can really be useful to grasp a few difference between Ruby 1.8.5, 1.8.6 and 1.9 in terms of performance: not all the patters apply to all Ruby implementations, and when that&#8217;s the case it is clearly stated.</p>
<h3>The Bad</h3>
<p>My only complaint about the book is probably the lack of details and more &#8220;specialized&#8221; patterns. Everything (except for a few Rails-specific tips) normally apply to Ruby <em>as a whole</em>, without going deeply to analyze specific libraries or third-party gems. As a result, once you get the general idea, some of the patters may seem pretty obvious or a logic consequence of others.</p>
<p>It is also true that this is meant to be a <em>shortcut</em>, not a comprehensive analysis on code optimization techniques which can be applied to specific cases: something like this would require much more than 50 pages!</p>
<h3>The Bottom Line</h3>
<p>Read it, re-read a few bits of it to make sure you grasp the most important concepts, and keep its table of contents in front of you as a reminder when refactoring your code!</p>]]>
    </content>
  </entry>
  <entry>
    <id>tag:www.h3rald.com,2007-12-14:/articles/mongrel-shortcut-review/</id>
    <title>Book Review: Mongrel Digital Shortcut</title>
    <published>2007-12-15T02:42:00Z</published>
    <updated>2009-09-06T18:10:40Z</updated>
    <link rel="alternate" href="http://www.h3rald.com/articles/mongrel-shortcut-review/"/>
    <category term="review" scheme="http://www.h3rald.com/tags/review/"/>
    <category term="books" scheme="http://www.h3rald.com/tags/books/"/>
    <category term="rails" scheme="http://www.h3rald.com/tags/rails/"/>
    <category term="ruby" scheme="http://www.h3rald.com/tags/ruby/"/>
    <content type="html">
<![CDATA[
<p>If you ever considered about developing an deploying a Rails application in the last year or so, you must have heard of <a href="http://mongrel.rubyforge.org/index.html">Mongrel</a> before. If you didn&#8217;t, I&#8217;d recommend you learn more about it because up to now it proved to be one of the few essential ingredients for deploying <em>scalable</em> Rails applications.</p>
<p>Mongrel is a creation of <a href="http://www.zedshaw.com/">Zed Shaw</a> who started writing a replacement for FastCGI to use with Rails, and ended up creating a brand new, <span class="caps">HTTP</span> web server who turned out to be one of the best things the Rails community ever saw happening.</p>
<p>It was created to be simple to use and configure, nevertheless it <em>does</em> require some skill to set it up and tune it. Documentation is there, along with plenty of blog posts, but there&#8217;s also an interesting <a href="http://www.informit.com/store/product.aspx?isbn=0321483502&amp;rl=1">book</a> from <a href="http://www.awprofessional.com/">Addison Wesley Professional</a> which is definetely worth a read.</p>
<p style="float:right;"><img src="/files/mongrel_shortcut.jpeg" alt="" /></p>
<p>&#8220;Mongrel: Serving, Deploying, and Extending Your Ruby Applications&#8221; &ndash; that&#8217;s the title of the book. A <em>Digital Shortcut</em>, 100-odd pages long, in <em>landscape</em> format to make it easier to read on a computer, straight to the point with no added sugar for just 15$ (<span class="caps">PDF</span> only). I must say Addison Wesley got it right: the book&#8217;s format is, as a matter of fact, <em>optimized for web developers</em>, especially those who can&#8217;t afford to read a 500-pages book covering everything about a subject just to find that one thing they don&#8217;t know about.<br />
This <em>shortcut</em> can be seen, essentially, as an expanded cheatsheet which will teach you the basics about Mongrel and also give you plenty of advice on how to learn more about it.</p>
<p>Let&#8217;s have a closer look at it.</p>
<h3>Overview, Introduction &amp; Getting Started</h3>
<p>The first three <del>chapters</del> sections (there are no chapters, just <em>sections</em>) of the book are meant to be a gentle introduction to Mongrel and its world. The main author is <a href="http://www.informit.com/authors/bio.aspx?a=0260912e-6ed8-4ed1-882a-c357e644feec">Matt Pelletier</a>, but Zed Show&#8217;s contributions are definitely one of the book&#8217;s best selling points. <br />
Zed&#8217;s thoughts are scattered here and there in many <em>sidebars</em> throughout the book (there&#8217;s at least one in each section): you&#8217;ll see an odd-looking face (Zed&#8217;s self-caricature) with some text next to it; when you read it, you&#8217;ll notice that they are <em>actually</em> Zed&#8217;s own thoughts, straight from his mind, with no editorial filter whatsoever in-between. <br />
Be warned: the text included within the <strong>Zed Sez</strong> sidebars is highly opinionated, that&#8217;s precisely what Zed <em>feels</em> to say about something, and he&#8217;ll just say it: just the plain, simple thoughts of an experienced programmer. As the author explains in <strong>Section 1</strong>: <em>&#8220;[&#8230;] You may not agree with everything he says, but you probably should.&#8221;</em></p>
<p><strong>Section 2</strong> is a general introduction about Mongrel. It explains <em>what</em> it is, <em>when</em> and <em>why</em> it was made, and <em>how</em> it works. There&#8217;s nothing new to learn if you already used Mongrel before, probably, but it&#8217;s definitely the first thing to show to someone who&#8217;s new to Mongrel and its world, and possibly a bit skeptical about it. <br />
The last subsection <em>&#8220;What can Mongrel do for me&#8221;</em> is an attempt to <del>brainwash</del> persuade you to fully embrace Mongrel and its philosophy, whether you are a developer, a sysadmin or even a manager: assertions like <em>&#8220;Mongrel is pretty damned secure.&#8221;</em> and <em>&#8220;Mongrel&#8217;s license is capitalist-friendly.&#8221;</em> will definitaly make some of you (managers) happy.</p>
<p><strong>Section 3</strong> is slightly more juicy than the previous one, as it explains how to install and use Mongrel. Basically that&#8217;s what everyone who ever used it already knows, but it&#8217;s still necessary for the book&#8217;s consistency, after all. After reading this section, you&#8217;ll probably have your first Mongrel up and running and serving your little Rails application&#8217;s pages, and you&#8217;ll begin to wonder why the hell you need to keep reading this book now that everything seems to work already&#8230;</p>
<h3>Section 4: Configurations</h3>
<p>&#8230;aka &#8220;a truly useful Mongrel cheatsheet&#8221;. This section dives deep(er) into Mongrel&#8217;s configuration by explaining what each start parameter does in detail. The parameters are presented in tabular form in a very well-organized way. As you would expect from an high-quality cheatsheet.</p>
<p>Then the author will explore a few commonly used deployment scenarios, in particular:</p>
<ul>
	<li><strong>Standalone</strong> &ndash; The simplest configuration possible, with just one Mongrel instance serving both static and dynamic pages.</li>
	<li><strong>mongrel&#95;cluster</strong> &ndash; How to use <em>&#8220;a pack of mongrels&#8221;</em> together to handle more traffic.</li>
	<li><strong>Behind a static web server</strong> &ndash; The most common (and most scalable) option, used to serve static content faster using a front-end server and use Mongrel only to handle Ruby pages.</li>
</ul>
<p>Towards the end of the section, for the developer&#8217;s delight, the author will discuss two common, useful scenarios where Mongrel can be used:</p>
<ul>
	<li><strong>Apache 2 + mod_proxy_balancer + mongrel&#95;cluster</strong></li>
	<li><strong>Nginx + mongrel&#95;cluster</strong></li>
</ul>
<p>The difference here is that detailed instructions are provided on how to setup and configure each server, including example file sources. This can be particularly useful for the Nginx example, as most of the documentation for this fantastic, lightweight Mongrel fron-end is scattered around the web (or written in Russian in a <a href="http://sysoev.ru/nginx/">well known place</a>).</p>
<h3>Section 5: Production Deployment</h3>
<p>This section introduces one of the most important part of the life cycle of a Rails application: the deployment on a production server. The author is pretty honest about the whole subject:</p>
<blockquote>
<p><em>&#8220;You will not do this in a day. If you are expecting to code until 1 minute before your deadline and then simply point and click and have an instant server then you need to take some kind of<br />
medication because you are violently hallucinating. You will need at least a week of 8 hours days to make sure your first deployment works and to have the time to do it right.&#8221;</em></p>
</blockquote>
<p>Sounds terribly true. Especially for larger projects demanding good performance under heavy traffic. Scared? Probably, if you never deployed a Rails application &#8220;properly&#8221; before, but at least the book comes to the rescue by providing an overview of what you need to perform a deployment and why it is such a complex and delicate process.</p>
<p>Not only this, but also a &#8220;Best Practices Rubric&#8221; is also provided for the developer&#8217;s own private enjoyement. It&#8217;s written as a list of questions like:</p>
<p><em>11. Do you have a shared location where you can document the deployment, such as a Wiki or <span class="caps">CMS</span>?</em><br />
<em>12. Do you know how to use httperf or ab and know what the statistics mean?</em></p>
<p>After these 13 questions, the author provides the key to give a meaning to your answers:</p>
<blockquote>
<p><em>&quot;For each question you answer with &#8220;NO&#8221;, add 10 hours to your time estimate for completion. This may seem unrealistic, since saying &#8220;NO&#8221; to everything means it&#8217;ll take 190 hours (about one<br />
month), but this estimate is actually low according to most first deployment experiences.&quot;</em></p>
</blockquote>
<p>If you answered &#8220;NO&#8221; too many times to these questions, you may want to read on through the next subsection which states 17 &#8220;worst practices&#8221;: an invaluable read for beginners!</p>
<p>But after all this section is not only about stating the obvious (&#8230;right?): a full example scenario is describedand examined throughly to give you an idea of how a deployment <em>should</em> be made, using three different machines:</p>
<ul>
	<li>One for Apache (as a front-end to Mongrel)</li>
	<li>One for the Mongrel cluster and the Rails application</li>
	<li>One for the database</li>
</ul>
<p>Maybe something you&#8217;ll never do if you just want to run your grandma&#8217;s site on Rails, but certainly something you may want to start looking at if your grandma becomes really popular and your small server gets grounded by several thousands of visitors per day.</p>
<p>The last part of the section will give you a brief introduction on monitoring your applications and on which tools you should be using, although it does not discuss the subject in detail at all, it&#8217;s just meant to point you to the right direction.</p>
<h3>Section 6: Extending Mongrel</h3>
<p>This section digs deeper into the software code internals and describes <em>how to teach new tricks to your Mongrel</em>, i.e. how to extend its functionality.</p>
<p>Before you begin, though, don&#8217;t forget what Zed himself has to say about Mongrel&#8217;s simplicity:</p>
<blockquote>
<p><em>&#8220;I&#8217;ve always had a different aesthetic sense when I write my software. I value simplicity and directness and try to write software that follows this approach. I jokingly call it the Shibumi School of Software Structure. All I do is apply this rule: When given two possible designs with equal end results, pick the simpler one. I then ruthlessly strip the solution down to its finest elements, but no more.&#8221;</em></p>
</blockquote>
<p>Mongrel&#8217;s architecture is not that complex, and this section is sufficient to get you started by providing an overview of the main classes involved (HttpServer, HttpRequest, HttpResponse, HttpHandler, URIClassifier), and how they work together.<br />
Note that the book won&#8217;t describe anything about the APIs of these classes. but after all, the project&#8217;s <a href="http://mongrel.rubyforge.org/rdoc/files/README.html">RDoc documentation</a> should cover all the details you need.</p>
<p>The rest of the section focuses on how to extend Mongrel, by:</p>
<ul>
	<li>Writing custom handlers in Ruby</li>
	<li>Creating custom filters to perform security checks, clean up requests and preliminary file processing</li>
	<li>Creating plugins and distributing them as rubygems</li>
</ul>
<p>Two working examples are also provided:</p>
<ul>
	<li>An example handler to deflate content (if the browser supports deflate)</li>
	<li>An example &#8220;duck&#8221; plugin, to make Mongrel quack like a duck when it&#8217;s started (not the most useful thing in the world, but serves the purpose)</li>
</ul>
<h3>Debugging, Performance &amp; Security</h3>
<p>The last three sections deals with other important aspects concerning the deployment of your application, how to debug, how to improve performance and how to secure your application.</p>
<p><strong>Section 7</strong> introduces two debugging modes:</p>
<ul>
	<li>Dash-Bee logging (-B)</li>
	<li>USR1 logging (lighter)</li>
</ul>
<p>And also gives you an idea on what to look for when debugging an application. Nothing too detailed, granted, but enough to make sure you are pointed in the right direction.</p>
<p>Again, Zed&#8217;s wisdom and wit are remarkable:</p>
<blockquote>
<p><em>&#8220;These people&#8217;s problem is they suffer from Potpourri Turd Syndrome—a belief that their you-know-what don&#8217;t stink and smells like fine dew on freshly cut grass. Whenever there&#8217;s a bug, they go<br />
running like kids in a candy store to other people&#8217;s code trying to find fault and just assume that it&#8217;s nothing they wrote.<br />
[&#8230;]<br />
When you run into a problem with your application, always assume it&#8217;s your fault first. Mongrel&#8217;s not perfect, but its code is minuscule compared to the size of Rails and most likely even your own appli-cation code. Mongrel also powers many large and medium deployments without any problems. If there&#8217;s an error, the evidence already says it&#8217;s in your code, so bite the bullet and start investigating it as if it&#8217;s your problem.&#8221;</em></p>
</blockquote>
<p>Similarly, <strong>Section 8</strong> is a short but useful overview on performance tips and tricks and deployment tuning. The most useful thing is probably the checklist of the &#8220;tuning process&#8221;, which illustrates the simple steps to take to tune your application.</p>
<p>Finally, <strong>Section 9</strong> addresses some common security concerns and clarifies how Mongrel deals with them. The answer is normally &#8220;Mongrel strictly does this&#8221; or &#8220;Mongrel doesn&#8217;t support this feature&#8221;. After all, you should have understood by now that Mongrel is an example of simplicity and that it deliberately does not aim to offer all the feature you&#8217;d expect by a server like Apache:</p>
<blockquote>
<p><em>&quot;As you probably see, Mongrel say, &#8220;No&#8221; in many places where most Web servers say, &#8220;Yes, OK.&#8221; Sometimes this is because no one using Mongrel has needed it yet, sometimes it&#8217;s because there&#8217;s a<br />
better, simpler way to accomplish the same goal. Mongrel is a different kind of Web server, and frequently you can solve your problem with a different solution.&quot;</em></p>
</blockquote>
<h3>Conclusion</h3>
<p>If Mongrel is opinionated software, this is definitely an opinionated book which fully embraces the project&#8217;s philosopy of simplicity above everything else. It&#8217;s an interesting read and it won&#8217;t bore you to death by deliberately skipping long and potentially tedious subjects and adding interesting insights instead (like the Zed Sez sidebars). Perhaps it is a bit too direct towards certain people, who may get even get offended (as planned) by some of the author&#8217;s assertions.</p>
<p>Despite being a 100-pages book, this <em>shortcut</em> covers pretty much everything you need to know <strong>about Mongrel</strong>. It will <em>not</em> teach you everything about deployment, security, performance tweaks and debugging though: as the authors often state throughout the book, a lot of (big) books are available on those subject, and it wouldn&#8217;t make sense to even attempt to discuss them in this shortcut.</p>
<p>Similarly, you won&#8217;t find complex examples either, but that&#8217;s acceptable because simple examples are often the only thing you need to grasp the basics of a concept or feature, and then use them as a &#8220;scaffold&#8221; for your own code.</p>
<p>Globally, the book is well balanced and <em>optimized</em> for its size: lightweight introductory sections at first, then the &#8220;real juice&#8221; in the middle, and a few overview sections on advanced topics towards the end. You can read it easily in a few hours, perhaps less, and whenever you need to look something up in a hurry it will be fairly easy to locate.</p>
<p>A good read, and a <em>must</em> for everyone who wants to learn more about Mongrel or Rails deployment.</p>]]>
    </content>
  </entry>
  <entry>
    <id>tag:www.h3rald.com,2007-12-14:/articles/review-services/</id>
    <title>Review Services</title>
    <published>2007-12-14T11:24:00Z</published>
    <updated>2009-09-06T18:10:39Z</updated>
    <link rel="alternate" href="http://www.h3rald.com/articles/review-services/"/>
    <category term="review" scheme="http://www.h3rald.com/tags/review/"/>
    <category term="website" scheme="http://www.h3rald.com/tags/website/"/>
    <category term="personal" scheme="http://www.h3rald.com/tags/personal/"/>
    <category term="tools" scheme="http://www.h3rald.com/tags/tools/"/>
    <category term="books" scheme="http://www.h3rald.com/tags/books/"/>
    <content type="html">
<![CDATA[
<p>When it comes to software, I definitely like to try out new things. My collegues takes the piss out of me because every <del>week</del> day I come up with &#8220;some new tool they <em>have</em> to start using&#8221; and so on.<br />
As a matter of fact, I like reviewing software as well. I enjoy writing and analyzing new things, evaluating all the new possibilities they may offer, and I also tend to have a rather critical eye for what doesn&#8217;t <em>feel</em> right. I&#8217;ll use a tool for months but still try out new ones which claim to do the same thing — but better — as they come out.<br />
Unfortunately — or fortunately, depends how you look at it — when it comes to software, there are very few <em>silver bullets</em>, and things keep changing: that&#8217;s the way it is and the way it will be.</p>
<p>I must try to write up a page (and ideally update it regularly, that&#8217;s the hard part) listing all the tools I use, at some point&#8230; but at any rate, if you coded some new app you think kicks ass or you found a hidden jewel in the labyrinth of freeware, just let me know: I&#8217;ll definitely try it out, and if it&#8217;s worth a post I&#8217;ll blog about it.</p>
<p><strong>The same applies to books</strong>, actually, as I like reading, especially those which are related to Ruby or programming, nowadays.</p>
<p>The cost of such reviews and articles? Depends! Certainly I wouldn&#8217;t mind donations or some compensation of some form, especially from publishers or software companies. It may be money, books, software or even nothing: it really depends on what I have to review.<br />
Please be aware that I am <strong>not</strong> doing this full time, and I already have a job and a fiancée to look after, but I&#8217;ll do my best to publish as much as I can on my site or even elsewhere elsewhere [Note: on e-zines, magazines &amp; similar, not on your brother&#8217;s friend&#8217;s mother-in-law&#8217;s crappy blog!].</p>
<p>For any inquiries, contact me (<strong>h3rald [—at—] h3rald.com</strong>).</p>]]>
    </content>
  </entry>
  <entry>
    <id>tag:www.h3rald.com,2007-10-02:/articles/hlrb-review/</id>
    <title>Book Review: Humble Little Ruby Book</title>
    <published>2007-10-03T03:53:00Z</published>
    <updated>2009-09-06T18:10:38Z</updated>
    <link rel="alternate" href="http://www.h3rald.com/articles/hlrb-review/"/>
    <category term="ruby" scheme="http://www.h3rald.com/tags/ruby/"/>
    <category term="review" scheme="http://www.h3rald.com/tags/review/"/>
    <category term="books" scheme="http://www.h3rald.com/tags/books/"/>
    <content type="html">
<![CDATA[
<p>After reading the very first paragraph of Mr. Neighborly&#8217;s <a href="http://www.humblelittlerubybook.com/">Humble Little Ruby Book</a> (<span class="caps">HLRB</span> for short, from now on) it was very clear to me that it was going to be quite an unconventional read:</p>
<blockquote>
<p>&#8220;Yes, there is a Chapter 0.  There is a little bit of introductory stuff we need to talk about before <br />
we set you loose on Ruby.  You wouldn&#8217;t want to get psyched about a new gadget, get it home, <br />
and then figure out you need batteries, a grapefruit, and the ability to speak three  languages to <br />
even open the box would you?&#8221;</p>
</blockquote>
<p>That reminded me immediately of <a href="http://poignantguide.net/ruby/">Why&#8217;s Poignant Guide to Ruby</a>. without a doubt. I don&#8217;t know how it is possible that two witty, crazy, and very inventive guys grew fond of the same programming language. Anyhow, to reassure a few of you, you won&#8217;t find any foxes or chunky bacon cartoons in <span class="caps">HLRB</span>, just some very well made (although still pretty unconventional) diagrams like this one:</p>
<p><img src="/files/hlrb_diagram.png" alt="" /></p>
<p>Got the picture? Good. Let&#8217;s move on&#8230;h3. Chapter 0: What&#8217;chu talkin&#8217; &#8217;bout, mister?</p>
<p>Chapter 0 is like an introduction to the book <em>and</em> a place to put all the boring stuff you have to talk about in a book about a programming language:</p>
<ul>
	<li>What is Ruby?</li>
	<li>Installation procedure (on Windows, Mac OS X and Linux)</li>
	<li>Hello, World!</li>
</ul>
<p>Yes, you can skip this one safely without losing too much, unless of course you still need to install Ruby on your machine.</p>
<h3>Chapter 1: Welcome to Ruby.</h3>
<blockquote>
<p>&#8220;This  section  aims  to  introduce  the  syntactic  sugar  and  linguistic  misfortunes  of  Ruby  in  the <br />
quickest manner that will still allow  for a full  education on the subject.&#8221;</p>
</blockquote>
<p>As the first two lines of this chapter say, it&#8217;s time to learn the basics of Ruby. You&#8217;ll be quickly guided through strings, numbers, collections and variables. Every section with tons of code examples for your to play with. You won&#8217;t find a full list of all the 876 methods of the String class, but you&#8217;ll certainly learn the 10 most common ones at least (numbers are random, so no, don&#8217;t count them). <br />
Sure, yes, right, whatever&#8230; <em>if you really want</em> you can skip this chapter too, but if you are already a Ruby Guru there&#8217;s probably no need for you to read books about Ruby, right? Beginners need to read this chapter. It&#8217;s compulsory, really, and pretty enjoyable, too.</p>
<h3>Chapter 2: Break it down now!</h3>
<p>Or &#8220;learn how to segment your code&#8221; using methods, and&#8230; blocks &amp; <code>Proc</code> objects! Gosh. Our poor newbies will probably have a heart attack if they never heard about blocks and closures before. I almost got scared myself, because this is normally regarded as a pretty tough topic. Despite, at page 25 of the book you&#8217;ll have to face your fears and dive into it. You&#8217;ll survive, anyway.</p>
<p><strong>Purist Warning:</strong> Please be aware that sometimes the author may decide to use certain terms and construct which may not sound 100% right to your ears. Just move on, beginners will understand more things like <em>&#8220;Think of Proc objects as blocks that are pushed into variables.&#8221;</em> than anything else, guaranteed.</p>
<p>After this section you&#8217;ll finally be introduced to Ruby classes. Now, this can piss someone off, no doubt. Ruby is a <em>fully OO language</em>, so people <em>must</em> learn about classes before anything else. I must admit I was a bit confused by the ordering of the topics at first, but if someone comes from a non-OO background he&#8217;ll probably find this particular order more suitable. <br />
This section will cover class and object basics in Ruby like defining classes, instantiating objects, access control, methods, attributes, scope, duck typing. Finally, you&#8217;ll briefly look into modules as well.</p>
<h3>Chapter 3: Hustle and flow (control)</h3>
<p>Finally, the author will deal with flow control. So things like <code>if</code>, <code>case</code>, conditional operators, loops and statement modifiers. In my opinion this section is truly excellent: it introduces all the control structures in a very simple and crystal clear way, often using flowcharts. A great chance even for absolute beginners to understand these basic but powerful concepts.<br />
Towards the end of the chapter, you&#8217;ll also learn how exceptions work: a clever way to tell people &#8220;you have to learn how to use exceptions from the very beginning&#8221;. Really nicely done.</p>
<h3>Chapter 4: The system beneath&#8230;</h3>
<p>Here comes the juicy stuff. Up to now you learnt the usual boring things you need to know when learning a new programming language, now finally you learn how to do <em>real things</em>. The chapter is full of complete and meaningful code snippets which will answer nearly all the questions you may have (at this time):</p>
<ul>
	<li>How do I read and write to a file?</li>
	<li>How do I handle threads and processes?</li>
	<li>How do command-line parameters and environment variables work?</li>
	<li>How can I perform specific Windows-only operations, like reading and writing to the Registry? What about <span class="caps">OLE</span> automation?</li>
</ul>
<p>Some of the big books out there will not spend too much time talking about Windows-only libraries, but I found <span class="caps">HLRB</span> gives quite a comprehensive introduction about them.</p>
<h3>Chapter 5: Looking beyond home</h3>
<p>More juicy stuff. If you are looking for a tutorial to learn the basics about networking, from from sockets to <span class="caps">FTP</span> to <span class="caps">POP</span> and web services, look no further: this chapter does a very remarkable job introducing various network-related libraries, with the usual well written code examples.<br />
If that&#8217;s still not enough, you&#8217;ll also have a chance to explore the wonderful world of distributed Ruby and of databases. Granted, this chapter won&#8217;t tell you about the 1567 methods available in ActiveRecord (buy a copy of <a href="http://www.pragmaticprogrammer.com/title/rails/">Agile Web Development with Rails</a> for this), but will tell you enough to get started.</p>
<h3>Chapter 6: It&#8217;s a Library!</h3>
<p>The final chapter will go more in depth on some more advanced topics, like:</p>
<ul>
	<li>Strings</li>
	<li>Regexp</li>
	<li>Date &amp; Time</li>
	<li>Hashing and Cryptography</li>
	<li>Unit Testing</li>
</ul>
<p>Everything with more and more useful code snippets.</p>
<h3>The Appendices</h3>
<p>Last but not least, a <span class="caps">HUGE</span> collection of links and resources to learn more about Ruby, and a quick digression on C/C++ extensions&#8230; not much, but enough to wet your appetite.</p>
<h3>The bottom line</h3>
<p><span class="caps">HLRB</span> is not <em>the only</em> book you need to read about Ruby. It&#8217;s better to make this clear otherwise I&#8217;ll be hunted forever by Dave Thomas, Chad Fowler, <span class="caps">DHH</span> and all the other excellent Ruby hackers who also wrote very successful books (which I bought as well). <span class="caps">HLRB</span> is <span class="caps">LITTLE</span> and <span class="caps">HUMBLE</span>, after all: it doesn&#8217;t aim at becoming the official Ruby Bible anytime soon (although a bird told me it may get updated <em>someday</em> and include more stuff), but it is still a worthwhile reading.</p>
<p>And of course I came to the very end of this review without mentioning the most important thing: this little wonder is free. All you need is to register to InfoQ (for free) and grab your <a href="http://www.infoq.com/minibooks/ruby/">free copy</a>. If you want you can buy a printed copy for just $9.95, if you feel in a good mood (please do).</p>
<p>The most obvious strengths of this book are the abundance of code examples and very useful working snippets, and the unconventional style which makes it very readable and not boring at all. If I were to name some of its weaknesses (but only if you force me to), I&#8217;d say some parts should be expanded and more info on other libraries should be provided&#8230; but you never know what the future will bring us!</p>
<p>Well done, <a href="http://www.jeremymcanally.com/">Mr. Neighborly</a>!</p>]]>
    </content>
  </entry>
</feed>

