|
Reminds me of a former co-worker who named all his programs POORLY. (I don't mean he chose bad names, I mean *each* of his programs had the same name ... POORLY.) I asked him why he did so. He replied that he liked it when he saw the computer display "COMPILING POORLY" when he submitted his programs....
;^)
'droid
|
|
|
|
|
The absolut hardes thing I found was when I searched for a bug in a Module written in some kind of PL/I. I tried to understand, why a special line of code does not work, using 'true' and 'false' Boolean statements... now ... my forerunner was able du redefine true and false so that true was 0 and false was -1 ... incredible!
|
|
|
|
|
In my first Fortran program I managed to redefine a constant 3 (written as a digit '3' in the source) to something else (by passing it to a subroutine that changed its argument) and then the program would crash at the DO statement which should have executed 3 times. I never figured it out, needed a senior colleague to find it for me.
|
|
|
|
|
My favorite was a guy who used to contract at our company. He liked to write his code using variable names like tt (for Transaction Type), and pt (for Process Type, not Point). I happen to understand what he was writing as I somewhat knew the system he was working on, but what about another developer who was coming in fresh? They're not going to have a clue without asking, or a lot of time analyzing it. Even better, he liked to rewrite other people's code to fit in with his "better" design.
There's nothing worse than someone "knows" they know better than you, but clearly doesn't.
Kyosa Jamie Nordmeyer - Taekwondo Yi (2nd) Dan
Portland, Oregon, USA
|
|
|
|
|
Sounds like a clever chap to me.... My kind of plan.... Guarenteed employment for life (or the life of the software )
|
|
|
|
|
Some years ago I had to convert a quickbasic program to VB6. The original developer had a variable called drol (for diameter of the roll). However in my (and his) native language, dutch, this also means turd.
Mark C Hagers
New Media Ventures
Amersfoort, the Netherlands
|
|
|
|
|
Does anyone see anything stupid in this code? Here's a hint: it isn't the most efficient logic I've seen.
void CrapClass::reverse_points()
{
CPoint *pt, *npt;
CList <CPoint *, CPoint *> list;
POSITION next, prev;
next = m_point_list.GetHeadPosition();
while (next != NULL)
{
pt = m_point_list.GetNext(next);
npt = new CPoint(*pt);
list.AddTail(npt);
}
delete_points();
prev = list.GetTailPosition();
while (prev != NULL)
{
pt = list.GetPrev(prev);
npt = new CPoint(*pt);
m_point_list.AddTail(npt);
}
while (!list.IsEmpty())
delete list.RemoveHead();
}
modified on Thursday, December 13, 2007 6:52:30 PM
|
|
|
|
|
That code is bad. I love the use of a completely pointless copy the first time round.
|
|
|
|
|
Pete O'Hanlon wrote: Forum:Coding Horrors
Subject:Re: How NOT to reverse a list
Sender:Pete O'Hanlon
Date:Friday, December 14, 2007 4:49:00 PM
That code is bad. I love the use of a completely pointless copy the first time round.
I'm thinking he wanted a really fresh copy -- nothing like data where the bits are still warm. Yummy.
|
|
|
|
|
CurtD wrote: nothing like data where the bits are still warm
Souldn't he have done it twice then - just in case the first wasn't heated through warmly enough.
|
|
|
|
|
well the class has been named CrapClass...was the developer in question trying to write bad code??
but i guess u must have renamed it urself...
modified on Friday, December 14, 2007 9:57:28 AM
|
|
|
|
|
Haroon Sarwar wrote: well the class has been named CrapClass...was the developer in question trying to write bad code??
but i guess u must have renamed it urself...
Real names have been changed to protect the innocent (and the guilty).
|
|
|
|
|
Hi
You know I am really wondering why people actually posting questions in this forum? It should not be of the name, I mean how can someone think that coding horrors is a kind of help page???
And as I can see in the last posts they are getting more and more.
I just hope that they are coding better then reading instructions or names.
Cheers
You have the thought that modern physics just relay on assumptions, that somehow depends on a smile of a cat, which isn’t there.( Albert Einstein)
|
|
|
|
|
And what be the coding horror in this "question"?
|
|
|
|
|
yes you're right. the coding horrors forum is definitely not the place to post programming questions and it's getting more and more. but you know.. your post is not a coding horror either and would be more appropriate in the soapbox or maybe in the lounge
Fatbuddha 1 wrote: I just hope that they are coding better then reading instructions or names.
do you?
|
|
|
|
|
Sorry for that I just was wondering!
You are right!
Cheers
You have the thought that modern physics just relay on assumptions, that somehow depends on a smile of a cat, which isn’t there.( Albert Einstein)
|
|
|
|
|
In part I would blame the forum's name.
"Coding horrors" can be taken for something horrible about programming, such as a coding task
one does not like, does not understand, etc.
To reduce wrong posts, I suggest "Horrible Code", which more clearly suggests it is about
existing bad code.
|
|
|
|
|
Or change to "I do not read that's why I am posting questions here" forum.
|
|
|
|
|
I say we go back to the WTF forum.
|
|
|
|
|
Page 1 - good
Page 2 - good
Page 3 - I see at least 5 programming mistakes in the sample code...
http://www.devx.com/DevX/Article/36196/0/page/1[^] Not bad, but that last page really spoilt it for me
xacc.ideIronScheme a R5RS-compliant Scheme on the DLR
The rule of three: "The first time you notice something that might repeat, don't generalize it. The second time the situation occurs, develop in a similar fashion -- possibly even copy/paste -- but don't generalize yet. On the third time, look to generalize the approach."
|
|
|
|
|
You'd think that he could have at least tried to compile the code. How hard could it be?
|
|
|
|
|
nothing happens, C# is just as Java (i bet u can learn it with in 3 hrs excepts advance), and a programmer goes for concepts not the mistakes u done in syntax, of course if u compiled, it means u don't have syntax error. and also data structure/algorithm r independent to language, so conclusion = nothing happens
programming is just like poetry
|
|
|
|
|
Rizwan Yasin wrote: C# is just as Java
If you are happy with comparing apples to pears, and coding like a absolute beginner, then thats up to you. Please note, I said mistakes, not errors.
Rizwan Yasin wrote: and also data structure/algorithm r independent to language
Thats why I considered page 1 and 2 as good content.
xacc.ideIronScheme a R5RS-compliant Scheme on the DLR
The rule of three: "The first time you notice something that might repeat, don't generalize it. The second time the situation occurs, develop in a similar fashion -- possibly even copy/paste -- but don't generalize yet. On the third time, look to generalize the approach."
|
|
|
|
|
I have to say I can't see that many problems. Discarding every other random number is a bit weird in the first example. Throughout there's a reliance on the low-precision system clock returned with DateTime.Now and TimeSpan.Milliseconds returns the milliseconds part only, you should use TotalMilliseconds if you want it to tell you how many seconds elapsed. For more accurate timing results use a System.Diagnostics.Stopwatch .
At this point any collection which doesn't support generics is pretty stupid, the whole thing should be parameterized on T with a restriction that T derives from IComparable<T> or allows you to supply an IComparer<T>.
I'd like to see a comparison with inserting into a sorted ArrayList or List<T> and using BinarySearch. A lot of emphasis is put on the computational algorithmic complexity of data structures and algorithms, but these days practical algorithm performance is based on memory speed hierarchies, and cache locality is very important. Further, an array typically represents a lower load on the garbage collector than a deeply-linked data structure (fewer pointers to follow). There is a reason why Microsoft didn't and still don't supply linked list or binary tree structures with the .NET Framework.
DoEvents: Generating unexpected recursion since 1991
|
|
|
|
|
I inherited a website project from another agency who got sacked for being very slow. I was going through the nasty table layout site and found this gem in the site css.
.pbot10 TR TD TABLE.floatl TR TD TABLE TR TD TABLE TR TD TABLE TR TD.darkRed {<br />
BORDER-RIGHT: red 0px solid; BORDER-TOP: red 0px solid; VERTICAL-ALIGN: top; BORDER-LEFT: red 0px solid; BORDER-BOTTOM: red 0px solid; HEIGHT: 37px<br />
}<br />
.pbot10 TR TD TABLE.floatl TR TD TABLE TR TD TABLE TR TD TABLE TR TD.imgHorse {<br />
BORDER-RIGHT: red 0px solid; BORDER-TOP: red 0px solid; VERTICAL-ALIGN: top; BORDER-LEFT: red 0px solid; BORDER-BOTTOM: red 0px solid; HEIGHT: 77px<br />
}
and
.mleft5 {<br />
MARGIN-LEFT: 5px<br />
}<br />
.mleft10 {<br />
MARGIN-LEFT: 10px<br />
}<br />
.mleft15 {<br />
MARGIN-LEFT: 15px<br />
}<br />
.mleft20 {<br />
MARGIN-LEFT: 20px<br />
}<br />
.mleft25 {<br />
MARGIN-LEFT: 25px<br />
}<br />
.mleft30 {<br />
MARGIN-LEFT: 30px<br />
}<br />
.mleft35 {<br />
MARGIN-LEFT: 35px<br />
}<br />
.mright5 {<br />
MARGIN-RIGHT: 5px<br />
}<br />
.mright10 {<br />
MARGIN-RIGHT: 10px<br />
}<br />
.mright15 {<br />
MARGIN-RIGHT: 15px<br />
}<br />
.mright20 {<br />
MARGIN-RIGHT: 20px<br />
}<br />
.mright25 {<br />
MARGIN-RIGHT: 25px<br />
}<br />
.mright30 {<br />
MARGIN-RIGHT: 30px<br />
}<br />
.mright35 {<br />
MARGIN-RIGHT: 35px<br />
}
It had entries exactly the same as above for all possible options - mleft, mtop, mbottom, pright, pleft, ptop, pbottom etc as well as verdana9, verdana10, verdana11 etc. I think they missed the point of css somewhat. This is just the surface at first glance, I dread to think whats to come
|
|
|
|