Imma Switch, Imma Switch, Imma Imma Imma Switch
-
Just came across this SQL stored procedure (decluttered and anonymized):
CREATE PROCEDURE SomeProcedure
@switch AS int
AS
BEGIN
IF @switch = 1
BEGIN
-- Giant complicated SELECT on a single line.
END
ELSE
BEGIN
-- Another giant complicated SELECT on a single line.
END
ENDThis pattern is repeated with many stored procedures. The variable "switch" was really called that and there were absolutely no comments of what that variable is supposed to toggle. At least the name hints that it toggles... surely I'd have been unable to figure that out from the IF statement. If this were a language with booleans, I'm certain they'd have named the variable "aBool". :doh:
-
Just came across this SQL stored procedure (decluttered and anonymized):
CREATE PROCEDURE SomeProcedure
@switch AS int
AS
BEGIN
IF @switch = 1
BEGIN
-- Giant complicated SELECT on a single line.
END
ELSE
BEGIN
-- Another giant complicated SELECT on a single line.
END
ENDThis pattern is repeated with many stored procedures. The variable "switch" was really called that and there were absolutely no comments of what that variable is supposed to toggle. At least the name hints that it toggles... surely I'd have been unable to figure that out from the IF statement. If this were a language with booleans, I'm certain they'd have named the variable "aBool". :doh:
:doh: Some people just should not be allowed near a computer.
public class SysAdmin : Employee
{public override void DoWork(IWorkItem workItem) { if (workItem.User.Type == UserType.NoLearn){ throw new NoIWillNotFixYourComputerException(new Luser(workItem.User)); }else{ base.DoWork(workItem); } }
}