Gray Soft / Book Reviewstag:graysoftinc.com,2014-03-20:/categories/152021-08-22T16:26:24ZJames Edward Gray IIGame Programming Patternstag:graysoftinc.com,2014-12-31:/posts/1352021-08-22T16:26:24ZI've revised my old Book Reviews section just to tell you how awesome this book is whether you are interested in games development, design patterns, or both.<p>I meet a lot of programmers that tell me they got started because they wanted to build games. However, when I ask most of them which games they have built, the list rarely includes anything more than mostly unplayable toy projects.</p>
<p>I can only guess at the reasons for this oddity, but I suspect it might be due to the fact that games are fairly complex. Even if you want to rebuild a fairly simple classic like <a href="http://en.wikipedia.org/wiki/Space_Invaders">Space Invaders</a> or <a href="http://en.wikipedia.org/wiki/Snake_%28video_game%29">Snake</a> you need to know at least a little about event loops, keyboard handling, animation, and collision detection. If your day job involves a different kind of programming, like Web application development, odds are good that you don't get a lot of practice with these concepts.</p>
<p>That may not be your story, but it was definitely mine. This year I decided that it was finally time to learn how to build games. I used several sources to gain this knowledge and some helped more than others, but the biggest win by far was a book called <a href="http://gameprogrammingpatterns.com/">Game Programming Patterns</a> by Bob Nystrom.</p>
<p>The idea behind this book is very similar to the beloved <a href="http://martinfowler.com/books/eaa.html">Patterns of Enterprise Application Architecture</a>: focus in on a specific kind of programming, games in this case, and work through each of the patterns that are must haves for that domain. The patterns receive fairly typical coverage here including discussions of the problem the pattern solves, an example implementation, gotchas to watch out for, and common variations you may run into. There's also a great range of patterns from simple but helpful tips to meaty key concepts and on into some nitty gritty optimizations. This comes off without a hitch and I can confidently say that this book taught me the technical side of building games.</p>
<p>But that description way undersells the book.</p>
<p>It probably doesn't surprise you to hear that a book about game patterns does a good job showing you how to build games. The truth is though, that it just does a great job of teaching you these patterns, games aside. While there have been some epic attempts to codify huge chunks of patterns, like the very famous <a href="http://www.amazon.com/Design-Patterns-Object-Oriented-Professional-Computing/dp/0201634988">Design Patterns</a> book, I feel books like Game Programming Patterns and Patterns of Enterprise Application Architecture are far more approachable. They have the unfair advantage of context. Seeing how a handful of patterns interact to solve a specific problem really helps you see which parts do what. So the fact is that this book can teach you how to build games if you have any interest. Even if you're not that into the subject though, this is probably still a pretty darn good book to read. There are patterns in here that do apply to Web application development, like Event Queue, Service Locator, and Dirty Flag, and this book sure makes them easy to pick up.</p>
<p>And I'm still underselling this book!</p>
<p>It would be very hard to overstate the small touches at play here. The author has said this book took years to craft and I totally believe it. The content feels so well put together. Patterns reference other patterns, inside this book and out, and it really feels like they've been boiled down to just the bits you need to know. Plus the writing is superb, with a laugh-out-loud great sense of humor. There's one point in the book where a way over the top metaphor is used to describe CPU caching and you realize, as you're cracking up, that it's probably the best darn description of the concept you will ever read. And that's just one example of many. I was so addicted to this book that I read some chapters off the Web site using my iPod and it was still a great experience. Let me say that one more time so it sinks in: there's a <strong>free Web version</strong> of this <strong>programming book filled with code</strong> that's <strong>gorgeous even on an iPod</strong>. How many times have you ever been able to say that? (It's definitely a first for me.) In fact, you may just fall in love with the Web version, and the author has thought of that:</p>
<blockquote>
<p>If you want to give me money, but don’t actually want a physical book,<br>
consider giving it to a friend or your local library. I get money, you feel<br>
good, and someone gets a free book!</p>
</blockquote>
<p>Those are words of wisdom we should all follow.</p>
<p>When you're done geeking out over this book, you can still get more gamey goodness from <a href="http://journal.stuffwithstuff.com/">the author's blog</a>. It's equally awesome. For example, have a look at <a href="http://journal.stuffwithstuff.com/2014/07/15/a-turn-based-game-loop/">this post</a> with interactive simulations built right into the article.</p>
<p>OK, I'm done gushing. Please just go throw money at this author now in the hopes that he will write more.</p>
<p><a href="https://gameprogrammingpatterns.com/">Game Programming Patterns</a></p>James Edward Gray IIOne Programmer's Librarytag:graysoftinc.com,2014-07-10:/posts/1212021-08-23T01:22:16ZMy list of books that most programmers should read with some reasoning behind the choices.<p>I have always enjoyed the posts where people list out all of the books they think are important, given some subject. They vary wildly. For example, <a href="https://signalvnoise.com/posts/3375-the-five-programming-books-that-meant-most-to-me">some are very to-the-point</a> while <a href="http://www.daniellesucher.com/2014/01/05/the-best-books-i-read-in-2013/">others are rich in detail</a> (and Danielle makes one of those each year).</p>
<p>I began to wonder what my list would look like. Below I've tried to make those decisions. I was surprised by just how hard it is to restrict myself to the bare essentials. A lot of things that I read influence me in some way.</p>
<h4>The Classics</h4>
<p>I'll start with the super obvious titles you've likely heard mentioned before.</p>
<ul>
<li>
<a href="https://martinfowler.com/books/refactoring.html">Refactoring: Improving the Design of Existing Code</a> is probably the classically great programming text that had the biggest effect on me. This book teaches you how to turn the code you have into the code you want. It doesn't get much more essential than that.</li>
<li>
<a href="https://www.oreilly.com/library/view/smalltalk-best-practice/9780132852098/">Smalltalk Best Practice Patterns</a> is the book I learned a new language just to read. It's worth that. This is <em>The Field Manual of Object-Oriented Tactics</em> and it helps you know what to do line-by-line.</li>
<li>
<a href="https://martinfowler.com/books/eaa.html">Patterns of Enterprise Application Architecture</a> is the book you should read so you can see how much great knowledge we've had about building programs for over a decade. Odds are that this book can teach you multiple strategies for problems you face regularly.</li>
<li>
<a href="https://pragprog.com/titles/tpp20/the-pragmatic-programmer-20th-anniversary-edition/">The Pragmatic Programmer: From Journeyman to Master</a> is one of those rare books that can make you a better person, in addition to a better programmer. Advice like "Fix Broken Windows" and "Make Stone Soup" have universal scope. This is a must read.</li>
<li>
<a href="https://www.oreilly.com/library/view/programming-pearls-second/9780134498058/">Programming Pearls (2nd Edition)</a> is a book about algorithms and, eventually, all programmers need to learn some algorithms. The upside of this title is that it's fun from page one. That helps to keep you interested in what can be a dry topic.</li>
<li>
<a href="http://www.growing-object-oriented-software.com/">Growing Object-Oriented Software, Guided by Tests</a> is almost surely the single biggest influence on how I do Test-Driven Development. There are other schools of thought but pick one and dig deep enough into TDD until you're confident about when and how to use it. This is a tool everyone needs in their toolbox.</li>
</ul><h4>Focused Knowledge</h4>
<p>Most of my favorite programming books are hyper focused on some topic.</p>
<ul>
<li>
<a href="https://pragprog.com/titles/ruby4/programming-ruby-1-9-2-0-4th-edition/">Programming Ruby 1.9 & 2.0: The Pragmatic Programmers' Guide (The Facets of Ruby)</a> is still my favorite book to learn Ruby from, despite the surplus of choices available today. I prefer language books like this that teach you the basics and give you enough of a foundational reference to start building on. Oh, and you should definitely learn Ruby, or an equivalent dynamic language.</li>
<li>
<a href="https://www.oreilly.com/library/view/mastering-regular-expressions/0596528124/">Mastering Regular Expressions</a> is a book about some black magic that is supported in many text editors, programming languages, and command-line tools. Strangely, many programmers are afraid of them. That was all the reason I needed to read this one and it really did turn me into a wizard.</li>
<li>
<a href="https://www.apress.com/us/book/9781590593769">From Bash to Z Shell: Conquering the Command Line</a> has been <a href="http://graysoftinc.com/book-reviews/from-bash-to-z-shell">reviewed in detail</a> on this blog before. All you need to know though is that this one can teach you a lot about modern shells. All programmers can benefit from knowing how shells work. Plus, you won't be able to escape learning a bit about how computers manage processes and share information.</li>
<li>
<a href="https://www.oreilly.com/library/view/network-programming-with/0201615711/">Network Programming with Perl</a> was a major part of the reason I became a programmer. This taught me how to build servers and got me coding up MUDs in my spare time. I'm sure you have different inspirations, but it's critical to have them. You need pet projects to guide your learning.</li>
<li>
<a href="https://computationbook.com/">Understanding Computation: From Simple Machines to Impossible Programs</a> could be called <em>Computer Science: The Handy Parts</em>. If you didn't go to school for computers, this excellent book can teach you some of what you missed and do need to know. I won't kid you, it's a challenging read. It's totally delivers though.</li>
<li>
<a href="https://smile.amazon.com/gp/product/0672315858/?sa-no-redirect=1">Java Thread Programming</a> is the book that taught me how to do thread programming and I'm super glad that I learned it in Java. Each language has things they do well and things they don't. You'll need to shop for some topics in other lands.</li>
</ul><h4>My Area</h4>
<p>At some point I assume most of us find areas to call our own. If you read this blog, you know that I'm a Rubyist. These are my favorites from that world. Some of them may be worth a side trip for non-Rubyists while others likely have equivalents in other worlds.</p>
<ul>
<li>
<a href="https://www.poodr.com/">Practical Object-Oriented Design in Ruby: An Agile Primer (Addison-Wesley Professional Ruby Series)</a> is a vital book that teaches you how to think about Object Design. Java may be the right place to learn threading, but Ruby lives and breaths objects and I doubt this book would be so great in another language.</li>
<li>
<a href="http://patshaughnessy.net/ruby-under-a-microscope">Ruby Under a Microscope: An Illustrated Guide to Ruby Internals</a> is a super cool <em>How VM's Work</em> book. You don't have to read this one for Ruby, but do find and read one like it. Such books help bridge the significant gap between what you type and what computers actually do.</li>
<li>
<a href="http://exceptionalruby.com/">Exceptional Ruby</a> teaches you that there's a huge difference between learning a language's syntax for trapping errors and writing code that properly addresses error states. There's a lot of value in spending some time learning about the latter. Read this book if you can't find an equivalent for your language of choice.</li>
<li>
<a href="https://pragprog.com/titles/agcr/confident-ruby/">Confident Ruby: 32 Patterns for Joyful Coding</a>, or a similar title, is essential to learning how to structure code. You don't want to be wasting energy worrying about all the problems a given section of code might have. This book teaches you where to apply the right amount of paranoia, so you can trust the rest of your code.</li>
</ul><h4>Understanding Your Brain</h4>
<p>Learning how to learn is one of the biggest challenges of mastering any skill. A large part of that is figuring out exactly how your brain works.</p>
<ul>
<li>
<a href="https://pragprog.com/titles/ahptl/pragmatic-thinking-and-learning/">Pragmatic Thinking and Learning: Refactor Your Wetware (Pragmatic Programmers)</a> could be called <em>You're Brain: The Owner's Manual</em>. This title got me started learning a vital set of facts about what you can do well, what you can't, and how to compensate for those weaknesses. I've <a href="http://graysoftinc.com/book-reviews/pragmatic-thinking-and-learning">reviewed it in detail</a> here before.</li>
<li>
<a href="https://www.calnewport.com/books/so-good/">So Good They Can't Ignore You: Why Skills Trump Passion in the Quest for Work You Love</a> is the book you need to read when you begin to realize that the traditional advice, "Follow your passion," doesn't actually tell you what to do. This book does. It tells you how to grow, improve, and make plans for career.</li>
</ul><h5>Understanding Motivation</h5>
<p>One aspect of brain mechanics than has been the most helpful to get a handle on is motivation. This has really helped me use my time better and to understand the needs of those I am working with.</p>
<ul>
<li>
<a href="https://www.alfiekohn.org/punished-rewards/">Punished by Rewards: The Trouble with Gold Stars, Incentive Plans, A's, Praise, and Other Bribes</a> is a great place to start decoding motivation if you don't yet know how rewards and punishments affect us. I didn't and I really needed this powerful data dump about what we've observed for over 40 years.</li>
<li>
<a href="https://www.danpink.com/books/drive/">Drive: The Surprising Truth About What Motivates Us</a> is the book you read once you've been convinced that you need to understand this stuff. This covers how motivation really works and gives practical actions we can take to use this knowledge to our advantage.</li>
<li>
<em>Added 10/21/2014</em>: <a href="https://en.wikipedia.org/wiki/Maverick_(book)">Maverick: The Success Story Behind the World's Most Unusual Workplace</a> can be a tough book to find a copy of these days, but it's worth the hunt. Aside from being the ultimate guide to autonomy, it includes managing tips, a nice example of the perils of waterfall development, and some social justice. I love how the author doesn't have all the answers and you get to see him make plenty of mistakes.</li>
<li>
<a href="https://en.wikipedia.org/wiki/Mastery_(book)">Mastery</a> focuses in on just one of the pillars of pure intrinsic motivation. This covers the whole process of achieving mastery in something, starting all the way back at selecting the right something. It even goes into emotional responses likely to trip you up at each stage. It's thorough.</li>
</ul><h4>Communication</h4>
<p>Many of us like to think that we just talk to machines all day long, but that's silly. We pair program, plan features with stakeholders, etc. If you don't know how to communicate, you don't know how to do part of your job. It's that simple.</p>
<ul>
<li>
<a href="https://www.nonviolentcommunication.com/about-marshall-rosenberg/books-and-products/">Nonviolent Communication: A Language of Life</a> honestly contains plenty of material I don't like. It's filled with anecdotal evidence, what it says about praise is half-right at best, and it would have us all talking via a magic formula. That said, everyone should read this book. It's just hard to be aware of how judgmental our language can be, how to talk about emotions, or how to get the intended message across until you do.</li>
<li>
<a href="https://samharris.org/books/lying/">Lying</a> is a book I debated leaving off this list. However, I think it's important to think about concepts like "Lies of Omission" for our communication and even our code. This book will get you asking the right questions.</li>
</ul><h5>Parenting</h5>
<p>If you want to develop a communication A-game, parenting is the big league show. Sadly many, many parenting books are just junk. Here are a couple that aren't.</p>
<ul>
<li>
<a href="https://brainrules.net/brain-rules-for-baby/">Brain Rules for Baby (Updated and Expanded): How to Raise a Smart and Happy Child from Zero to Five</a> has so much to teach. This book could be called <em>The Science of Parenting</em>. It'll tell you how brains develop and what the research says. That's nice, but the real win is how it gets you practicing empathy or understanding praise. Again, this book can make you a better person.</li>
<li>
<a href="https://www.freerangekids.com/book/">Free-Range Kids, How to Raise Safe, Self-Reliant Children (Without Going Nuts with Worry)</a> shows that our natural tendencies are to panic over most things and it's so not worth it. It actually does harm. Reading this helps you decide when you need to worry and when you don't. That lesson helps with programming and life in general.</li>
</ul><p>I reserve the right to add to this list when I discover new tomes of power. I'll note the changes as I make them.</p>James Edward Gray IIPragmatic Thinking & Learningtag:graysoftinc.com,2009-02-08:/posts/782021-08-22T16:27:40ZMy take on the pragmatic guide to your brain and how it works.<p>I have a new standard by which all future reading material will measured. Any book that casually mentions lock picking and follows it up with a footnote reference to further reading that will improve your lock picking skills when restricted to an improvised toolset is an instant hit. <a href="http://www.pragprog.com/titles/ahptl">Pragmatic Thinking & Learning</a> does exactly that. While that description may be a bit of hyperbole (I had to look that word up Andy), the book really does deliver, both on the lock picking references and the great content.</p>
<p>If I had to sum up Pragmatic Thinking & Learning in one sentence it would be: it's a book about how to start thinking about thinking, with a moderate computer programmer slant. If that sounds a bit general, well, it is. A construction worker or anyone else could learn new things that would help them in their jobs and just day to day lives from this book. I know I would love for my teenage foreign exchange student to read it, because she could learn a lot from it. I'm pretty sure this book does exist in many other forms targeted at different groups of people. The advantage of this one is that I get the jokes and metaphors. Hooray for geek humor!</p>
<p>Pragmatic Thinking & Learning is very simple in content. It teaches you a lot of the basics about how we think and learn, then gives a boat load of suggestions about how you might use some of this to your advantage. Let's start with the thinking.</p>
<p>A major focus of this book is the <a href="http://en.wikipedia.org/wiki/Dreyfus_model_of_skill_acquisition">Dreyfus Model of Skill Acquisition</a>, which classifies the stages we go through as we acquire new skills. The book goes into quite a bit of detail on how to recognize these stages and what individuals need when they are in each stage.</p>
<p>Another major focus of the classification material is on the two primary modes of thinking used by the human brain. There's a lot of detail on the strengths of each mode and how they do and don't work together.</p>
<p>Lesser topics in this area include finding your <a href="http://en.wikipedia.org/wiki/Myers-Briggs_Type_Indicator">Myers-Briggs Type Indicator</a> and your <a href="http://surfaquarium.com/MI/inventory.htm">Multiple Intelligence Inventory</a>, other systems of describing your thought processes.</p>
<p>All of this adds up to make you more aware of how you, and those you interact with, think. It's early Psychology material, but the truth is that it's damn helpful to know even if you're not a shrink. The author makes a joke that if you have a brain, you can probably get something out of knowing how it works. I seriously inclined to agree.</p>
<p>To give an example, I've had multiple programming students over the years. Some lessons with some students went very well, but others went poorly. I could see that some worked and some didn't, but I had no idea why that was. Now I do. I can see which stages of learning my students must have been in at the time and then compare what I was giving them verses what they really needed. In some cases I was way off target. Would you believe those are the lessons that went badly? Shocking, I know. This insight into others is already helping me better understand the people I interact with. I'm trying to understand their needs more and think about how I could adapt to that.</p>
<p>This also makes it much easier to understand what you are going through at times. You know how people always say things like, "I have to do this because it's what works for me." All of these classifications help you understand why it is what works for you. If you are aware of that, you might even be able to make things work better for you. That's the whole point, of course, and that's really what the other half of the book is about.</p>
<p>After you know how we think and learn, you will ask that favored question of mothers and dictators the world over: how can I exploit this knowledge? Pragmatic Thinking & Learning includes 1,264 answers to that question. Yes, I counted.</p>
<p>Really, it gives you tips. A lot of tips. However many tips you have in mind after reading these last two sentences, it's more than that. Are they all great tips? In a way, yes. See, the book really hammers home one major concept: context matters. Given that, in the context of you personally, different things are going to work. Thus, you've got to try a lot of things, shop around a bit as it were, and see what fits you. I'll be shocked if something in the included tips won't. That's why you need so many.</p>
<p>Will drawing a picture upside down help you improve your use of the two separate thinking modes in your brain? I don't think it helped me very much. The jury is also still out on whether or not mind mapping is improving my ability to see relationships and whether or not mediative breathing is improving my concentration throughout the day.</p>
<p>However, the list of changes in me inspired by this book that already seem to be having a positive effect is large. Keeping key pieces of data in my line of sight is definitely helping me maintain focus on concepts that are important to me; a personal wiki has enhanced my brainstorming abilities; I'm getting better at explaining what I'm doing in metaphors to people who have no idea what I'm talking about and I believe that's improving my communication skills; my newly scheduled low distraction times are already my favorite part of the week. The list goes on and on.</p>
<p>I even already had some good habits that are suggestions from this book, like an <a href="http://www.studygs.net/texred2.htm">SQ3R reading strategy</a> and using virtual desktops to minimize context switching. It was neat to read about them and realize I had figured that out for myself.</p>
<p>There's no shortage of things to try here and I think the odds are good that some of them will help your thinking processes. If you need to figure out why some habit aren't working well for you or just figure out what you can do better, this should definitely help.</p>
<p>I said before that I think a lot of this is early Psychology material, but if you are looking to dig deeper this book has a super rich list of references you could use to continue your studies. That said, I think you can stop with this book and still be a wiser person. It stands alone just fine.</p>
<p>So again, if you have a brain, this book has something to offer you. It's not just a joke.</p>
<p><a href="https://pragprog.com/titles/ahptl/pragmatic-thinking-and-learning/">Pragmatic Thinking & Learning</a></p>James Edward Gray IIThe Definitive Guide to SQLitetag:graysoftinc.com,2008-12-11:/posts/742021-08-22T16:35:35ZMy review of my favorite book on my favorite database.<p>I'm a huge fan of <a href="http://sqlite.org/">SQLite</a>. Every time I do something with the little database it always manages to impress me in new ways. Here's a pop quiz for you:</p>
<ul>
<li>Did you know SQLite is totally free? I mean really free. All the code is in the public domain, protected by affidavits, and you can literally do anything you like with it.</li>
<li>Did you know SQLite uses "manifest typing" which is similar to Ruby's dynamic typing? The database engine will really allow you to handle field types in whatever way is best for your needs. Of course, you can do type checking in triggers if you prefer to be more strict.</li>
<li>Everyone knows SQLite shoves an entire database in one file, but did you know that it can work with more than one of those files at once? Yes, SQLite can query across multiple databases.</li>
</ul><p>I could go on and on. Really, I could. SQLite is that cool.</p>
<p>It's almost silly to use flat files these days. If you find yourself needing one, you can load one gem instead, stick a full database in the file, take advantage of transactions and locking (very multiprocessing friendly), gain a full query language for working with the data, and have a prebuilt human interface completely separate from your code (the command-line tool is great for debugging). It's hard to beat that.</p>
<p>How did I learn all of these great things about SQLite? I read the bible. I know, that's a lot of weight to lay on a book calling it the bible for anything. I really believe <em>The Definitive Guide to SQLite</em> can carry that much weight though.</p>
<p>The first thing you need to know is that this book casts its coverage net wide and deep. In about 400 pages you will get a crash course on database design and relational theory, a detailed look at the design of SQLite dipping all the way into the internals, a walkthrough of API's for C and six other languages, and full coverage of the SQL supported by the database. I think the book claims to be for all experience levels, but given that table of contents I would probably call it an intermediate title.</p>
<p>The book may not be for the faint of heart, but it will reward your efforts to digest it in spades. The early sections on relational databases can improve your understanding of all databases, not just SQLite. Then later, when the subject matter switches to deep internals, it almost always leads to a great clarification of complexities surrounding difficult topics, like locking. Take breaks, read it multiple times, or whatever else it takes because the knowledge is very worth it.</p>
<p>It's hard to level any minuses about this book, but if I had to find one it might be that it's a bit old. That won't affect you much, but it does mean that the title doesn't cover some exciting new features that have been added recently (geospatial queries, for example) and some promising new interfaces (like Ruby's <a href="https://github.com/copiousfreetime/amalgalite">Amalgalite</a>). You will definitely want to dig into these topics after reading the book and it will give you a solid background for doing so.</p>
<p>I also had a little trouble finding this book over the summer, but it seems to be readily available now. They were probably just between printings at that time.</p>
<p>If you work with light to moderate data and don't fully need an ORM, this book can add a wicked tool to your arsenal. Or if you just want to learn more about how SQLite can be used more effectively in your Web application, this book can give you that and more. It may even improve how you think about data in general. It's that enlightening.</p>
<p><a href="https://www.apress.com/gp/book/9781430232254">The Definitive Guide to SQLite</a></p>James Edward Gray IIProgramming Amazon Web Servicestag:graysoftinc.com,2008-06-08:/posts/512021-08-22T16:34:17ZMy not-too-nice take on the new manual for the suite of Amazon's Web service.<p>I really wanted to love <cite>Programming Amazon Web Services</cite> and it does have some things going for it, but there are enough minuses to keep me from giving it full marks. Let me start by talking about what the book covers, then we will take a look at what it did well and not so well.</p>
<p>This book provides full coverage of Amazon's suite of Web services. You'll find detailed chapters on Amazon's file storage service S3, their cloud computing service EC2, their messaging service SQS, their payment gateway FPS, and their document database service SimpleDB. The book begins by explaining Amazon's philosophies for these services, how they affect the suite as a whole, and why that should be important to you. For each service you will find detailed information about the design and intent of the service, how to interact with the API (including a full client implementation), and example applications making use of the service. The larger and more complicated services span multiple chapters to make sure all key aspects of using that service are covered.</p>
<p>The description above really hints at what the book does very well. It's fantastic coverage of all the Amazon services from design to implementation and including practical usage. You'll have no doubt as you read that the author is a domain expert who really knows his stuff. He'll walk you through basic usage for the service, strengths and weaknesses, and even give suggestions for how to use the service in exciting new ways. This is all top notch.</p>
<p>As I've mentioned though, the book has downsides and they are significant. The first is that the content is definitely time sensitive and the clock is already ticking. As Amazon makes changes to these API's, the content will become less and less relevant. While that's to be expected of most computer manuals, it may be a little more significant here as most of these services are still beta releases undergoing significant development. This hits home most in the SQS chapter which received a significant upgrade just as the book went to press. The author does mention the differences, but he admits that it invalidated much of his content. Keep that in mind if you are readying this review a long time after I've written it.</p>
<p>I'm afraid the other minus is worse. The book uses Ruby for most of the code examples and I hate to judge the code of a language I know we all write differently, but the fact is that this Ruby is pretty bad. It's clear Ruby is not the author's forte and it really feels like it was selected just to score more points with the popular crowd. The code shows poor programming practices like never closing file handles, a total misunderstanding of the purpose and usage of IRb, poor use of Ruby's modules in an attempt to avoid subclassing, and much more. That's just in the first few examples too. At one point, after developing a full client library for a service, the author downloads an alternative client implementation to show examples with. Hint, hint. The code is just bad.</p>
<p>Amazon provides these Web services to enable us developers to lean on the world-famous infrastructure of <a href="http://www.amazon.com/">Amazon.com</a> in our own applications. There are some very real advantages to integrating these solutions and thus it's very valuable for developers to be familiar with what they can offer you. This book will give you that and thus is probably worth a read. It would be a rare developer indeed who cannot think up many uses for S3 and EC2 at the very least. If you don't know what those two services are and what they could do for you, I strongly recommend you learn a little more about them. Just don't take the code in the book too seriously.</p>
<p><a href="https://www.oreilly.com/library/view/programming-amazon-web/9780596515812/">Programming Amazon Web Services</a></p>James Edward Gray IIDesign Patterns in Rubytag:graysoftinc.com,2008-03-01:/posts/472021-08-22T16:32:53ZA review of a more modern take on the classical "Gang of Four" book, now in Ruby.<p>I've been lucky enough to read a string of good Ruby books lately and the latest in that line is <cite>Design Patterns in Ruby</cite>. This book attempts to modernize the software design patterns by showing how these patterns can be applied in a language as dynamic as Ruby. Despite a couple of minor missteps along the way, the book definitely delivers on this goal.</p>
<p><cite>Design Patterns in Ruby</cite> begins with a couple of introductory chapters introducing both the concepts behind reusable software patterns and the Ruby programming language. After that, the main section of the book has 13 chapters that walk through 14 of the patterns first introduced in the famous "Gang of Four" book that began the design patterns movement. The author then introduces three new patterns he feels have grown out of day to day Ruby usage. Finally the book closes with a short conclusion and two appendices on installing Ruby and other sources of information.</p>
<p>Most of that content is exactly what I wanted to find in this book, but you're going to have to tolerate a diversion about a pet peeve of mine that is strangely common in Ruby books. This is really, really important, so listen up: you can't teach Ruby in 30 pages. Period. I can hear all on the "But…" replies forming out there now… No buts. You can't. Trust me. Not even if the person is already an experienced programmer. It just can't be done. Authors and publishers need to come to terms with that and move on. Its just fine to say, "This is not a beginning Ruby book." We even prefer that, because we know when we are ready to read it and we don't have to skip that useless 30 page chapter when we do. Please, stop including introductory Ruby chapters in every book.</p>
<p>My rant aside, all of the other content in the book is exactly what you want to have in a title like this. Those familiar with the original work on design patterns will note from my earlier counts that this book does not include all of the patterns in the previous work. That's actually a plus, I think. The author hits the highlights for sure and leaves out some patterns that just aren't that common or are so trivial as to be almost automatic in Ruby. I was a little surprised to see Interpreter on the list of included patterns, thinking that it doesn't come up all that often, but the author won me over with a well presented case about it being an under-appreciated pattern. I do wish the State pattern had been included though. I run into it often enough in the wild and it's ripe ground for some Ruby tailored approaches.</p>
<p>For the traditional patterns that are covered, each chapter includes some description of the situations the pattern is suited for, UML diagrams of how the pattern looks when implemented, a traditional implementation written in Ruby, a look at how Ruby programmers tend to twist the pattern using some of Ruby's more dynamic features, some warnings about where you can go wrong with the pattern, and some examples from famous Ruby projects that use the pattern. The traditional implementations and the Ruby twists are the heart of each chapter and they prove to be the real one-two punch that makes the book stand out. This is a great way to transition your thinking from static object oriented solutions to the fully dynamic world Ruby lives in. Beyond that, it ends up being a great guide to all of Ruby's dynamic features since it doesn't just explain them but it also shows how and why you are likely to use them. This is what makes the book a must read for all Rubyists.</p>
<p>The three new Ruby patterns are a welcome addition as well. Again, these focus on Ruby's highly dynamic nature and how that can be used to simplify common problems we encounter in software design. This feels right at home with the rest of the material in the book. The new patterns are: Domain-Specific Languages, Meta-programming, and Convention Over Configuration.</p>
<p>The presentation of the content is another mostly good aspect of the title. The author's prose has a very conversational tone that's easy to enjoy and learn from. He often includes little anecdotes to ease you into the material of a new chapter. All of the code examples are a good fit. Most of the code is pretty basic, but it's always clear and shows the point well. A few of the later examples get a bit more involved, but they are really neat things to show.</p>
<p>The downside of the code is the error ratio. There are just quite a few technical errors in the book, either in the code itself or in the text discussing the code. I didn't run all of the example provided and I feel pretty comfortable saying I spotted an average of two technical errors per chapter. I wish the count could have been a bit less than that. For the most part, these errors don't get in the way of understanding what the author is trying to show. However, this is going to make the road a little bumpier for someone new to the material who needs to play with the examples to understand it well.</p>
<p>Before I wrap this up, I do want to say that I like hard back books. This title looks great on the shelf and should stand up to some abuse as it gets used as a reference to look up patterns over and over again. Maybe I'm in the minority, but I would like to see more hardback programming books even if they cost a small premium.</p>
<p>The final verdict is that <cite>Design Pattern in Ruby</cite> is another great Ruby book that we all need to take the time to browse through. If you're a programmer, you need to become familiar with design patterns and even if you are well schooled in the patterns this book's unique dynamic favorable approach is sure to get you examining them in a new light.</p>
<p><a href="https://www.oreilly.com/library/view/design-patterns-in/9780321490452/">Design Patterns in Ruby</a></p>James Edward Gray IIPractical Ruby Projectstag:graysoftinc.com,2008-01-28:/posts/452021-08-22T16:30:49ZMy suggestion for a another book Ruby Quiz fans will likely enjoy.<p><cite>Practical Ruby Projects</cite> is a pretty poorly named title, but, luckily, that doesn't stop it from being a very strong book. The book actually turns out to be an exploring-the-Ruby-programming-language-by-example book. These aren't your trivial beginners-only tasks though. There's enough meat in these pages for the intermediate crowd to really get into.</p>
<p>Let me start by clarifying my earlier comment about the title. It's clear this book is named after the series it appears in, instead of the actual content it holds. There are lots of projects in the book and they are definitely written in Ruby, but <em>Practical</em> is not the word I would use to describe them. <em>Fun</em>, on the other hand, would be a great word. Beyond that, the code and concepts used in these projects is well worth studying. Just don't expect to find the typical (for Ruby) collection of Web programming tips inside. To me, that was a big plus. The title just misrepresents what's inside.</p>
<p>The projects you will find in the book include: MIDI music generation, SVG graphic building, pocket change simulations, a turn-based strategy game, a Mac OS X GUI, a genetic algorithms framework, as well as both a parser and interpreter for the Lisp programming language. While these projects obviously tackle subsets of each problem space, they go deep enough to serve as a solid introduction in each area. The author is also good at focusing on the more interesting aspects of each challenge and throwing in a few twists to keep your interests high.</p>
<p>Let me give you an overview of the MIDI project so you will know I mean. This chapter explains some basics of MIDI protocol, moves on to showing how to interface with native MIDI libraries on Linux, Windows, and Mac OS X, adds a look at how to manage timed events with Ruby, then closes with a detour into the live coding of music algorithms. The middle tasks, building native interfaces and controlling timed events, are the meat and most of the chapter's time is spent there. The former shows how to use C code from Ruby without writing C and how to manage what code is used on each platform. With the latter, you get very practical examples of how to schedule and later invoke callbacks. The live coding section may sound like an odd include, and I guess it is, but it does give the author an opportunity to show ways to make changes to a continuously running Ruby program.</p>
<p>Now if that particular topic doesn't strike your interests, its very likely one of the others will. Those of us who like animation will enjoy the SVG section, the gamers will probably take the simple strategy game and run with it, the algorithm buffs will enjoy the coin simulations which dip into dynamic programming and genetic algorithms, and for the real geeks among us there are two chapters on Lisp. If more than one of those categories fits you, you're really going to enjoy this book. I'm pretty sure there's something for everyone in here.</p>
<p>If I had to single out the least interesting project in the book, I would say it's the Mac OS X GUI. I'm a Mac guy and I'm interested in the RubyCocoa system this chapter covered, but the presentation fell down a bit here. Due to space constraints, the author chose to deliver this content in a very non-standard way. Unfortunately, that means you are mostly just copying code in this section without really gaining a deeper understanding of what you are doing. It also means this section's code won't really stick with you as you move on to the proper ways to build a Mac GUI. It was the only project I found disappointing.</p>
<p>What really makes this title is the code. It's top notch in almost all cases. The author really dives deep into the Ruby pond and makes sure we see a little bit of everything. There's coverage of standard Rubyisms like the iterators and the standard unit testing library, but you'll also catch some lesser shown tricks like programmatically building dynamic subclasses. Every section has some interesting code in one or more places. More than once I found myself asking, "Now why did he write it that way?," only to have it answered in the following explanations. I can't name a better way to learn intermediate Ruby.</p>
<p>There was one exception to the quality code, though it's a minor complaint. The author does misuse Ruby's open classes a few times. There are multiple cases where he adds code to <code>Enumerable</code> that's dependent on methods in <code>Array</code>. He seems to have trouble knowing when to separate the two. Don't pick up that bad habit.</p>
<p>All in all, if you prefer to learn by example over theory, this is easily the best book for that with Ruby. The projects are inspiring and I found myself still fiddling with the code after finishing a section more than once. While playing around you will be exposed to some great code and fresh ideas. It's hard to beat that.</p>
<p><a href="https://www.apress.com/gp/book/9781590599112">Practical Ruby Projects</a></p>James Edward Gray IIFrom Bash to Z Shelltag:graysoftinc.com,2008-01-24:/posts/442021-08-22T16:29:29ZWhile this isn't strictly Ruby, I imagine most Rubyists interact with shells on a regular basis.<p>I work on multiple Unix platforms all day long. I had never really taken the time to learn about the shells, but I had picked up the basics over time. I knew how to run commands, string them together with pipes, and redirect their output into files. So when I tell you that I started learning new things in the first chapter of <cite>From Bash to Z Shell</cite>, you will know the coverage is in depth. If you are a casual shell user, or even less experienced, this book has a lot to offer you.</p>
<p><cite>From Bash to Z Shell</cite> is organized into three parts. Part one is an introduction to shell basics. It focuses on typical interactions with a shell including all of the things I mentioned knowing before reading this book. There is surprisingly good depth even here though and I doubt that anyone short of a power user could make it through this section without picking up a new trick or two. I learned multiple things from each chapter in this section.</p>
<p>In part two, each chapter takes a single aspect of the shells and really focuses in on just that. You will find chapters about the startup files each shell invokes as well as shell command histories. This is comprehensive coverage that really gets you to understand how things work as well as how to tune them to your personal tastes. You are even less likely to not pickup great tips in here.</p>
<p>The third and final part of the book turns to shell programming. While I suspect that plenty of users interact with a shell regularly without getting much into scripting them, there are still useful tidbits in here for them too. For example, after reading this section, I added some code to my startup file to customize my shell's completion functionality. I can now tab-complete the server names used by my workplace and even file system paths on those servers. This section also has a very good chapter on variables that will definitely help in day to day usage. A couple of the final chapters in here are heavily slanted towards or exclusively about the Z Shell though, so those chapters don't hold much for users of other shells.</p>
<p>As the title suggests, the book extensively covers both the Bash shell, which seems to be the standard default on many Unix systems now, and the feature-rich Z Shell that power users seem to favor. Surprisingly though, the book does talk about many other shells. In the first part especially, features tend to be described for more than just the two shells with top billing. This falls off in the later parts to some extent though. Also, the authors clearly aren't fans of the C Shell or its derivative the T C-Shell, so fans of those will want to look elsewhere. Windows receives some screen time, but only from the angle of running Unix-like environments and shells on it. You won't find coverage of the native Windows shells in these pages.</p>
<p>The book is quite good at covering the similarities of the shells. They frequently tell you when some command will work unchanged in both Bash and the Z Shell and they always do their best to give two equivalent commands when there are differences. This makes the shell knowledge you pick up from reading quite portable. It's also nice for those who don't know much about the differences between the shells and thus are trying to learn enough to pick the right one for them. It helped me choose a favorite. The only downside of this is that the transitions seem to become less smooth late in the book and I found myself wondering if we were still talking about Bash or had moved on to Z Shell a few times. This is a minor complaint though.</p>
<p>Beyond covering the shells well, the book can also help you better understand the design of the Unix operating system. It has some great asides on things like process forking and child process inheritance, special files and devices, and terminal drivers. Seeing these items through their interactions with a shell can make them significantly easier to grasp.</p>
<p>The writing style of this book is very natural. That's important since it distills so much information into every page, you could easily begin to feel overwhelmed. Luckily, that wasn't the case at all for me. I found the material to be presented so naturally that I absorbed it with ease. The book also has abundant cross references and a strong index which will make it great to reference later.</p>
<p>The final measure of a book like this turns out to be how much it changed your daily work habits. I've already noticed dramatic differences. I'm using shell loops at the command-line now to process many files at once; I actually understand shell quoting and when to use which types of quotes and escapes to get the desired effect; I can easily strip off a file extension or get a directory name from a full path when I need one; I make constant use of the command history now whether I'm searching for a past command, correcting a typo, or just pulling a single argument out of a previous command for reuse in a new command; and I've written a few shell functions to provide shortcuts to my common tasks. I just naturally began doing these things too, I didn't have to work at it a lot. <cite>From Bash to Z Shell</cite> just raised my understanding that much. To me, that's a big selling point.</p>
<p><a href="https://www.apress.com/us/book/9781590593769">From Bash to Z Shell</a></p>James Edward Gray II