WindyCityRails News 4c49b72cdabe9d4808000019 2010-09-03T11:05:07-04:00 Chat it up with Obtiva at the Obtiva Coding Dojo 4c810c6edabe9d447b000004 2010-09-03T11:05:07-04:00 2010-09-03T10:47:00-04:00 <p>WindyCityRails is just over a week away, and we&rsquo;ve been busy planning for the Obtiva Coding Dojo!</p> <p>What conference doesn&rsquo;t have an IRC channel? They always do. For this year&rsquo;s Obtiva Coding Dojo at WindyCityRails, we&rsquo;d like to build our own chat server using Redis and Rails 3. We&rsquo;ll have the basics going before the first attendee arrives and we&rsquo;ll let everyone know where they can go to hang out and chat in our sleek little Campfire clone. There will be two general types of projects to take on. For those seeking something involved we&rsquo;ll have cards to develop new features for the chat client. For others seeking something light and fun we&rsquo;ll have a number of simple chat bots you can build. I&rsquo;ll talk about each of these areas in more detail. </p> <h6 id="client-improvement">Client Improvement</h6> <p>Ryan and I will be working throughout the day to improve the chat client with anyone who wants to stop by the Dojo and lend a hand. These stories will be more involved and take a little bit longer, but you&rsquo;ll have a greater opportunity to pair with us and dig into Rails 3. Here&rsquo;s a few of the features we&rsquo;re planning to build: </p> <ul> <li>Avatars</li> <li>Show bot functions outside the chat room</li> <li>create / join different rooms</li> <li>Include images</li> <li>Abbreviate long posts</li> </ul> <p>Of course, you&rsquo;re free to come up with your own ideas. We&rsquo;ll help you build it!</p> <h6 id="byob-build-your-own-bot">BYOB (Build Your Own Bot)</h6> <p>Chat bots are fun little projects, most of which can be put together with little time commitment. As a bonus, you&rsquo;ll be able to work on your bot from anywhere in the conference. Of course, we&rsquo;d love it if you wanted to hang out in the Dojo room with us! Here&rsquo;s a few ideas we&rsquo;ll have cards for: </p> <ul> <li>AI bots have a &ldquo;conversation&rdquo; </li> <li>Math bot</li> <li>Google feeling lucky bot</li> <li>Google Image search bot</li> <li>Bash.org quote bot</li> <li>&ldquo;Insultor&rdquo; bot</li> <li>IMDB bot</li> <li>rubydoc bot</li> <li>The DHH quote bot</li> </ul> <p>We&rsquo;re really excited about this Dojo, and I hope you are too. It&rsquo;ll be a chance for attendees to clock some time with Rails 3 as well as explore the NoSQL landscape with Redis. Folks who aren&rsquo;t participating in the Dojo will get to see the application evolve throughout the conference and interact with bots other attendees have built.</p> <p>We look forward to seeing you at the Obtiva Coding Dojo! <a href="http://windycityrails.org/register/">Get your tickets today</a> if you haven&rsquo;t already registered for WindyCityRails.</p> Implementing a TDD Process in a Legacy App 4c72c729dabe9d082c000002 2010-09-03T11:00:57-04:00 2010-08-23T15:08:00-04:00 <p>My tutorial at WindyCityRails this year is about implementing a TDD process in a legacy application. But before you start working in a new application, you need to do an inspection, so that you understand the basic structure of the code, get a sense of where the weak spots are, and some idea of how the various pieces interact.</p> <p>This kind of inspection can have a lot of different goals, but normally you are looking to get the thing running, and get a general sense of just how good or how awful the previous coders were. In a consulting practice, you may be asked to do this kind of an inspection before you put together an estimate for future work. (Or worse, you may have to do this kind of inspection after you&rsquo;ve already done and estimate. This always reminds me a little bit of those home-flipping shows when the new buyer starts tearing out the drywall and discovers the lost colony of termites.)</p> <h6>Version and Plugins</h6> <p>The first thing I do is usually a quick glance to check what version of Rails the app runs under. Not having a vendor/rails or other lock to a specific Rails version is a negative mark. (At least in Rails 2. In Rails 3, I&rsquo;d use the Gemfile to catch the version of everything. Of course, your odds of a legacy Rails 3 project at this point are pretty slim.) I also check to see what other gems and plugsins are installed, as that&rsquo;s usually a pretty good high-level guide to what the functionality of the application is &ndash; ActiveMerchant implies e-commerce, for a simple example.</p> <h6>Tests</h6> <p>The first place I go in the actual code is the test suite. It&rsquo;s often a much better indication of the quality of the entire code base than the application code. If the tests are poor or nonexistent that&rsquo;s an extremely worrisome sign. Nonexistent is easy enough to spot. The worst case is a test base that&rsquo;s was half-heartedly kept up, because it often won&rsquo;t run.</p> <p>Checking the quality of passing tests is a little more difficult. Lack of coverage is a nicely objective metric, although presence of coverage doesn&rsquo;t necessarily mean good tests. Very long test methods generally indicate to me that TDD was not followed in the creation of the app, and that the tests are likely to be brittle and not map very well to the actual logic points of the system. It&rsquo;s also common to see a lot of repetition in tests &ndash; often developers don&rsquo;t spend as much time cleaning up test code. Again, that&rsquo;s sign that future maintenance is going to be difficult.</p> <h6>rake:stats</h6> <p>Somewhere around here I usually fire up rake:stats just for the heck of it. I don&rsquo;t put a whole lot of stock in it &ndash; it can be easy to fool. But a 1 - 0.2 test/code ratio is a red flag.</p> <p>I also look at the ratio of controller to model code. Again, I don&rsquo;t take it too seriously, but I&rsquo;d rather see more code in the model then not.</p> <p>If I&rsquo;m feeling very ambitious, I try to install metric_fu, which gives a much truer picture of the quality of the app. The various best-practice parts of metric_fu are worth skimming, but there are often a lot of false-positives in there. I make it a point of going through the flog scores, which are a reliable guide to where the scariest code in the system is hanging out.</p> <h6>Run the App</h6> <p>At this point, I usually try to run the app. In theory, if the tests run, then the app should run. But, well&hellip; If there&rsquo;s a Capistrano script, that often has some hints about other dependencies or quirks. Data is also another problem &ndash; some apps require some basic data in the database, often semi-static data like category names. If the code base doesn&rsquo;t have a setup for this in the code migration, sometimes it&rsquo;ll be in a rake task. Sometimes a snapshot of a real database will be made available, obviously that&rsquo;s helpful. This step is less important in the inspection process than you might think, but if getting the thing up and running is a total bear, that generally means that there&rsquo;s a lot of hidden scary stuff.</p> <h6>Application Code</h6> <p>Now it&rsquo;s time to search the app directory. The first part of this is just opening each file. This is the kind of thing you could almost do with the font size way down&hellip; I&rsquo;m not so much trying to understand the details of the code as the shape of it. A lot of small classes, or fewer, larger classes? How long are the methods? A lot of long methods really scare me, especially in conjunction with minimal unit tests. More subjectively, does the layout look sloppy? Are there coding constructs that indicate a Ruby-specific style, or does everything look like translated Java? Is metaprogramming used where appropriate? Is there code in the controllers that should be elsewhere? Are the views too knowledgeable about the rest of the system?</p> <p>Through that quick glance I identify the most interesting bits of code, and then I go back to them in more detail, asking questions like: Can I understand what this is doing? Is this the best way of doing it? Is there an obvious time or space inefficiency? Does the design make sense?</p> <h6>Configuration</h6> <p>The config directory is usually my last standard stop. Destinations here include the Capistrano deploy script, it it&rsquo;s there, any other configurations of interest (like an Amazon S3 setup). The environment.rb file is another good place to look for configurations, and you can&rsquo;t overlook config/initializers &ndash; it&rsquo;s a good place to hide dependencies and monkey patches that you might overlook.</p> <p>The routes.rb file will give some ideas about the site in general &ndash; it&rsquo;s the Rosetta stone between URL and controller, and it&rsquo;s common to have to dig here to figure out what&rsquo;s going on if the routing is at all complicated. It&rsquo;s easy for this file to get out of control if nobody is paying attention, so it can tell a lot about the general nature of the programming team. A lot of additional methods added to a RESTful controller, for example, which might not be the best design solution.</p> <h6>In the end</h6> <p>At this point you should have a general feel for the quality of the code, and if not a complete understanding of how every piece interacts, at least a sense of where the trouble spots are going to be. If the answer is &ldquo;everywhere&rdquo;, double all your estimates&hellip;</p> <h6>Learning More</h6> <p>To learn more, be sure to <a href="http://windycityrails.org/register/">register</a> for Noel Rappin&rsquo;s tutorial, <a href="http://windycityrails.org/register/">Testing in a Legacy Environment</a>.</p> Getting Started With Ruby on Rails 4c5c582cdabe9d4cb6000020 2010-09-03T11:01:20-04:00 2010-08-06T14:45:00-04:00 <h6>Powerful Framework. Lots of Information</h6> <p>Ruby on Rails is a powerful web framework. It&rsquo;s popularity has spawned an ever-changing, ever-growing ecosystem around it: blogs, documentation sites, screencasts, GitHub repositories, books, eBooks, training classes, mailing lists, IRC channels, and more.</p> <p>And yet, despite this flood of information, the one thing that should be easy to do is often the hardest: getting started. </p> <h6>Making Sense of the Information</h6> <p>If that describes how you feel about Rails, then you&rsquo;re in for a treat at WindyCityRails this year. The Getting Started With Rails workshop is geared for all newcomers to Rails, and provides a friendly, casual, beginners-only setting. While most workshop attendees should have a basic understanding of Ruby syntax, we won&rsquo;t assume any advanced experience with the Ruby programming language, and certainly not with the Rails framework.</p> <p>In about two hours, we will step through a comfortable, fun tour of many of the foundational concepts in Rails: from routes and actions, to forms and models. </p> <p>So if you’re new to web programming, or if you have previously worked with .NET/Java/PHP and really want to get started with Rails, this is your chance. You&rsquo;ll be in a roomful of beginning Rails students, in an interactive environment, getting familiar with </p> <h6>What Will I Learn?</h6> <p>By the end of this workshop, you&rsquo;ll have a solid start with Rails, and confident that can learn the next steps on your own. </p> <ul> <li>Intro to HTTP concepts, and what “REST” is all about</li> <li>How to route a URL to your web page code</li> <li>How to use the built-in code generators</li> <li>How to embed Ruby code into your HTML templates</li> <li>Introduction to understanding templates, partials, and layouts</li> <li>How to use a database inside your application</li> <li>Understanding the heart of Rails: its MVC architecture</li> <li>How to write web services with Rails</li> <li>Tips for debugging and using the Rails console</li> <li>Recommneded best practices for all Rails developers</li> </ul> <h6>What Version of Rails Will I Learn?</h6> <p>We&rsquo;ll be demonstrating the latest pre-release version of Rails 3.0 (RC1 at the time of this writing), so you&rsquo;ll be ready for Rails 3.0.</p> <h6>Do I Need to Bring Anything?</h6> <p>You can come and watch the demonstrations and learn a lot; or bring a laptop if you prefer. If you bring a laptop to try some things out during class, be sure you have a proper installation of Ruby 1.8.7 and Rails. For step-by-step instructions on how to setup Ruby and Rails on Mac or Windows, we&rsquo;ve created a <a href="http://www.purpleworkshops.com/prep">workshop preparation guide</a> for all attendees.</p> <h6>Regster Today!</h6> <p>Seating is very limited. <a href="/register">Register today</a> to secure your spot!</p> WindyCityRails 2010 Schedule Expanded! 4c5a09b3dabe9d3814000007 2010-09-03T11:01:35-04:00 2010-08-04T20:30:00-04:00 <p>Great news! We&rsquo;re happy to announce that Ryan Singer, lead UI Designer at 37signals, will once again be speaking at this year&rsquo;s WindyCityRails. Ryan is planning an engaging talk on designer-developer interaction.</p> <p>WindyCityRails will now feature seven full-length regular sessions, an hour of lightning talks, and the Obtiva Coding Dojo. In addition to Ryan&rsquo;s talk, we&rsquo;ve got <a href="/sessions">great talks</a> planned by Jake Scruggs, John McCaffrey, Kevin Gisi, Nick Gauthier, Les Hill &amp; Jim Remsik, and Yehuda Katz.</p> <p><strong>In honor of our expanded schedule, we&rsquo;ve decided to extend early bird registration by one week!</strong> You can now save $80 on your WindyCityRails registration through <strong>August 11, 2010</strong>. <a href="/register">Register today</a>.</p> <p>Last year, Ryan spoke on UI Fundamental for Programmers. Here&rsquo;s a video of that talk, in case you missed it:</p> <object width="400" height="267"><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="http://vimeo.com/moogaloop.swf?clip_id=6702766&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=0&amp;show_portrait=0&amp;color=b30000&amp;fullscreen=1&amp;autoplay=0&amp;loop=0" /><embed src="http://vimeo.com/moogaloop.swf?clip_id=6702766&amp;server=vimeo.com&amp;show_title=1&amp;show_byline=0&amp;show_portrait=0&amp;color=b30000&amp;fullscreen=1&amp;autoplay=0&amp;loop=0" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="400" height="267" /></object> <p><a href="http://vimeo.com/6702766">UI Fundamentals for Programmers by Ryan Singer</a> from <a href="http://vimeo.com/chicagoruby">ChicagoRuby</a> on <a href="http://vimeo.com">Vimeo</a>.</p>