March 12, 2015 at 10:22 pm
when someone leaves behind a //TODO: with just their name. No info about what it was that they left to do.
Then you find this comment 6 months later, and either that person no longer works with you, or they have no idea what it was that they needed to do...
March 12, 2015 at 10:48 pm
Absolutely the worst comment I have ever seen in code, and it was all over the place at one previous shop I worked at:
-- Process data
It wasn't in SQL though. That was just for illustration. 🙂
My thought question: Have you ever been told that your query runs too fast?
My advice:
INDEXing a poor-performing query is like putting sugar on cat food. Yeah, it probably tastes better but are you sure you want to eat it?
The path of least resistance can be a slippery slope. Take care that fixing your fixes of fixes doesn't snowball and end up costing you more than fixing the root cause would have in the first place.
Need to UNPIVOT? Why not CROSS APPLY VALUES instead?[/url]
Since random numbers are too important to be left to chance, let's generate some![/url]
Learn to understand recursive CTEs by example.[/url]
[url url=http://www.sqlservercentral.com/articles/St
March 12, 2015 at 11:16 pm
The worst I have seen is
--Works as Coded
Jason...AKA CirqueDeSQLeil
_______________________________________________
I have given a name to my pain...MCM SQL Server, MVP
SQL RNNR
Posting Performance Based Questions - Gail Shaw[/url]
Learn Extended Events
March 12, 2015 at 11:35 pm
Seen everything between a shopping list to poetry, not bothered too much by those, at least not as much as having several hundreds of routines which all had a very nice, well formatted header comment with nothing but the developer's names in them.
😎
March 12, 2015 at 11:38 pm
MLK44 (3/12/2015)
.
+1. What's worse: bad comments or no comments?
My thought question: Have you ever been told that your query runs too fast?
My advice:
INDEXing a poor-performing query is like putting sugar on cat food. Yeah, it probably tastes better but are you sure you want to eat it?
The path of least resistance can be a slippery slope. Take care that fixing your fixes of fixes doesn't snowball and end up costing you more than fixing the root cause would have in the first place.
Need to UNPIVOT? Why not CROSS APPLY VALUES instead?[/url]
Since random numbers are too important to be left to chance, let's generate some![/url]
Learn to understand recursive CTEs by example.[/url]
[url url=http://www.sqlservercentral.com/articles/St
March 13, 2015 at 12:00 am
Comments posted to this topic are about the item The Worst Comments
March 13, 2015 at 12:46 am
Many years ago I found a comment by my boss in the code which read something along the lines of
-- Don't touch this code
-- It does fancy statistical maths on an iterative loop until it gets the answer
-- Really, don't touch it
-- Even if you think you kn ow what you are doing, DON'T
It served one useful purpose. It warned me that the next page was complex. It didn't tell me anything about what it was actually doing!
March 13, 2015 at 12:56 am
Another +1 for 'no comments' . I'm working on updating a bunch of non-SQL test scripts at the moment, which feature many examples of complex, multi-call tests with not a shred of explanation between them. Makes for a speedy update!
March 13, 2015 at 1:44 am
Toby Harman (3/13/2015)
Many years ago I found a comment by my boss in the code which read something along the lines of
-- Don't touch this code
-- It does fancy statistical maths on an iterative loop until it gets the answer
-- Really, don't touch it
-- Even if you think you kn ow what you are doing, DON'T
It served one useful purpose. It warned me that the next page was complex. It didn't tell me anything about what it was actually doing!
Sometimes quotes say a lot more about the author than the reader.
Gaz
-- Stop your grinnin' and drop your linen...they're everywhere!!!
March 13, 2015 at 1:49 am
I was going to try and say "no comment" in a witty way but as I am not first to highlight the issue (and I am not always that witty) I shan't bother. Instead I have the following anecdote:
I have recently worked with people who have analysed code because of the lack of documentation (i.e. no specification and limited/poor/non-existent comments) and made paper notes then augmented the code with their own uncommented code. Muppets.
Gaz
-- Stop your grinnin' and drop your linen...they're everywhere!!!
March 13, 2015 at 1:54 am
No comments aside, my least favourite style of commenting is one that breaks encapsulation. I have seen comments that describe how a call is implemented at the point of making that call as opposed to what it is supposed to achieve. This is unnecessary information for the reader as they will not care unless they drill down to that level. On top of that, if the implementation changes then the comments that are nowhere near the changed code becomes out of date and, in my opinion, dangerously wrong. Down this road lies misconceptions, information overload and confusion.
Gaz
-- Stop your grinnin' and drop your linen...they're everywhere!!!
March 13, 2015 at 2:01 am
Superfluous comments are worse than no comments. You know the type:
--Find the average
select @avg = avg(x)
Reminds me of those people who, when doing presentations, just recite what is written on screen.
The absence of evidence is not evidence of absence
- Martin Rees
The absence of consumable DDL, sample data and desired results is, however, evidence of the absence of my response
- Phil Parkin
March 13, 2015 at 2:25 am
--do something
--do something else
--not sure what this does
--changed
March 13, 2015 at 2:27 am
Guilty as charged!
---show output
select * from #output_2
This is one of my comment. I knew I'd done something somewhere. And to be honest I do this all the time. However may I lay at my extenuating circumstances at the door of the judges. If we take the whole of the comments in the stored procedure and remove the code, together it does all make logical sense like a book. And that's sort of instead of putting
--The End
Which thinking about it I'll start using.
However as a stand alone it looks a bit retarded.
March 13, 2015 at 2:35 am
I have two 'favourites'
-- Abandon hope all ye who enter here
And, from my days of assembler programmimng
ldx 1 -- Load the x register with 1
ldx 1 -- Just in case it didn't do it the first time
Viewing 15 posts - 1 through 15 (of 156 total)
You must be logged in to reply to this topic. Login to reply