dreadedmonkeygod . net

Ack! No! No! No!

When I was an undergrad, I was in a class where the teacher went on about the security problems in Windows, and how the Windows Registry was a poor implementation. "The irony here," he told us, "is that the Registry solves a problem that isn't new, and has several known good solutions. It is your responsibility as a programmer to understand this, and to seek out known solutions to the challenges you encounter."

So I can't help but grind my teeth when I see this in the tutorial for displaytag:

<%
      Connection con = ...; // just open a connection

      Statement stmt = con.createStatement();
      ResultSet rs = stmt.executeQuery("SELECT * from table");
      RowSetDynaClass resultSet = new RowSetDynaClass(rs, false);
      stmt.close();
      con.close();
      request.setAttribute("results", resultSet);
%>

      <display:table name="requestScope.results.rows" />

And this in CSS tutorial:

.redtext {
  color: #FF0000;
}

In writing a tutorial, you have assumed the mantle of Teacher. You have a responsibility to adhere to common Best Practices. Either make your example code unimpeachable, or advise the student that you are taking a shortcut you don't recommend in general practice.

I'm just annoyed because I've had to work with too many coders who have taken these ill-advised lessons to heart. I have to struggle with them to keep the code readable, maintainable. And in the end, after I've spent countless hours refactoring, rebuilding, and debugging their code, and generally doing their job for them, they always say the same thing: "See? I told you we'd be fine."

Grrrrrrrrrrrrrrr...

Post a Comment

Name:
Email (Never, ever displayed.)
URL:
Remember me next time.
Comments (Sorry, no HTML allowed. Space paragraphs with a blank line.):