But it works?! - No Fluff Just Stuff

But it works?!

Posted by: Venkat Subramaniam on February 19, 2006

You probably heard of the patient who went to see the doctor for a general checkup. The doctor
examined the patient, ran some tests, analyzed results, and came back with a list of things that
don?t look good. The patient said ?Hey Doc, but, I was feeling really good until I walked in here.?

I heard a software version of that recently ?Hey Doc, but, this application has been running fine
for two years.? (Actually, as I learned later, they had seen sporadic problems, but none repeatable).

I was reviewing a multi user application and found global/static objects being used without any
synchronization.

I get nervous when I see static or global variables in server side applications. I am not saying don?t
use static members. They're good for read-only information, for example. However, in this case, the
global object, deep inside, had some variables which methods liberally modified.

Synchronization is particularly not what I would recommend in this case either. There was really no
reason to share this object, and then end up with a need to take care of concurrency.

I know as developers we try to save resources, get convinced that some patterns and practices are
really good to use. And they are at times. But, we need to evaluate what's right for the problem on hand.

And, just because our application runs, it doesn't mean it's correct. That?s like crossing the red light and
claiming it?s safe. It is safe until the day Karma kicks in. If you are lucky you find the problem during
development and testing. If you're not so lucky, it happens at the worst possible time in production.

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 »