3

There's a right way, and a wrong way...

Correct:

if (version <= OLD_VERSION) {
... do_something_old ...
}
else { ... something new ... }

The wrong way:

if (version = NEW_VERSION) {
... do something new ...
} else { ... do something old ... }

What my standup report is today:
I'm modifying thousands of lines of SQL code because the script was hard-coded to only work on SQL Server 2008 R2, and we're using SQL 2017 in our test environment. All of those lines now fail because we don't match your "new version" number.

Comments
  • 1
    Noo. Check the version before even getting into the old method and cut there
  • 0
    @Kimmax there are a bunch of better ways than any of this, this one had the fastest refactor time though.
  • 0
    @juneeighteen When you're refactoring already, why not spend the extra time and do it properly
  • 0
    @Kimmax I work for a startup company where going over on your estimate costs big $$. I already blew out my buffer on this project diagnosing the issue.
Add Comment