Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Don't Criticize Code


Don't Criticize Code

Author
Message
Osbourne Cox
Osbourne Cox
Forum Newbie
Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)

Group: General Forum Members
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.
Carla Wilson-484785
Carla Wilson-484785
SSCommitted
SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)SSCommitted (1.7K reputation)

Group: General Forum Members
Points: 1715 Visits: 1949
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.)
rondsouza2000
rondsouza2000
Forum Newbie
Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)Forum Newbie (1 reputation)

Group: General Forum Members
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".
sherifffruitfly
sherifffruitfly
Valued Member
Valued Member (52 reputation)Valued Member (52 reputation)Valued Member (52 reputation)Valued Member (52 reputation)Valued Member (52 reputation)Valued Member (52 reputation)Valued Member (52 reputation)Valued Member (52 reputation)

Group: General Forum Members
Points: 52 Visits: 427
Most idiotic editorial I've ever seen.
Osbourne Cox
Osbourne Cox
Forum Newbie
Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)Forum Newbie (3 reputation)

Group: General Forum Members
Points: 3 Visits: 35
Ouch, it's starting to get ugly here...
bitbucket-25253
bitbucket-25253
SSCertifiable
SSCertifiable (5.7K reputation)SSCertifiable (5.7K reputation)SSCertifiable (5.7K reputation)SSCertifiable (5.7K reputation)SSCertifiable (5.7K reputation)SSCertifiable (5.7K reputation)SSCertifiable (5.7K reputation)SSCertifiable (5.7K reputation)

Group: General Forum Members
Points: 5695 Visits: 25280
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
Ninja's_RGR'us
Ninja's_RGR'us
SSC-Insane
SSC-Insane (20K reputation)SSC-Insane (20K reputation)SSC-Insane (20K reputation)SSC-Insane (20K reputation)SSC-Insane (20K reputation)SSC-Insane (20K reputation)SSC-Insane (20K reputation)SSC-Insane (20K reputation)

Group: General Forum Members
Points: 20941 Visits: 9671
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 Hehe
ChrisP-374390
ChrisP-374390
SSC-Enthusiastic
SSC-Enthusiastic (130 reputation)SSC-Enthusiastic (130 reputation)SSC-Enthusiastic (130 reputation)SSC-Enthusiastic (130 reputation)SSC-Enthusiastic (130 reputation)SSC-Enthusiastic (130 reputation)SSC-Enthusiastic (130 reputation)SSC-Enthusiastic (130 reputation)

Group: General Forum Members
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...
mister.magoo
mister.magoo
SSCrazy
SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)SSCrazy (2.3K reputation)

Group: General Forum Members
Points: 2286 Visits: 7830
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


select geometry::STGeomFromWKB(0x0106000000020000000103000000010000000B0000001000000000000840000000000000003DD8CCCCCCCCCC0840000000000000003DD8CCCCCCCCCC08408014AE47E17AFC3F040000000000104000CDCCCCCCCCEC3F9C999999999913408014AE47E17AFC3F9C99999999991340000000000000003D0000000000001440000000000000003D000000000000144000000000000000400400000000001040000000000000F03F100000000000084000000000000000401000000000000840000000000000003D0103000000010000000B000000000000000000143D000000000000003D009E99999999B93F000000000000003D009E99999999B93F8014AE47E17AFC3F400000000000F03F00CDCCCCCCCCEC3FA06666666666FE3F8014AE47E17AFC3FA06666666666FE3F000000000000003D1800000000000040000000000000003D18000000000000400000000000000040400000000000F03F000000000000F03F000000000000143D0000000000000040000000000000143D000000000000003D, 0);




  • 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

  • N-148823
    N-148823
    Forum Newbie
    Forum Newbie (8 reputation)Forum Newbie (8 reputation)Forum Newbie (8 reputation)Forum Newbie (8 reputation)Forum Newbie (8 reputation)Forum Newbie (8 reputation)Forum Newbie (8 reputation)Forum Newbie (8 reputation)

    Group: General Forum Members
    Points: 8 Visits: 20
    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!
    Go


    Permissions

    You can't post new topics.
    You can't post topic replies.
    You can't post new polls.
    You can't post replies to polls.
    You can't edit your own topics.
    You can't delete your own topics.
    You can't edit other topics.
    You can't delete other topics.
    You can't edit your own posts.
    You can't edit other posts.
    You can't delete your own posts.
    You can't delete other posts.
    You can't post events.
    You can't edit your own events.
    You can't edit other events.
    You can't delete your own events.
    You can't delete other events.
    You can't send private messages.
    You can't send emails.
    You can read topics.
    You can't vote in polls.
    You can't upload attachments.
    You can download attachments.
    You can't post HTML code.
    You can't edit HTML code.
    You can't post IFCode.
    You can't post JavaScript.
    You can post emoticons.
    You can't post or upload images.

    Select a forum

































































































































































    SQLServerCentral


    Search