Dirty Code
-
Argh. I'm working on a piece of software that was written by a junior colleague not long after he started. It was meant to kinda "break him in" but no-one reviewed his code. Reading through it is a nightmare. I can fully appreciate that it's not his fault that no-one reviewed his code (even though they were supposed to) but what I don't get is that he's left his code littered with useless comments, commented out code that he didn't need and wrapped them in regions marked "To Delete". It's doing my head in. Why didn't he just delete them? They have no purpose & we use source control for a reason! I'm going to use it as an opportunity to try and grow him into a better coder (I know I sucked when I started too) instead of just throwing my toys outta the cot. I might check up on some of his more recent contributions too. No real point to this post, just needed to get it off my chest.
But fortunately we have the nanny-state politicians who can step in to protect us poor stupid consumers, most of whom would not know a JVM from a frozen chicken. Bruce Pierson
Because programming is an art, not a science. Marc Clifton
I gave up when I couldn't spell "egg". Justine Allen -
Argh. I'm working on a piece of software that was written by a junior colleague not long after he started. It was meant to kinda "break him in" but no-one reviewed his code. Reading through it is a nightmare. I can fully appreciate that it's not his fault that no-one reviewed his code (even though they were supposed to) but what I don't get is that he's left his code littered with useless comments, commented out code that he didn't need and wrapped them in regions marked "To Delete". It's doing my head in. Why didn't he just delete them? They have no purpose & we use source control for a reason! I'm going to use it as an opportunity to try and grow him into a better coder (I know I sucked when I started too) instead of just throwing my toys outta the cot. I might check up on some of his more recent contributions too. No real point to this post, just needed to get it off my chest.
But fortunately we have the nanny-state politicians who can step in to protect us poor stupid consumers, most of whom would not know a JVM from a frozen chicken. Bruce Pierson
Because programming is an art, not a science. Marc Clifton
I gave up when I couldn't spell "egg". Justine AllenDave Sexton wrote:
commented out code that he didn't need and wrapped them in regions marked "To Delete"
i've worked many places where it was common to leave dead code in there forever... JUST IN CASE!!! the idea seemed to be that if you deleted it, people might not know to check SS old versions, to see if the code was in there, when the time came to put the code back to use.
-
Dave Sexton wrote:
commented out code that he didn't need and wrapped them in regions marked "To Delete"
i've worked many places where it was common to leave dead code in there forever... JUST IN CASE!!! the idea seemed to be that if you deleted it, people might not know to check SS old versions, to see if the code was in there, when the time came to put the code back to use.
I have to admit that I have an urge to leave commented code there... I always use version control with decent log messages, still I'm always tempted to keep everything. :-O
If you truly believe you need to pick a mobile phone that "says something" about your personality, don't bother. You don't have a personality. A mental illness, maybe - but not a personality. - Charlie Brooker My Photos/CP Flickr Group - ScrewTurn Wiki v3
-
Argh. I'm working on a piece of software that was written by a junior colleague not long after he started. It was meant to kinda "break him in" but no-one reviewed his code. Reading through it is a nightmare. I can fully appreciate that it's not his fault that no-one reviewed his code (even though they were supposed to) but what I don't get is that he's left his code littered with useless comments, commented out code that he didn't need and wrapped them in regions marked "To Delete". It's doing my head in. Why didn't he just delete them? They have no purpose & we use source control for a reason! I'm going to use it as an opportunity to try and grow him into a better coder (I know I sucked when I started too) instead of just throwing my toys outta the cot. I might check up on some of his more recent contributions too. No real point to this post, just needed to get it off my chest.
But fortunately we have the nanny-state politicians who can step in to protect us poor stupid consumers, most of whom would not know a JVM from a frozen chicken. Bruce Pierson
Because programming is an art, not a science. Marc Clifton
I gave up when I couldn't spell "egg". Justine AllenI sometimes do that, actually... When maintaining old code and replacing bits of it, I'll sometimes leave the old version in there and commented. It's not to keep a record in case we have to revert, but rather to let anyone reading the code know WHY the code was done a certain way. Kind of implies, "Yes, this would be the OBVIOUS solution, but we used to do it this way and it didn't work because ______" So when I look at the new code a year later when something needs to be tweaked, I won't think, "Well, that's a silly way to do it! This would be much more efficient!" and make the old mistake again.
Proud to have finally moved to the A-Ark. Which one are you in? Author of Guardians of Xen (Sci-Fi/Fantasy novel)
-
Argh. I'm working on a piece of software that was written by a junior colleague not long after he started. It was meant to kinda "break him in" but no-one reviewed his code. Reading through it is a nightmare. I can fully appreciate that it's not his fault that no-one reviewed his code (even though they were supposed to) but what I don't get is that he's left his code littered with useless comments, commented out code that he didn't need and wrapped them in regions marked "To Delete". It's doing my head in. Why didn't he just delete them? They have no purpose & we use source control for a reason! I'm going to use it as an opportunity to try and grow him into a better coder (I know I sucked when I started too) instead of just throwing my toys outta the cot. I might check up on some of his more recent contributions too. No real point to this post, just needed to get it off my chest.
But fortunately we have the nanny-state politicians who can step in to protect us poor stupid consumers, most of whom would not know a JVM from a frozen chicken. Bruce Pierson
Because programming is an art, not a science. Marc Clifton
I gave up when I couldn't spell "egg". Justine AllenI feel your pain, we have a medium sized project that was written by a newbie to .NET (but with a few years of Java under his belt) & someone with 8 years of .netting. The theory was the experienced guy would bring along the new one, but the experienced coder seemed to have only used .net 1.1 and neither had proper adult supervision. Eventually, as the timescales slipped they stopped working together. Net result: Datasets everywhere, no sense of OO and plenty of Javaesque "GetProperty()" and "SetProperty(object val)" style methods with no actual properties. Neither had experience of application design and obviously didn't know what they are doing with WCF (until I sorted it, we could only have maximum of 10 users). I'm now expected to sort this cr*p out.
Dave Sexton wrote:
I'm going to use it as an opportunity to try and grow him into a better coder (I know I sucked when I started too) instead of just throwing my toys outta the cot. I might check up on some of his more recent contributions too.
Good. Try refactoring some of his code in front of him so he get the idea, then let him drive and guide him to make the changes. Have some :beer::beer::beer: on me
CCC solved so far: 2 (including a Hard One!) 37!?!! - Randall, Clerks
-
I feel your pain, we have a medium sized project that was written by a newbie to .NET (but with a few years of Java under his belt) & someone with 8 years of .netting. The theory was the experienced guy would bring along the new one, but the experienced coder seemed to have only used .net 1.1 and neither had proper adult supervision. Eventually, as the timescales slipped they stopped working together. Net result: Datasets everywhere, no sense of OO and plenty of Javaesque "GetProperty()" and "SetProperty(object val)" style methods with no actual properties. Neither had experience of application design and obviously didn't know what they are doing with WCF (until I sorted it, we could only have maximum of 10 users). I'm now expected to sort this cr*p out.
Dave Sexton wrote:
I'm going to use it as an opportunity to try and grow him into a better coder (I know I sucked when I started too) instead of just throwing my toys outta the cot. I might check up on some of his more recent contributions too.
Good. Try refactoring some of his code in front of him so he get the idea, then let him drive and guide him to make the changes. Have some :beer::beer::beer: on me
CCC solved so far: 2 (including a Hard One!) 37!?!! - Randall, Clerks
keefb wrote:
obviously didn't know what they are doing with WCF
Every time I work with WCF I have the impression that I don't know what I am doing. The thing seems to work anyway. :~
If you truly believe you need to pick a mobile phone that "says something" about your personality, don't bother. You don't have a personality. A mental illness, maybe - but not a personality. - Charlie Brooker My Photos/CP Flickr Group - ScrewTurn Wiki v3
-
I sometimes do that, actually... When maintaining old code and replacing bits of it, I'll sometimes leave the old version in there and commented. It's not to keep a record in case we have to revert, but rather to let anyone reading the code know WHY the code was done a certain way. Kind of implies, "Yes, this would be the OBVIOUS solution, but we used to do it this way and it didn't work because ______" So when I look at the new code a year later when something needs to be tweaked, I won't think, "Well, that's a silly way to do it! This would be much more efficient!" and make the old mistake again.
Proud to have finally moved to the A-Ark. Which one are you in? Author of Guardians of Xen (Sci-Fi/Fantasy novel)
Ian Shlasko wrote:
So when I look at the new code a year later when something needs to be tweaked, I won't think, "Well, that's a silly way to do it! This would be much more efficient!" and make the old mistake again.
This I can understand and almost agree with. Problem in my case is that he's left truly redundant code.
But fortunately we have the nanny-state politicians who can step in to protect us poor stupid consumers, most of whom would not know a JVM from a frozen chicken. Bruce Pierson
Because programming is an art, not a science. Marc Clifton
I gave up when I couldn't spell "egg". Justine Allen -
Argh. I'm working on a piece of software that was written by a junior colleague not long after he started. It was meant to kinda "break him in" but no-one reviewed his code. Reading through it is a nightmare. I can fully appreciate that it's not his fault that no-one reviewed his code (even though they were supposed to) but what I don't get is that he's left his code littered with useless comments, commented out code that he didn't need and wrapped them in regions marked "To Delete". It's doing my head in. Why didn't he just delete them? They have no purpose & we use source control for a reason! I'm going to use it as an opportunity to try and grow him into a better coder (I know I sucked when I started too) instead of just throwing my toys outta the cot. I might check up on some of his more recent contributions too. No real point to this post, just needed to get it off my chest.
But fortunately we have the nanny-state politicians who can step in to protect us poor stupid consumers, most of whom would not know a JVM from a frozen chicken. Bruce Pierson
Because programming is an art, not a science. Marc Clifton
I gave up when I couldn't spell "egg". Justine AllenI sometimes comment out small blocks of code - like a few lines, if I think its useful to refer back to, to see the way something used to work without relying on someone looking in version history to see. But in our project there are lots of large (several hundred line) functions which aren't called from anywhere. In many cases the function has been copied and pasted and there might be a V1, V2 and V3 version but all callers use the V3 one. It's messy, slows development down as there's more useless crap to wade through and I'm not allowed to remove / comment out such functions because they don't directly relate to a customer request.
-
Ian Shlasko wrote:
So when I look at the new code a year later when something needs to be tweaked, I won't think, "Well, that's a silly way to do it! This would be much more efficient!" and make the old mistake again.
This I can understand and almost agree with. Problem in my case is that he's left truly redundant code.
But fortunately we have the nanny-state politicians who can step in to protect us poor stupid consumers, most of whom would not know a JVM from a frozen chicken. Bruce Pierson
Because programming is an art, not a science. Marc Clifton
I gave up when I couldn't spell "egg". Justine AllenDave Sexton wrote:
Problem in my case is that he's left truly redundant code.
Yeah, in that case, he needs some re-education... I'd say start with vocal instruction, and try to avoid the electroshock unless it's really serious.
Proud to have finally moved to the A-Ark. Which one are you in? Author of Guardians of Xen (Sci-Fi/Fantasy novel)
-
I sometimes comment out small blocks of code - like a few lines, if I think its useful to refer back to, to see the way something used to work without relying on someone looking in version history to see. But in our project there are lots of large (several hundred line) functions which aren't called from anywhere. In many cases the function has been copied and pasted and there might be a V1, V2 and V3 version but all callers use the V3 one. It's messy, slows development down as there's more useless crap to wade through and I'm not allowed to remove / comment out such functions because they don't directly relate to a customer request.
Are you at least allowed to hide V1 and V2 in a #region and add [Obsolete] attributes (Assuming you're in .NET)?
Proud to have finally moved to the A-Ark. Which one are you in? Author of Guardians of Xen (Sci-Fi/Fantasy novel)
-
I sometimes do that, actually... When maintaining old code and replacing bits of it, I'll sometimes leave the old version in there and commented. It's not to keep a record in case we have to revert, but rather to let anyone reading the code know WHY the code was done a certain way. Kind of implies, "Yes, this would be the OBVIOUS solution, but we used to do it this way and it didn't work because ______" So when I look at the new code a year later when something needs to be tweaked, I won't think, "Well, that's a silly way to do it! This would be much more efficient!" and make the old mistake again.
Proud to have finally moved to the A-Ark. Which one are you in? Author of Guardians of Xen (Sci-Fi/Fantasy novel)
-
I sometimes comment out small blocks of code - like a few lines, if I think its useful to refer back to, to see the way something used to work without relying on someone looking in version history to see. But in our project there are lots of large (several hundred line) functions which aren't called from anywhere. In many cases the function has been copied and pasted and there might be a V1, V2 and V3 version but all callers use the V3 one. It's messy, slows development down as there's more useless crap to wade through and I'm not allowed to remove / comment out such functions because they don't directly relate to a customer request.
Dave Parker wrote:
and I'm not allowed to remove / comment out such functions because they don't directly relate to a customer request.
"Removed redundant and unnecessary functions due to customer request. Request: 'Programs runs slower than a snail taking depressants.' "
modified on Thursday, December 10, 2009 10:52 AM
-
keefb wrote:
obviously didn't know what they are doing with WCF
Every time I work with WCF I have the impression that I don't know what I am doing. The thing seems to work anyway. :~
If you truly believe you need to pick a mobile phone that "says something" about your personality, don't bother. You don't have a personality. A mental illness, maybe - but not a personality. - Charlie Brooker My Photos/CP Flickr Group - ScrewTurn Wiki v3
:laugh: That sounds par for the course, it took me a long time to get it write. The stupid thing was after I did this, I spent a fair amount of time trying to get the original coders of my current project to implement the services properly. They've both gone and I've been parachuted in to plug the gap, from a large project that I pretty much desgined and built and was a success, in no small measure do to my efforts. That was a nice thank you which is why [partly] my job sucks today and every day (for the last 7 months). At least we are estimated to finish in 6 weeks, but this has been true since June. Still the jobs market will pick up soon :~
CCC solved so far: 2 (including a Hard One!) 37!?!! - Randall, Clerks
-
keefb wrote:
obviously didn't know what they are doing with WCF
Every time I work with WCF I have the impression that I don't know what I am doing. The thing seems to work anyway. :~
If you truly believe you need to pick a mobile phone that "says something" about your personality, don't bother. You don't have a personality. A mental illness, maybe - but not a personality. - Charlie Brooker My Photos/CP Flickr Group - ScrewTurn Wiki v3
Dario Solera wrote:
Every time I work with anything WCF web-app related I have the impression that I don't know what I am doing.
Fixed that for you :)
¡El diablo está en mis pantalones! ¡Mire, mire! SELECT * FROM User WHERE Clue > 0 0 rows returned Save an Orange - Use the VCF! Personal 3D projects Just Say No to Web 2 Point Blow
-
Dario Solera wrote:
Every time I work with anything WCF web-app related I have the impression that I don't know what I am doing.
Fixed that for you :)
¡El diablo está en mis pantalones! ¡Mire, mire! SELECT * FROM User WHERE Clue > 0 0 rows returned Save an Orange - Use the VCF! Personal 3D projects Just Say No to Web 2 Point Blow
I find web apps much easier to understand, generally. Maybe it's just because I've never really done desktop development. WCF is, well, obscure.
If you truly believe you need to pick a mobile phone that "says something" about your personality, don't bother. You don't have a personality. A mental illness, maybe - but not a personality. - Charlie Brooker My Photos/CP Flickr Group - ScrewTurn Wiki v3
-
Argh. I'm working on a piece of software that was written by a junior colleague not long after he started. It was meant to kinda "break him in" but no-one reviewed his code. Reading through it is a nightmare. I can fully appreciate that it's not his fault that no-one reviewed his code (even though they were supposed to) but what I don't get is that he's left his code littered with useless comments, commented out code that he didn't need and wrapped them in regions marked "To Delete". It's doing my head in. Why didn't he just delete them? They have no purpose & we use source control for a reason! I'm going to use it as an opportunity to try and grow him into a better coder (I know I sucked when I started too) instead of just throwing my toys outta the cot. I might check up on some of his more recent contributions too. No real point to this post, just needed to get it off my chest.
But fortunately we have the nanny-state politicians who can step in to protect us poor stupid consumers, most of whom would not know a JVM from a frozen chicken. Bruce Pierson
Because programming is an art, not a science. Marc Clifton
I gave up when I couldn't spell "egg". Justine AllenIf I really feel I want to leave some old code in, just for reference or whatevr I decorate the method with [Obsolete("Don't use this crap", true)] otherwsie just cut out the dead wood - it'll all look a little alien in 6 months anyway.
-
Are you at least allowed to hide V1 and V2 in a #region and add [Obsolete] attributes (Assuming you're in .NET)?
Proud to have finally moved to the A-Ark. Which one are you in? Author of Guardians of Xen (Sci-Fi/Fantasy novel)
lol I wish - this is in wonderful VB6.
-
Dave Parker wrote:
and I'm not allowed to remove / comment out such functions because they don't directly relate to a customer request.
"Removed redundant and unnecessary functions due to customer request. Request: 'Programs runs slower than a snail taking depressants.' "
modified on Thursday, December 10, 2009 10:52 AM
lol though it wouldn't make any difference to speed could probably get away with that actually seeing as we get phoned up nearly every day from someone complaining the systems slow (generally because people there are running off loads of reports etc in the middle of the day).
-
lol I wish - this is in wonderful VB6.
Ouch... I feel your pain. I'm maintaining a 15-year-old VB6 app myself (Originally written as Excel macros, I think)
Proud to have finally moved to the A-Ark. Which one are you in? Author of Guardians of Xen (Sci-Fi/Fantasy novel)
-
Argh. I'm working on a piece of software that was written by a junior colleague not long after he started. It was meant to kinda "break him in" but no-one reviewed his code. Reading through it is a nightmare. I can fully appreciate that it's not his fault that no-one reviewed his code (even though they were supposed to) but what I don't get is that he's left his code littered with useless comments, commented out code that he didn't need and wrapped them in regions marked "To Delete". It's doing my head in. Why didn't he just delete them? They have no purpose & we use source control for a reason! I'm going to use it as an opportunity to try and grow him into a better coder (I know I sucked when I started too) instead of just throwing my toys outta the cot. I might check up on some of his more recent contributions too. No real point to this post, just needed to get it off my chest.
But fortunately we have the nanny-state politicians who can step in to protect us poor stupid consumers, most of whom would not know a JVM from a frozen chicken. Bruce Pierson
Because programming is an art, not a science. Marc Clifton
I gave up when I couldn't spell "egg". Justine AllenI only use the "TODO: Delete" technique when I'm really getting into something and making tons of changes... changes that I may change before I check in my code. But it's utterly worthless to leave that in there. And I never did like when others comment out a line of code and show it's altered form directly below it... just make the bloody change is what I say.