I don't know how to label this pattern.
-
I can't for the life of me figure out why someone would do this. It's not awful or subtly wrong, just kind of deranged. :doh:
DocumentInformation ldocInfo = new DocumentInformation(); ldocInfo.DocumentID = Convert.ToInt32(agmTemplateId); if (ldocInfo.DocumentID != 0) { section.Items.Add(PageHelpers.CreateSidebarItem("AGM plan", "/GetFile.aspx?DocumentId=" + ldocInfo.DocumentID, true, "cmdAGMTemplate", false)); } ldocInfo.DocumentID = Convert.ToInt32(proposalTemplateId); if (ldocInfo.DocumentID != 0) { section.Items.Add(PageHelpers.CreateSidebarItem("Proposal", "/GetFile.aspx?DocumentId=" + ldocInfo.DocumentID, true, "cmdProposal", false)); }
Curvature of the Mind now with 3D
-
I can't for the life of me figure out why someone would do this. It's not awful or subtly wrong, just kind of deranged. :doh:
DocumentInformation ldocInfo = new DocumentInformation(); ldocInfo.DocumentID = Convert.ToInt32(agmTemplateId); if (ldocInfo.DocumentID != 0) { section.Items.Add(PageHelpers.CreateSidebarItem("AGM plan", "/GetFile.aspx?DocumentId=" + ldocInfo.DocumentID, true, "cmdAGMTemplate", false)); } ldocInfo.DocumentID = Convert.ToInt32(proposalTemplateId); if (ldocInfo.DocumentID != 0) { section.Items.Add(PageHelpers.CreateSidebarItem("Proposal", "/GetFile.aspx?DocumentId=" + ldocInfo.DocumentID, true, "cmdProposal", false)); }
Curvature of the Mind now with 3D
What does the DocumentInformation class/struct look like?
Keep Clam And Proofread -- √(-1) 23 ∑ π... And it was delicious.
-
What does the DocumentInformation class/struct look like?
Keep Clam And Proofread -- √(-1) 23 ∑ π... And it was delicious.
It's just a data object with about 10 other properties. None of the getters or setters have any hidden side effects. My guess is that they thought they were going to have to use the object to do some kind of data lookup, but didn't switch it to an integer when they didn't have to.
Curvature of the Mind now with 3D
-
I can't for the life of me figure out why someone would do this. It's not awful or subtly wrong, just kind of deranged. :doh:
DocumentInformation ldocInfo = new DocumentInformation(); ldocInfo.DocumentID = Convert.ToInt32(agmTemplateId); if (ldocInfo.DocumentID != 0) { section.Items.Add(PageHelpers.CreateSidebarItem("AGM plan", "/GetFile.aspx?DocumentId=" + ldocInfo.DocumentID, true, "cmdAGMTemplate", false)); } ldocInfo.DocumentID = Convert.ToInt32(proposalTemplateId); if (ldocInfo.DocumentID != 0) { section.Items.Add(PageHelpers.CreateSidebarItem("Proposal", "/GetFile.aspx?DocumentId=" + ldocInfo.DocumentID, true, "cmdProposal", false)); }
Curvature of the Mind now with 3D
I guess the author thought, that for some reason the variable name (DocumentID) must be the same as in the command string he assigns it to. Why someone would think that is beyond me.
The good thing about pessimism is, that you are always either right or pleasently surprised.