<?xml version="1.0" encoding="UTF-8"?>
<feed xml:lang="en-US" xmlns="http://www.w3.org/2005/Atom">
  <title>class DirtyInformation - Home</title>
  <id>tag:www.dirtyinformation.com,2012:mephisto/</id>
  <generator uri="http://mephistoblog.com" version="0.8.0">Mephisto Drax</generator>
  <link href="http://www.dirtyinformation.com/feed/atom.xml" rel="self" type="application/atom+xml"/>
  <link href="http://www.dirtyinformation.com/" rel="alternate" type="text/html"/>
  <updated>2011-08-19T20:42:04Z</updated>
  <entry xml:base="http://www.dirtyinformation.com/">
    <author>
      <name>Amos</name>
    </author>
    <id>tag:www.dirtyinformation.com,2011-08-19:90</id>
    <published>2011-08-19T19:41:00Z</published>
    <updated>2011-08-19T20:42:04Z</updated>
    <category term="deployment"/>
    <category term="lessons learned"/>
    <category term="production"/>
    <category term="team"/>
    <link href="http://www.dirtyinformation.com/2011/8/19/when-is-the-release-party" rel="alternate" type="text/html"/>
    <title>When is the Release Party?</title>
<content type="html">
            &lt;p&gt;
Releasing a new product can get a person into a flat spin and make their head hurt like crazy. The last two weeks has been a whirlwind of excitement and nausea. I was thrown head first into the first time I have ever been the person in charge of a production release of something someone else was paying me for.
&lt;/p&gt;
&lt;p&gt;
We set out on this journey almost a year ago. The client has been up and down in what they wanted. We have a lot of crufty code, but things have been looking up lately. Everyone is excited to get something out to the public. The developers desperately want feedback from real users, and a stronger guiding voice than the wishy washy customer we have had.
&lt;/p&gt;
&lt;p&gt;
&lt;h2&gt;Monday - the official day we are supposed to release…&lt;/h2&gt;
“WTF? This has never happened before. What is going on?” Certain interactive data seems to be missing small parts here and there. The worst part is that there seems the be no consistency. When we try to replicate the issue everything is fine. It looks like we are going to need another day to figure this out. I hope that it is just this one day.
&lt;/p&gt;
&lt;p&gt;
Chase down some issues with connecting to the database. We believe this is a hosting company issue. We can let them deal with it, but right now we need to add some logging so we can tell when and where this is happening.
&lt;/p&gt;
&lt;p&gt;
&lt;ul&gt;
&lt;li&gt;think about logging before there is a problem&lt;/li&gt;
&lt;/ul&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;h2&gt;Tuesday - crossing our fingers…&lt;/h2&gt;
Rushing into the room I shouted, “I understand what happened. Mongoid is not performing atomic operations on arrays so when two users touch an array at near the same time, the second one wins the update.” “That makes no sense,” the others say rolling their eyes. “Have you tested this?”
&lt;/p&gt;
&lt;p&gt;
“No,” I sigh. “I just know that is what is going on. I’m looking through the code, and timestamps and it is only happening when people are both touching the same data. I also looked at the db logs and the queries on array operation are completely overwriting the arrays and not using the atomic operations.”
&lt;/p&gt;
&lt;p&gt;
“We believe that is an issue, but there has to be something else going on. We’ll fix what you are talking about and then see what happens.” No one believes me, but at least they are willing to prove it, and go along with the fix. The tests took some time, but after the first test we flew threw the rest of the code. The code slims down and gets faster with the fixes in place. Now we just have to wait and see.
&lt;/p&gt;
&lt;p&gt;
&lt;ul&gt;
&lt;li&gt;test users interacting in parallel&lt;/li&gt;
&lt;li&gt;watch for data that can be touched by more than one user at a time&lt;/li&gt;
&lt;li&gt;don’t say “Your idea makes no sense.” Nicely sound surprised and ask them to show you.&lt;/li&gt;
&lt;/ul&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;h2&gt;Wednesday - About time…&lt;/h2&gt;
The beta site is launched. People start signing up and giving us feedback. There are a few tiny bugs found and squashed. We can finally start to plan for the next release, and clean up some of the technical debt we took on to meet this aggressive deadline.
&lt;/p&gt;
&lt;p&gt;
First, make the rescue jobs take in the data they need, and not pull from the db. This will make sure that even if the db is down that the background emails can still go out. This was done quickly, and actually fixed a 404 issue that was coming up.
&lt;/p&gt;
&lt;p&gt;
On second thought we should turn our logging back down, first. Not only do we know it is slowing things down, but it is annoying when we are trying to look at just errors that may appear in the logs.
&lt;/p&gt;
&lt;p&gt;
&lt;ul&gt;
&lt;li&gt;too much logging can be annoying&lt;/li&gt;
&lt;li&gt;logging slows things down more than you think&lt;/li&gt;
&lt;li&gt;give background jobs all the information they need up front, and try not to have them touch the db&lt;/li&gt;
&lt;/ul&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;h2&gt;Thursday - I can’t believe God made it 6 days before resting…&lt;/h2&gt;
I’ve put in close to 100 hours in the last week and a half. My family is missing me and I should really take a day off. I took Wednesday through Friday off, but of course I can’t keep my nose out of it. I am still talking, planning, and working on the site. Most of the things are not that important, and I know the team is smart and can function without me.
&lt;/p&gt;
&lt;p&gt;
I have a lot of pride in my work, and the work of the team. It is so hard to walk away while they are still hard at it. I know they weren’t working over the weekend, and I was, but this is my team. They need me, or do they.
&lt;/p&gt;
&lt;p&gt;
The team gets through the day, mostly on their own. I only shoved my nose in for my own ego.
&lt;/p&gt;
&lt;p&gt;
&lt;ul&gt;
&lt;li&gt;you made sure your team was filled with smart, self motivators for a reason&lt;/li&gt;
&lt;li&gt;let your team shine&lt;/li&gt;
&lt;li&gt;if something goes wrong there is always a way to fix it later&lt;/li&gt;
&lt;/ul&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;h2&gt;Friday - customers, users, and project managers can be a pain…&lt;/h2&gt;
The product manager seems upset because people decided to take the day off or to work from home. I’m happy that someone is finally resting. The customers want something changed ASAP, and all the developers are at home.
&lt;/p&gt;
&lt;p&gt;
Isn’t it always ASAP? It is a small change, but was something that they specifically asked for, and now are realizing how misguided the request was. That really is my fault.
&lt;/p&gt;
&lt;p&gt;
One developer working from home can’t get in to the server to deploy. His ssh key is on the jump box, but he can’t get to the production servers from there. Now a team member calls me when they need me. I appreciate that I have had to do very little today.
&lt;/p&gt;
&lt;p&gt;
Little is an understatement. My youngest daughter (3 yrs old) is throwing up and running a fever. Please don’t let me catch it.
&lt;/p&gt;
&lt;p&gt;
&lt;ul&gt;
&lt;li&gt;upmanage misguided decisions through the project manager or the customer directly&lt;/li&gt;
&lt;li&gt;the team will call you if they need you&lt;/li&gt;
&lt;li&gt;even success is met with grumpy bosses…don’t be one of them&lt;/li&gt;
&lt;ul&gt;
&lt;/p&gt;
&lt;p&gt;
          </content>  </entry>
  <entry xml:base="http://www.dirtyinformation.com/">
    <author>
      <name>Amos</name>
    </author>
    <id>tag:www.dirtyinformation.com,2011-04-12:85</id>
    <published>2011-04-12T13:46:00Z</published>
    <updated>2011-04-14T05:07:35Z</updated>
    <category term="basics"/>
    <category term="best practices"/>
    <category term="principles"/>
    <link href="http://www.dirtyinformation.com/2011/4/12/single-responsibilty-how-did-i-forget-you" rel="alternate" type="text/html"/>
    <title>Single Responsibilty, How Did I Forget You</title>
<content type="html">
            &lt;p&gt;
Sometimes when developing I forget some of the basics as I go along. This time and many times in the past I have forgotten to follow the &lt;a href=&quot;http://en.wikipedia.org/wiki/Single_responsibility_principle&quot;&gt;Single Responsibility Principle&lt;/a&gt;. I always forget it in the same place, the User object.
&lt;/p&gt;

&lt;p&gt;
The User class always appears to be a place to take care of login and logout, but it does so much more. Everytime I need to change the User or expand to multiple types I end up dealing with login issues. It is easy to think that the responsibility of the User is to handle all things related to the User, but logins are not part of the User. The login is the responsibility of the Credentials.
&lt;/p&gt;

&lt;p&gt;
What happens when I need multiple logins to act on behalf of the same user, or when I have multiple user types, but I want to use the same login system. In the past I've always created a User and an AdminUser, with separate logins. Why?...It just felt right, and the AdminUser had different properties than a regular user. Now I have multiple user types that should share some common code. Sweet, a module will do that for me. It still doesn't solve all of my issues. I have to separate logins. What should I have done?
&lt;/p&gt;

&lt;p&gt;
A Credential class should be created and can link to a profile. This allows my Credential class to only change if the login system changes. Each user type can be a separate Profile class. This eases the burden of the user class and allows greater future expandability.
&lt;/p&gt;

&lt;p&gt;
Why didn't I do this in the past? I've run into this problem many times, but never really got it. Now I'd just like to say, &quot;I GET IT!!!&quot;
&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://www.dirtyinformation.com/">
    <author>
      <name>Amos</name>
    </author>
    <id>tag:www.dirtyinformation.com,2010-11-05:82</id>
    <published>2010-11-05T02:23:00Z</published>
    <updated>2010-11-05T12:44:15Z</updated>
    <category term="JavaScript"/>
    <category term="javascript"/>
    <category term="performance"/>
    <link href="http://www.dirtyinformation.com/2010/11/5/change-classes-not-styles" rel="alternate" type="text/html"/>
    <title>Change Classes not Styles</title>
<content type="html">
            &lt;p&gt; I've been working with some javascript lately and wanted to see if it made a difference if I was changing the class or inline style of an element.  I had heard that changing classes was faster, but can it really make a big difference?&lt;/p&gt;

&lt;h2&gt;YES!!!&lt;/h2&gt;

&lt;p&gt;I coded up a quick &lt;a href=&quot;https://gist.github.com/663556&quot;&gt;example&lt;/a&gt;. Here are the results in ms(all on osx):&lt;/p&gt;
&lt;ul&gt;
  &lt;li&gt;Safari 5.0.2
        &lt;ul&gt;
          &lt;li&gt;changing style:123&lt;/li&gt;
          &lt;li&gt;changing class:15 - 87.8% faster&lt;/li&gt;
        &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;Chrome 7.0.517.44
        &lt;ul&gt;
          &lt;li&gt;changing style:115&lt;/li&gt;
          &lt;li&gt;changing class:16 - 86.1% faster&lt;/li&gt;
        &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;Firefox 3.0.15
        &lt;ul&gt;
          &lt;li&gt;changing style:333&lt;/li&gt;
          &lt;li&gt;changing class:99 - 70.3% faster&lt;/li&gt;
        &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;Firefox 3.6.12
        &lt;ul&gt;
          &lt;li&gt;changing style:261&lt;/li&gt;
          &lt;li&gt;changing class:60 - 77% faster&lt;/li&gt;
        &lt;/ul&gt;
  &lt;/li&gt;
  &lt;li&gt;Opera 10.10
        &lt;ul&gt;
          &lt;li&gt;changing style:554&lt;/li&gt;
          &lt;li&gt;changing class:111 - 80% faster&lt;/li&gt;
        &lt;/ul&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I really didn't expect those kinds of results. Kind of amazing!&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://www.dirtyinformation.com/">
    <author>
      <name>Amos</name>
    </author>
    <id>tag:www.dirtyinformation.com,2010-07-20:78</id>
    <published>2010-07-20T23:47:00Z</published>
    <updated>2010-07-20T23:55:19Z</updated>
    <category term="mongodb"/>
    <category term="nosql"/>
    <category term="opensource"/>
    <link href="http://www.dirtyinformation.com/2010/7/20/my-mongodb-cookbook-recipe" rel="alternate" type="text/html"/>
    <title>My MongoDB Cookbook Recipe</title>
<content type="html">
            &lt;p&gt;
  I've been doing some playing with &lt;a href=&quot;http://mongodb.org&quot;&gt;MongoDB&lt;/a&gt; lately. I've grown very fond of the platform, and am looking forward to using it in some of my future projects.  My first gift back to the community is a cookbook &lt;a href=&quot;http://cookbook.mongodb.org/patterns/finding_max_and_min/&quot;&gt;recipe&lt;/a&gt;. I'm hoping that soon I will be able to give some code contributions.
&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://www.dirtyinformation.com/">
    <author>
      <name>Amos</name>
    </author>
    <id>tag:www.dirtyinformation.com,2009-11-05:62</id>
    <published>2009-11-05T02:18:00Z</published>
    <updated>2009-11-05T02:45:03Z</updated>
    <category term="agile"/>
    <link href="http://www.dirtyinformation.com/2009/11/5/agile-says-what" rel="alternate" type="text/html"/>
    <title>Agile Says What?</title>
<content type="html">
            &lt;p&gt;
The other night I spend forty-five minutes on the phone with a friend talking about what agile is.  He hadn't been exposed to the ideas behind agile.  When I started talking I don't think I really hit on what agile IS.  I talked about practices and the way my team works.  He had many of those methods in his experiences but not all of them, and not really in what I would consider agile.  After I got off the phone I noticed that I only talked about practices and not about principles.  So I thought to myself, &quot;What IS agile?&quot;
&lt;/p&gt;
&lt;p&gt;
This is a hard question for me to answer.  Every time I start to think about it I go back to the practices that I use in order to achieve what I consider agile.  That isn't right.  Agile isn't a set of practices, is it?  No it can't be.  The &lt;a href=&quot;http://agilemanifesto.org/&quot;&gt;Agile Manifesto&lt;/a&gt; specifically states &quot;Individuals and interactions over processes and tools.&quot;  If it isn't about processes what is it?
&lt;/p&gt;
&lt;p&gt;
The more I thought the more agile seemed to be nothing more than agility.  Every methodology that I talked about had to do with the ability to change direction at the drop of a hat.  Agile is about reaction.  Not just any reaction, but ones that cause positive change and outcomes.  Agile is about feedback and learning.  After all this...Am I agile?
&lt;/p&gt;
&lt;p&gt;
I am agile.  I am constantly learning from every source at my disposal.  I go looking for ways to improve myself and my product.  I adapt to change.  I am always trying to push the envelope further.  Yet, I can't help but feel that I missing something?  What am I missing?
&lt;/p&gt;
&lt;p&gt;
The one thing that I didn't mention above.  Is it in there somewhere?  Delivering a useable project at any point in development.  That is it.  That is what I'm missing.  This has got to be the hardest part of agile.  No matter what we do it always seems that we are one step away from delivering that product at the drop of a hat.  If the customer says, &quot;I want to deploy now.&quot;  I should be able to happily say, &quot;Already done.&quot;  Not that I don't have software that I can deploy all the time, but what really makes a project &quot;useable?&quot;  Can I deliver something that can be let out into the world every week?
&lt;/p&gt;
&lt;p&gt;
That is my goal.  From this moment forward I'm going to try and guide my project and my customer so that we are always moving forward with usable software.  Not a half done feature at the end of an iteration.  I'm going to try and guide the story selection for my projects so that at the end of each iteration we have something to &quot;useable&quot; to deliver.  Is it possible?
&lt;/p&gt;
&lt;p&gt;
What is useable?  Is this really possible, or is it an ideal that we strive to achieve knowing that it doesn't quite work that way.  Once we have the app in production it is easy to keep that way, but is continuous deployment really possible from day zero?  Can each commit still be tiny yet completely deployable?  What are your thoughts?  Also did I miss anything that defines agile, but isn't a practice/methodology?
&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://www.dirtyinformation.com/">
    <author>
      <name>Amos</name>
    </author>
    <id>tag:www.dirtyinformation.com,2009-11-03:59</id>
    <published>2009-11-03T03:19:00Z</published>
    <updated>2009-11-03T03:34:54Z</updated>
    <category term="articles"/>
    <category term="code review"/>
    <category term="open source"/>
    <category term="team"/>
    <link href="http://www.dirtyinformation.com/2009/11/3/your-code-review" rel="alternate" type="text/html"/>
    <title>Your Code Review</title>
<content type="html">
            &lt;p&gt;
Code reviews are often abused and executed in ways that drive developers mad, but when executed correctly they strength relationships and skill sets.
&lt;/p&gt;
&lt;p&gt;
Have you ever had your code reviewed and walked away feeling upset or pissed?  What was so bad about it?  Is there better way that the reviewer could have expressed their feelings?
&lt;/p&gt;
&lt;p&gt;
Have you ever had a great review?  Did you walk away feeling smarter and more excited about the project?  What did the reviewer do that was so much better than what you have seen from others?
&lt;/p&gt;
&lt;p&gt;
Do you do code reviews?  Do you have a checklist that you follow when completing reviews?  What things should you watch for when looking through code?  Are there any good ways to find the trouble spots in code?
&lt;/p&gt;
&lt;p&gt;
I know I haven't given much except a list of questions, but I'm working on an article and I had to get these out there to help my brain start going.  I'd love to hear what anyone has to say on the subject.  Thanks.
&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://www.dirtyinformation.com/">
    <author>
      <name>Amos</name>
    </author>
    <id>tag:www.dirtyinformation.com,2009-07-09:57</id>
    <published>2009-07-09T04:02:00Z</published>
    <updated>2009-07-09T04:07:04Z</updated>
    <category term="authlogic"/>
    <category term="edge"/>
    <category term="rails"/>
    <category term="Rails"/>
    <link href="http://www.dirtyinformation.com/2009/7/9/authlogic-and-rails-3-0pre" rel="alternate" type="text/html"/>
    <title>Authlogic and Rails 3.0pre</title>
<content type="html">
            &lt;p&gt;
  With some of the moving around of code in Rails 3 Authlogic is broken.  This is a quick fix, and not the solution.  Add the following to your Session class:
&lt;/p&gt;

&lt;pre&gt;
class UserSession &amp;lt; Authlogic::Session::Base
  def self.model_name
    ActiveModel::Name.new(self.to_s)
  end
end
&lt;/pre&gt;

&lt;p&gt;
You should be good to go.  I have to read up on the process for patching authlogic.  Right now it is late and I am sick.  I hope this quick fix gets someone going.
&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://www.dirtyinformation.com/">
    <author>
      <name>Amos</name>
    </author>
    <id>tag:www.dirtyinformation.com,2009-04-22:54</id>
    <published>2009-04-22T17:00:00Z</published>
    <updated>2009-04-22T17:03:30Z</updated>
    <category term="OSS"/>
    <category term="ruby"/>
    <category term="Ruby"/>
    <link href="http://www.dirtyinformation.com/2009/4/22/truly-open-source" rel="alternate" type="text/html"/>
    <title>Truly Open Source</title>
<content type="html">
            &lt;p&gt;
I want to have a project that is truly open source.  So I thought I would try an experiment.  I asked &lt;a href=&quot;http://github.com/defunkt&quot;&gt;defunkt&lt;/a&gt; to completely open &lt;a href=&quot;http://github.com/adkron/legacy_woes&quot;&gt;legacy_woes&lt;/a&gt; up to everyone with a &lt;a href=&quot;http://github.com&quot;&gt;github&lt;/a&gt; account.  So feel free to commit whatever you want, but try to keep it in the scope of the gem/plugin.
&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://www.dirtyinformation.com/">
    <author>
      <name>Amos</name>
    </author>
    <id>tag:www.dirtyinformation.com,2009-02-27:51</id>
    <published>2009-02-27T03:41:00Z</published>
    <updated>2009-02-27T15:28:22Z</updated>
    <category term="code review"/>
    <link href="http://www.dirtyinformation.com/2009/2/27/code-review-continued" rel="alternate" type="text/html"/>
    <title>Code Review Continued</title>
<content type="html">
            &lt;p&gt;
I just sent my coworker and email tried out some of the ideas out of my post from two days ago.  I sent it to him with a little blurb at the top saying that I'm trying out a new method of code review, and I would love his feedback on it.  I would also like some feedback from all of you.  Should I word parts differently?  Should I scrap the whole idea, and start over?  Where can I improve?  Do you have any techniques that you find useful?
&lt;/p&gt;

&lt;p&gt;
The files and names have been changed to protect the innocent.
&lt;/p&gt;



&lt;pre&gt;
FooController

Lines 235, 236, 237 is there a reason why we are raising exceptions here?
When finding by id why did you choose ActiveRecord::Base#find and not ActiveRecord::Base#first?
Is there a reason for choosing a polymorphic relationship and not Single Table Inheritance(STI)?
How could add_comment(265 to 282) differ if you used STI?
Is it possible to utilize both polymorphic and STI, are there any advantages to doing that?

CommentNotificationTemplate

Line 13 - Any reason why this isn't using some kind of url helper method?
Line 13 - Do we need this line at all if there is a helper method to be used in the template?
Lines 28 - 30: Why is this static method even around?

html.erb
Line 12 - Can we use a helper for this?  Or make a route?

text.erb
Line 8 - Same questions about the url that is assigned in the controller.

In the tests there is a factory being used, but everything the factory includes is overridden.  Is there a reason?

The story template test could really benefit from a url helper.

Francis, this is great work.  I love to see that you got rid of the comment fixture.  I think this is a big step in the direction we need to go.  Your code is getting better all the time.  Keep up the good work.
&lt;/pre&gt;



&lt;p&gt;
The follow question was used to provoke thought from the reviewed &quot;is it possible to utilize both polymorphic and STI, are there any advantages to doing that?&quot;  I just want him to think with that one.  Is this a workable tactic?  I would love to help him continue his amazing growth.
&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://www.dirtyinformation.com/">
    <author>
      <name>Amos</name>
    </author>
    <id>tag:www.dirtyinformation.com,2009-02-26:50</id>
    <published>2009-02-26T05:10:00Z</published>
    <updated>2009-02-26T05:24:04Z</updated>
    <category term="integration"/>
    <category term="rails"/>
    <category term="Rails"/>
    <category term="testing"/>
    <link href="http://www.dirtyinformation.com/2009/2/26/organizing-integration-tests" rel="alternate" type="text/html"/>
    <title>Organizing Integration Tests</title>
<content type="html">
            &lt;p&gt;
I've been in meetings all day so I don't have a lot to write about, but I have to keep up with my blog post a day.  So without further ado we need to organize our integration tests.
&lt;/p&gt;
&lt;p&gt;
We've been trying to find out how to better organize our integration testing for a while.  We started out by having each test file organized by the controller involved.  This works fine for small controllers that aren't interacting with other controllers.
&lt;/p&gt;
&lt;p&gt;
My next idea was to organize them by controller method.  That helped slim down a lot of the test files, and put them in a more readable format.  This was a great step but when pages have a lot of functionality this too can become a burden, and make test file become lng and unruly.
&lt;/p&gt;
&lt;p&gt;
Tonight I began work on converting one such test file into functional sections.  We have a page in the project that has a lot of information, forms, links, et al.  I decided that the integration tests for this page should be broken up by functional areas.  Anything outside of a functional area will go into a test file for the overall page.  The overall test file will contain things like breadcrumb link tests, and tests for user access.
&lt;/p&gt;
&lt;p&gt;
Right now we are using &lt;a href=&quot;http://thoughtbot.com/projects/shoulda/&quot;&gt;shoulda&lt;/a&gt; and &lt;a href=&quot;http://github.com/brynary/webrat&quot;&gt;webrat&lt;/a&gt; for our integration testing.  I'm hoping that soon we will have &lt;a href=&quot;http://github.com/aslakhellesoy/cucumber/tree/master&quot;&gt;cucumber&lt;/a&gt; in the mix.
&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://www.dirtyinformation.com/">
    <author>
      <name>Amos</name>
    </author>
    <id>tag:www.dirtyinformation.com,2009-02-25:47</id>
    <published>2009-02-25T04:37:00Z</published>
    <updated>2009-02-25T05:13:28Z</updated>
    <category term="refactor"/>
    <category term="review"/>
    <category term="ruby"/>
    <category term="Ruby"/>
    <category term="tools"/>
    <link href="http://www.dirtyinformation.com/2009/2/25/code-review-toolbox" rel="alternate" type="text/html"/>
    <title>Code Review Toolbox</title>
<content type="html">
            &lt;p&gt;
Doing a code review is difficult for me.  I don't always think of the design implications because I'm trying t hurry and get back to coding.  I have mainly been checking for tests, and functionality.  This needs to change and I think I've got some decent steps to help me make the leap, and use some tools to help illustrate my concerns to my coworkers.
&lt;/p&gt;


  &lt;dt&gt;&lt;a href=&quot;http://jonathanaquino.com/CodeReviews.pdf&quot;&gt;Code Review Cheat Sheet&lt;/a&gt;&lt;/dt&gt;
  &lt;dd&gt;Great points on how to handle a code review without upsetting the developer of that code.&lt;/dd&gt;

 &lt;dt&gt;&lt;a href=&quot;http://ruby.sadi.st/Flog.html&quot;&gt;Flog&lt;/a&gt;&lt;/dt&gt;
  &lt;dd&gt;A 'golf' score for your code.  Anytime code hurts my eyes, flog has a score that backs up my thoughts.  Even without the developer knowing how things are being scored numbers seem to work for us.&lt;/dd&gt;

  &lt;dt&gt;&lt;a href=&quot;http://ruby.sadi.st/Flay.html&quot;&gt;Flay&lt;/a&gt;&lt;/dt&gt;
  &lt;dd&gt;Find violations of the dry principle and often fixing these issues can lower your flog score.&lt;/dd&gt;

  &lt;dt&gt;&lt;a href=&quot;http://github.com/martinjandrews/roodi/tree/master&quot;&gt;Roodi&lt;/a&gt;&lt;dt&gt;
  &lt;dd&gt;Points out OO Design principle issues.  I haven't used this much, but the few test runs I tried came up with some good suggestions.  Really you should just check out the docs for all the things Roodi does.&lt;/dd&gt;

  &lt;dt&gt;&lt;a href=&quot;http://github.com/kevinrutherford/reek/tree/master&quot;&gt;Reek&lt;/a&gt;&lt;dt&gt;
  &lt;dd&gt;Ruby code smell detector.  Reek looks for a lot of common &lt;a href=&quot;http://wiki.github.com/kevinrutherford/reek/code-smells&quot;&gt;code smells&lt;/a&gt; and is easily configureable.&lt;/dd&gt;
&lt;/ul&gt;

&lt;p&gt;
I hope that by bringing a new approach to code reviews I can improve our product, team morale, and the skills of everyone involved.  I will keep you posted on how my toolbox works out.  I'd also welcome any suggestions on source about improving code reviews and/or tools like the above that help focus where I need to spend the most time reviewing.
&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://www.dirtyinformation.com/">
    <author>
      <name>Amos</name>
    </author>
    <id>tag:www.dirtyinformation.com,2009-02-24:44</id>
    <published>2009-02-24T04:59:00Z</published>
    <updated>2009-02-24T05:36:47Z</updated>
    <category term="design principles"/>
    <category term="inheritance"/>
    <category term="refactor"/>
    <link href="http://www.dirtyinformation.com/2009/2/24/inheritance-i-am-done-with-you" rel="alternate" type="text/html"/>
    <title>Inheritance, I am Done With You</title>
<content type="html">
            &lt;p&gt;
I'm so tired of running into issues with inheritance.  I avoid it like the plague, but unfortunately I have to deal with it in some of the code I work with.  Tonight is the night that I lower my tolerance level for inheritance.
&lt;/p&gt;
&lt;p&gt;
I used to think deep inheritance was the only issue.  Tonight I was trying to refactor a controller class, but every time I changed something  a bunch of other controllers would break.  I can handle this for a little while, but this is really starting to get annoying.  One level of inheritance still causing pain.  The final straw was when I tried to add a before filter to the to controller and all my show methods in the other controllers quit working. 
&lt;/p&gt;
&lt;p&gt;
Now I'm off to convince the rest of the team to lower their tolerance levels.  We all knows it's bad, but we need to stop drinking a case a day.
&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://www.dirtyinformation.com/">
    <author>
      <name>Amos</name>
    </author>
    <id>tag:www.dirtyinformation.com,2009-02-23:43</id>
    <published>2009-02-23T04:04:00Z</published>
    <updated>2009-02-23T04:10:02Z</updated>
    <category term="self improvement"/>
    <link href="http://www.dirtyinformation.com/2009/2/23/getting-better-at-writing" rel="alternate" type="text/html"/>
    <title>Getting Better at Writing</title>
<content type="html">
            &lt;p&gt;
I'd really like to get better at writing, and get more of the thoughts out that are always clogging up my brain.  My wife is an English teacher and I could have her proof everything, but I don't want to bother her with that.  Since practice makes perfect, I'm going to try to write something every day!  I'm just warning anyone who might actually read this stuff, you might see a lot of gibberish posts when I'm just trying to force something out.
&lt;/p&gt;
          </content>  </entry>
  <entry xml:base="http://www.dirtyinformation.com/">
    <author>
      <name>Amos</name>
    </author>
    <id>tag:www.dirtyinformation.com,2009-02-23:42</id>
    <published>2009-02-23T03:40:00Z</published>
    <updated>2009-02-23T04:04:13Z</updated>
    <category term="REST"/>
    <link href="http://www.dirtyinformation.com/2009/2/23/sup" rel="alternate" type="text/html"/>
    <title>SUP</title>
<content type="html">
            &lt;p&gt;Stop URL Parameters(SUP)&lt;/p&gt;
&lt;p&gt;
Any time I see a ?foo=bar in a url I get so frustrated.  I'm especially irritated when it the parameters came from a form.  Let's stop this horrible practice.  If you need parameters great, but pass them with a post or as part of the regular url.
&lt;/p&gt;
&lt;p&gt;
I've seen this happening at an increasing rate.  It usually comes with someone trying to follow RESTful principles with their code, but becoming confused along the way.  Here is an example:
&lt;p&gt;
&lt;ul&gt;
  &lt;li&gt;I have a few reports that I want to display based on some dates&lt;/li&gt;
  &lt;li&gt;...I know...that is a &quot;show&quot; method since I'm &quot;showing&quot; data to the user&lt;/li&gt;
  &lt;li&gt;Now I need the report to be based on a date range.&lt;/li&gt;
  &lt;li&gt;I also need a select box for the report type to be chosen.&lt;/li&gt;
  &lt;li&gt;I'll make a form that posts to this action here, and then it will redirect to the correct report.&lt;/li&gt;
  &lt;li&gt;hmm...How am I going to pass those dates along...Eureka! I'll just put  ?start_date=foo&amp;end_date=bar on my URL&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
Now is the time to say STOP!  Why do you want to do this.  Sit back, and rethink your actions.  Starting down the path of just tossing the parameters into the url can lead to many problems.  It is like a gateway drug.  It seems so easy and useful the first time, and now you've got secure data in the url, and a horrible API, and we won't even talk about error handling and the back-end code that is making this up.  Now that your boss is angry that you passed an SSN in the url you would like to go back and fix this issue once and for all.
&lt;/p&gt;
&lt;p&gt;
It is OK to display data with a create or update.  If you have a mental block on this think of it as creating the report.  Then instead of having a new controller for each report, and a show action for each have the create action render a specific template based on the report selected.  The partial can even be the name of the report, then you don't need an if/case block.  Now you've got one small method that is handling all the reports.  If they are complicated create some models for the reports, and your set.
&lt;/p&gt;
&lt;p&gt;
I've been wanting to get that off my chest.
&lt;p&gt;
          </content>  </entry>
  <entry xml:base="http://www.dirtyinformation.com/">
    <author>
      <name>Amos</name>
    </author>
    <id>tag:www.dirtyinformation.com,2009-01-15:39</id>
    <published>2009-01-15T00:18:00Z</published>
    <updated>2009-01-15T00:39:47Z</updated>
    <category term="articles"/>
    <category term="rails"/>
    <category term="Rails"/>
    <category term="ruby"/>
    <category term="Ruby"/>
    <category term="testing"/>
    <link href="http://www.dirtyinformation.com/2009/1/15/let-me-test-your-rails-ruby-app" rel="alternate" type="text/html"/>
    <title>Let Me Test Your Rails/Ruby App</title>
<content type="html">
            &lt;p&gt;
I'm going to be doing some writing for a few magazines and I would like to write tests for you.  If you have a part of your app that is particularly hard to test and you would like some help, send me the whole app or just the parts that are pertinent.
&lt;/p&gt;
&lt;p&gt;
I know what you might be thinking, &quot;Who does this guy think he is?&quot;  I'm a full time Rails developer on an application that must support Oracle and MySql.  I also must interact with a Java side and a ten year old database. Here is the read out from 'rake stats' and 'time rake test.'
&lt;/p&gt;
&lt;pre&gt;
Unit tests: 1965 tests, 4358 assertions, 0 failures, 0 errors
Functional tests: 705 tests, 2567 assertions, 0 failures, 0 errors
Integration tests: 202 tests, 303 assertions, 0 failures, 0 errors
real	2m58.057s
user	2m13.305s
sys	0m12.093s

+----------------------+-------+-------+---------+---------+-----+-------+
| Name                 | Lines |   LOC | Classes | Methods | M/C | LOC/M |
+----------------------+-------+-------+---------+---------+-----+-------+
| Controllers          |  4361 |  3711 |      69 |     379 |   5 |     7 |
| Helpers              |  1025 |   852 |       0 |     127 |   0 |     4 |
| Models               |  4301 |  3490 |      87 |     460 |   5 |     5 |
| Libraries            |  7294 |  5192 |      78 |     483 |   6 |     8 |
| Integration tests    |  2004 |  1741 |      24 |      20 |   0 |    85 |
| Functional tests     |  7855 |  5878 |      97 |     564 |   5 |     8 |
| Unit tests           |  9356 |  7283 |     108 |     673 |   6 |     8 |
+----------------------+-------+-------+---------+---------+-----+-------+
| Total                | 36196 | 28147 |     463 |    2706 |   5 |     8 |
+----------------------+-------+-------+---------+---------+-----+-------+
  Code LOC: 13245     Test LOC: 14902     Code to Test Ratio: 1:1.1

&lt;/pre&gt;
&lt;p&gt;
You can hit me up on &lt;a href=&quot;http://twitter.com/adkron&quot;&gt;Twitter&lt;/a&gt; or email at gmail to amos.l.king.
&lt;p&gt;
          </content>  </entry>
</feed>

