Yesterday, I had a somewhat strange experience. I was helping someone with a problem they were having and, almost as a side note, this individual thought he would share some code with me that he was particularly proud of. He even prefaced the story with the “not to brag or anything” phrase. He had written some custom code to help text boxes grow or shrink depending on how the user resized the window. If you know anything about WinForms, you’ll know that some simple anchoring techniques and good use of the SplitContainer will solve this problem for you - please, please, please don’t go writing custom mathematical equations when the framework can take care of it for you.
At the time, I was pretty annoyed with it, because this individual was bragging about something that I considered “the wrong way to do it.” In retrospect, this probably was the wrong response. Why? Because he was proud of some of the code he had written. He actually cared about it enough to not just treat it as something to toss off on to someone else when he moved to the next project.
In all of this, I have learned to be very careful of the code I’m proud of. Inevitably, if you’re growing as a developer by “sucking less every year,” you’re not going to be too proud of your code in a year or two anyway.
Do you have any code you’re particularly proud of? If it turned out to be the “wrong way to do it” but you learned a lot from the experience, you get bonus points.