It's such a nightmare understanding a big whack of un-commented code :(

StageLeft

No Lifer
Sep 29, 2000
70,150
5
0
I'm trying to fix a problem with some data. The data is created by a 450 line stored procedure. Within this SP is a crapload of nested stored procedures. In some cases the nested ones call additional ones. There are literally dozens of temporary tables and overall two databases are used. There is one half-assed line of meaningless comment every 60 or so! :|
 

StageLeft

No Lifer
Sep 29, 2000
70,150
5
0


<< what language? >>

It's SQL server (using transact SQL). I don't suppose I blame the guy since I don't comment either. In fact nobody at work does. In fact nobody I've ever met actually comments their code more than a token gesture when bored :eek:
 

notfred

Lifer
Feb 12, 2001
38,241
4
0
comments are for wussies :p

$;=$|;$_=q;1-21010110101;;@;
=map{1..+30+$_,map{$"}1..7}m((-?\d))g;
$==pop;map{unshift+@;,$"}2..chop$=;
print+map{$_=>$"x(y^^^c^3)=>++$;%7?q++:"
"}@;
 

Optimus

Diamond Member
Aug 23, 2000
3,618
0
0
Sounds a lot like my job, Skoorb. I get to look at other programmers spagetti-logic code all day and find out why it isn't working ("'Cause of your company's dev tools!" is their opinion).

Haven't seen properly commented code yet! :)

BTW, 450 line SP with nested SP's all the way down in MS SQL Server?

<---runs screaming to the corner... ;)
 

MichaelD

Lifer
Jan 16, 2001
31,528
3
76


<< $;=$|;$_=q;1-21010110101;;@;
=map{1..+30+$_,map{$"}1..7}m((-?\d))g;
$==pop;map{unshift+@;,$"}2..chop$=;
print+map{$_=>$"x(y^^^c^3)=>++$;%7?q++:"
"}@;
>>



Absolutely, NotFred. I was thinking the EXACT same thing. Totally.

:p

I don't know what the hell that is you wrote there, but when I started speaking it out loud, small alien spacecraft began to decend from the sky. Cut it out, Notfred! You're pissing-off the aliens!
 

trmiv

Lifer
Oct 10, 1999
14,670
18
81
It's funny, you get in the real world, and no one comments their code, but in school, my professors go nuts if we don't comment our code, and comment it well. I swear some of my programs have more comments than code. My final project looked like a novel.
 

Nitemare

Lifer
Feb 8, 2001
35,461
4
81
I am so bad about not putting comments in when I code something..of course then again it's only source code for c++ anyways..

that does sound really bad though..what sort of error is it generating?
 

notfred

Lifer
Feb 12, 2001
38,241
4
0


<<

<< $;=$|;$_=q;1-21010110101;;@;
=map{1..+30+$_,map{$"}1..7}m((-?\d))g;
$==pop;map{unshift+@;,$"}2..chop$=;
print+map{$_=>$"x(y^^^c^3)=>++$;%7?q++:"
"}@;
>>



Absolutely, NotFred. I was thinking the EXACT same thing. Totally.

:p

I don't know what the hell that is you wrote there, but when I started speaking it out loud, small alien spacecraft began to decend from the sky. Cut it out, Notfred! You're pissing-off the aliens!
>>



It's perl. It's a calendar. I didn't write it. I've never actually written obfuscated code, all my code is relatively readable :)

$name = "opugsfe";
$name =~ s/([a-z])/chr(ord($1)+1)/eg;
print $name;

I actaully wrote that one :)

 

kranky

Elite Member
Oct 9, 1999
21,019
156
106
I'm surprised to see so many comments about no comments! At work we have code reviews regularly, and the people who don't comment properly get dinged on their performance reviews, and they still have to go back and do it anyway. A couple years ago they even canned some woman who just refused to use comments. She was really good, but she felt commenting would reduce her productivity and she couldn't take that.
 

sitka

Senior member
Dec 29, 2000
895
0
0
450 lines, double nested sp_

thunk<----sitka's jaw hitting the floor

Meet your new SO ;)

you know as soon as you get most of it figured out there will be an obvious way to bypass most of it!!!

 

Jzero

Lifer
Oct 10, 1999
18,834
1
0


<< I'm trying to fix a problem with some data. The data is created by a 450 line stored procedure. Within this SP is a crapload of nested stored procedures. In some cases the nested ones call additional ones. There are literally dozens of temporary tables and overall two databases are used. There is one half-assed line of meaningless comment every 60 or so! :| >>



Skoorb:
If I wanted you to be able to READ it, I wouldn't have written it in CODE!
 

Descartes

Lifer
Oct 10, 1999
13,968
2
0
Well-written code largely makes comments superfluous. If someone writes crapola code like Skoorb is having to work with, comments are helpful, but still don't quite rationalize the manifestation of complete idiocy in the code.

The fact that the sproc is 450 lines is already some indication that something wasn't right in the head of the original developer. Of course, I know people who like to go crazy and put all their business logic in the sproc as well.