You're already late
-
Last week, I was asked to change an old tasks report, adding a parameter for the completion status of a task. As it was my first task on this feature, I have been advised by the project's analyst that the report was showing only the overdue tasks. As I moved to find and change the hardcoded status to the one selected on the UI, I've seen a call to a static method
Status TaskStatus.GetEnum()
, which would translate the selected option to the corresponding value from aStatus
enum (ok, I know, it sounds obvious). Actually, it was already being applied to the report, but the query was ignoring the status parameter anyway. Then I decided to look into that method, and found this:public class TaskStatus { public enum Status { OVERDUE, CLOSED, ON\_TIME } public static Status GetEnum(string name) { switch (name) { case "": return Status.OVERDUE; default: return Status.OVERDUE; } } }
Update: added some context.
modified on Thursday, August 26, 2010 11:38 PM
-
Last week, I was asked to change an old tasks report, adding a parameter for the completion status of a task. As it was my first task on this feature, I have been advised by the project's analyst that the report was showing only the overdue tasks. As I moved to find and change the hardcoded status to the one selected on the UI, I've seen a call to a static method
Status TaskStatus.GetEnum()
, which would translate the selected option to the corresponding value from aStatus
enum (ok, I know, it sounds obvious). Actually, it was already being applied to the report, but the query was ignoring the status parameter anyway. Then I decided to look into that method, and found this:public class TaskStatus { public enum Status { OVERDUE, CLOSED, ON\_TIME } public static Status GetEnum(string name) { switch (name) { case "": return Status.OVERDUE; default: return Status.OVERDUE; } } }
Update: added some context.
modified on Thursday, August 26, 2010 11:38 PM
-
Last week, I was asked to change an old tasks report, adding a parameter for the completion status of a task. As it was my first task on this feature, I have been advised by the project's analyst that the report was showing only the overdue tasks. As I moved to find and change the hardcoded status to the one selected on the UI, I've seen a call to a static method
Status TaskStatus.GetEnum()
, which would translate the selected option to the corresponding value from aStatus
enum (ok, I know, it sounds obvious). Actually, it was already being applied to the report, but the query was ignoring the status parameter anyway. Then I decided to look into that method, and found this:public class TaskStatus { public enum Status { OVERDUE, CLOSED, ON\_TIME } public static Status GetEnum(string name) { switch (name) { case "": return Status.OVERDUE; default: return Status.OVERDUE; } } }
Update: added some context.
modified on Thursday, August 26, 2010 11:38 PM
There could be a seperate section for Coding Doh's :doh: The difference between a Coding Horror and a Coding Doh! is subtle. Both involve the desire to slap a programmer in the head. With a Coding Doh! the programmer wants to slap themselves, with a Coding Horror another programmer feels the urge to administer the slap.
-
There could be a seperate section for Coding Doh's :doh: The difference between a Coding Horror and a Coding Doh! is subtle. Both involve the desire to slap a programmer in the head. With a Coding Doh! the programmer wants to slap themselves, with a Coding Horror another programmer feels the urge to administer the slap.
Unfortunately, I think the programmer didn't remember to slap himself...
-
Last week, I was asked to change an old tasks report, adding a parameter for the completion status of a task. As it was my first task on this feature, I have been advised by the project's analyst that the report was showing only the overdue tasks. As I moved to find and change the hardcoded status to the one selected on the UI, I've seen a call to a static method
Status TaskStatus.GetEnum()
, which would translate the selected option to the corresponding value from aStatus
enum (ok, I know, it sounds obvious). Actually, it was already being applied to the report, but the query was ignoring the status parameter anyway. Then I decided to look into that method, and found this:public class TaskStatus { public enum Status { OVERDUE, CLOSED, ON\_TIME } public static Status GetEnum(string name) { switch (name) { case "": return Status.OVERDUE; default: return Status.OVERDUE; } } }
Update: added some context.
modified on Thursday, August 26, 2010 11:38 PM
-
Last week, I was asked to change an old tasks report, adding a parameter for the completion status of a task. As it was my first task on this feature, I have been advised by the project's analyst that the report was showing only the overdue tasks. As I moved to find and change the hardcoded status to the one selected on the UI, I've seen a call to a static method
Status TaskStatus.GetEnum()
, which would translate the selected option to the corresponding value from aStatus
enum (ok, I know, it sounds obvious). Actually, it was already being applied to the report, but the query was ignoring the status parameter anyway. Then I decided to look into that method, and found this:public class TaskStatus { public enum Status { OVERDUE, CLOSED, ON\_TIME } public static Status GetEnum(string name) { switch (name) { case "": return Status.OVERDUE; default: return Status.OVERDUE; } } }
Update: added some context.
modified on Thursday, August 26, 2010 11:38 PM
Well, I can see how that could happen. You code up a
switch
statement with onecase
and adefault
, then get interrupted by something. By the time you get back to coding, you forgot about that and no one complained, so ... Not that it ever happened to me, mind you. :^) :wtf:CQ de W5ALT
Walt Fair, Jr., P. E. Comport Computing Specializing in Technical Engineering Software
-
Well, I can see how that could happen. You code up a
switch
statement with onecase
and adefault
, then get interrupted by something. By the time you get back to coding, you forgot about that and no one complained, so ... Not that it ever happened to me, mind you. :^) :wtf:CQ de W5ALT
Walt Fair, Jr., P. E. Comport Computing Specializing in Technical Engineering Software
The author of that code has left the company long ago, so I showed it to my colleagues, trying to figure it out, and some of us agreed that he probably had to restrict the report to overdue tasks, and made it in a totally inappropriate place in code. :doh: This feature has not been used till now, when the customer requested the change that finally came to my desk. Again, without restricting, but now filtering the status... If you're ever curious about the horror, I have deleted the method.
-
There could be a seperate section for Coding Doh's :doh: The difference between a Coding Horror and a Coding Doh! is subtle. Both involve the desire to slap a programmer in the head. With a Coding Doh! the programmer wants to slap themselves, with a Coding Horror another programmer feels the urge to administer the slap.
Richard A. Dalton wrote:
Both involve the desire to slap a programmer in the head.
One with the hand, the other with a hammer?
Agh! Reality! My Archnemesis![^]
| FoldWithUs! | sighist | WhoIncludes - Analyzing C++ include file hierarchy -
Well, I can see how that could happen. You code up a
switch
statement with onecase
and adefault
, then get interrupted by something. By the time you get back to coding, you forgot about that and no one complained, so ... Not that it ever happened to me, mind you. :^) :wtf:CQ de W5ALT
Walt Fair, Jr., P. E. Comport Computing Specializing in Technical Engineering Software
Which is why TDD is so good. If you get interrupted, run your tests and you know where you are in your coding.