Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase ««12345»»»

Don't Criticize Code Expand / Collapse
Author
Message
Posted Saturday, November 12, 2011 9:38 AM


Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Friday, July 20, 2012 1:47 PM
Points: 3, Visits: 35
It's one thing to not spout off on code as a consultant, as steveb mentioned. But to argue against criticizing code at all smacks of the "we are all winners, everyone's idea is as good as any other" school of thought that is the enemy of quality.

If you want to talk about humility, I think there is a need for humility on the code writer's part. I've run into MANY developers who code in Frankenstein's Lab, keeping their code secret because they do not want external criticism of their code before it's set in deadline-driven stone.

What is needed is for developers to have the humility to put their rough sketches of a code design before their peers BEFORE it's written and say, "This is what I'm thinking, see if you can punch holes in it or think of a better way of doing it."

Because at the end of the day, the goal should be to develop the best code/design possible, not to be the sole originator of the idea.

So sorry, if someone comes out of Frankenstein's Lab with a piece of junk code, I'm going to call it out. I recently ran into this situation and was able to rewrite the code in 5 hours, leading to an 80% decrease in data access and runtime.

Rereading the article, it's clear that the author is coming from a consultant's viewpoint. And I think that's a really important detail: You have to be tactful as a consultant. But you can still criticize tactfully. If the original coder is available, they can explain valid reasons for the tortured approach which will help inform your work. If they were just a bad coder (or inexperienced at the time the code was written), the discussion can validate trying to refactor the code into shape, while at the same time educating the coder on a better design.
Post #1204636
Posted Saturday, November 12, 2011 10:09 AM
SSCommitted

SSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommitted

Group: General Forum Members
Last Login: Tuesday, April 15, 2014 3:30 PM
Points: 1,525, Visits: 1,833
Reminds me of the time, back in 1993 (in a world far, far away, in a different programming language), of having to figure out a program in which the author used the variable names a, b, c, d, e,... s, t - literally! Took me a LONG time to figure out what he was doing. I did know who the programmer was, and he had left the company, and all I really cared about was trying to reproduce the results for a client. (The programmer was well-respected, and I wasn't going to dis him.)
(I did rename all those variables and added comments by the time I was done.)
Post #1204640
Posted Saturday, November 12, 2011 11:02 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Friday, September 13, 2013 9:13 AM
Points: 1, Visits: 8
i totally disagree with your observation. if the code is poorly written no matter what the circumstances were, there is no point in muddling through bad code to fix it. you will simply be wasting time fixing in one place and breaking it somewhere else. and also bad code is not testable. if you are given the task of maintaining such horrendous code, take the time to reverse engineer and re-factor and re-write the piece which needs immediate attention from inside out and at the same time make sure that the new code is testable too. if the new code is not testable a unit at a time that means you still have a "code smell".
Post #1204651
Posted Sunday, November 13, 2011 7:56 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Thursday, November 21, 2013 2:21 PM
Points: 33, Visits: 411
Most idiotic editorial I've ever seen.
Post #1204772
Posted Sunday, November 13, 2011 10:15 AM


Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Friday, July 20, 2012 1:47 PM
Points: 3, Visits: 35
Ouch, it's starting to get ugly here...
Post #1204787
Posted Sunday, November 13, 2011 10:45 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Today @ 7:21 PM
Points: 5,472, Visits: 23,525
sherifffruitfly (11/13/2011)
Most idiotic editorial I've ever seen.


I hope your comment was made as a joke, for it was not ....


If everything seems to be going well, you have obviously overlooked something.

Ron

Please help us, help you -before posting a question please read

Before posting a performance problem please read
Post #1204791
Posted Sunday, November 13, 2011 10:53 AM


SSC-Insane

SSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-InsaneSSC-Insane

Group: General Forum Members
Last Login: Thursday, January 16, 2014 12:03 PM
Points: 21,376, Visits: 9,594
bitbucket-25253 (11/13/2011)
sherifffruitfly (11/13/2011)
Most idiotic editorial I've ever seen.


I hope your comment was made as a joke, for it was not ....


That would be called self fulflling prophecy
Post #1204793
Posted Sunday, November 13, 2011 3:28 PM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Wednesday, February 22, 2012 11:15 PM
Points: 130, Visits: 404
Hi Phil

Nice editorial, sort of follows on from your piece "Never offend a captive audience"

Personally I am happy to receive the criticism.

Anyone interested in criticising my code - please feel free to take a shot. If it is cheap, duck. If constructive, I am grateful for the chance to learn, and take the knowledge so gained to the next task with thanks.

Those arrogant enough to think that they were perfect when they started out in IT, I would rather not know; if they can't accommodate the lack of experience in others, I have no time for them. For those who think they are perfect now, good luck.

For the rest of us, well I for one know that I still have much to learn. That is why I use SQLServerCentral. That's why I like to see a better way of doing something than the way I that came to mind for me. I enjoy the learning.

I rarely get the opportunity to criticise, but my biggest bugbear is a lack of commentary. I really like knowing what is going on...
Post #1204827
Posted Sunday, November 13, 2011 5:58 PM


SSCommitted

SSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommitted

Group: General Forum Members
Last Login: Today @ 3:56 PM
Points: 1,654, Visits: 5,208
Thanks for the article Phil.

I agree that bad criticism along the lines of "oh wow! look what this idiot did!" is not helpful and just shows you up as ignorant.

There are many reasons why non-optimal code is written in whichever environment - and unfortunately, unless you know the author really well, there is usually no way to know the reasons why it happened.

I would say there is definitely one exception to this though : when a mate that you know is competent writes some stinking code - in this case you should go for it - they deserve it and so do you!

One other exception: If I answer a question on SSC and my answer is incorrect or less than optimal, I would worry if it was not criticised - after all, that is the best thing about these forums - the group review.


MM


  • MMGrid Addin
  • MMNose Addin


  • Forum Etiquette: How to post Reporting Services problems
  • Forum Etiquette: How to post data/code on a forum to get the best help - by Jeff Moden
  • How to Post Performance Problems - by Gail Shaw

  • Post #1204845
    Posted Sunday, November 13, 2011 10:06 PM
    Forum Newbie

    Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

    Group: General Forum Members
    Last Login: Saturday, March 03, 2012 4:24 AM
    Points: 8, Visits: 15
    Having been writing code for over 30 years, some of it good, some of it less so, I know there would be times that a consultant could justify critising my code, but I also know that unless done at the time the code is written, there is no point in critizing it. If the code does not work, say so, if circumstances have changed, and there is now a better way of achieving an outcome, say so, but never critise the coder. They may have moved on from coding and be a fantasic PM, they may be related to the person talking to you, they may just have been having a bad day when it was written, or they may have been working with code from an even older legacy system, the reasons for bad code are numerous. When I started it was immperative to reuse variables for something else to save the few bytes of memory (and tape) having another one would use-- Today, that looks like bad coding!
    Post #1204870
    « Prev Topic | Next Topic »

    Add to briefcase ««12345»»»

    Permissions Expand / Collapse