Put that puts away - No Fluff Just Stuff

Put that puts away

Posted by: Venkat Subramaniam on April 25, 2006

I got a nasty bug report on a recently deployed Rails application. The application failed when a user
enters an incorrect user id and clicks on forgot password. What?s weird about this is the problem did not
happen:
(a) when the user enters invalid user id and clicks on login (gave a good error message)
(b) the exact situation on my development machine has no problem ? again gave correct error message

What?s going wrong on production?

After scratching my head for a few minutes, it occurred to me the only major difference is, I am using WebBrick
on my dev machine and Apache on production. After a hunch, going over log files, and looking over the
code, I discovered that one lonely puts statement that I had inadvertently left behind in the code!
I had used puts to display some information on WebBrick console and forgot to get rid of it. This puts didn't
cause any problem on production except in this one particular case. Got the puts removed and the
application is functioning OK now. Lessons learned from that pesky puts. Next time, I may use the logger or
put the puts with a condition around. I'm sure there are other better ways I've not explored. Where's the book...

Venkat Subramaniam

About Venkat Subramaniam

Dr. Venkat Subramaniam is an award-winning author, founder of Agile Developer, Inc., creator of agilelearner.com, and an instructional professor at the University of Houston.

He has trained and mentored thousands of software developers in the US, Canada, Europe, and Asia, and is a regularly-invited speaker at several international conferences. Venkat helps his clients effectively apply and succeed with sustainable agile practices on their software projects.

Venkat is a (co)author of multiple technical books, including the 2007 Jolt Productivity award winning book Practices of an Agile Developer. You can find a list of his books at agiledeveloper.com. You can reach him by email at venkats@agiledeveloper.com or on twitter at @venkat_s.

Why Attend the NFJS Tour?

  • » Cutting-Edge Technologies
  • » Agile Practices
  • » Peer Exchange

Current Topics:

  • Languages on the JVM: Scala, Groovy, Clojure
  • Enterprise Java
  • Core Java, Java 8
  • Agility
  • Testing: Geb, Spock, Easyb
  • REST
  • NoSQL: MongoDB, Cassandra
  • Hadoop
  • Spring 4
  • Cloud
  • Automation Tools: Gradle, Git, Jenkins, Sonar
  • HTML5, CSS3, AngularJS, jQuery, Usability
  • Mobile Apps - iPhone and Android
  • More...
Learn More »