|
I think Luc may have been hinting at this - he'd better remember not to make such hints so subtle next time...
"they probably will have introduced a new keyword yielding some attention to more recent customers..."
|
|
|
|
|
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
|
|
|
|
|
|
Luc Pattyn [Forum Guidelines] [My Articles]
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use the code block button (PRE tags) to preserve formatting when showing multi-line code snippets
|
|
|
|
|
hey 10x for teling abt yield operator
Ravie Busie
Coding is my birth-right and bugs are part of feature my code has!
|
|
|
|
|
I have seen this when the array doesn't contain a indexing property.
return users[0]; // Doesn't work
I seem to remember this being the default behaviour for non generic Lists in early .net (2?).
|
|
|
|
|
I've seen that - and I've also done this "kludge" when I literally didn't have time to look it up: e.g. Must get done fast, bigger fish to fry.. this works - move on. Not ideal - but - depends what's going on.. schedule.. time constraints. It's still readable at least.
--Jason
Know way to many languages... master of none!
|
|
|
|
|
|
Why? Wouldn't be fun if everything was working perfectly.
|
|
|
|
|
A silly oversight perhaps, but not really a horror. On a really bad day i might have committed the same "atrocity"
A public-opinion poll is no substitute for thought.
|
|
|
|
|
Søren Turin wrote: A silly oversight perhaps, but not really a horror. On a really bad day i might have committed the same "atrocity" Laugh
I agree. The code it self is not horror. But debugging why the application is not logging with is horror. This was a code I inherited and I was not aware of this piece of code. I found it out after spending 2 days to figure out why the app was not logging to the eventlog.
Yusuf
|
|
|
|
|
Could it be another application is writing to the file. and this is waiting for synchronization. bad programming with little comments. Not a real horror
cheers,
Donsw
My Recent Article : Optimistic Concurrency with C# using the IOC and DI Design Patterns
|
|
|
|
|
Classical! Presumably the dev didn't understand or did not care to understand what the old code was doing and decided to leave it there "just in case".
At my company we've got the full source history in a sourcesafe database (though we are finally moving on to Team System now), but a lot of people still attempt to keep a full version history in the latest version of the code - never removing anything, but commenting it out and usually adding their initials and the date and time, as if this would actually help anyone later on. In my view it just distracts, and is never really useful since it's far easier to compare versions in sourcesafe than comparing the comments to the current code.
Well, at least they comment it out rather than leave the old code in there...
|
|
|
|
|
dojohansen wrote: but a lot of people still attempt to keep a full version history in the latest version of the code - never removing anything, but commenting it out and usually adding their initials and the date and time, as if this would actually help anyone later on. In my view it just distracts
sometime, only on certain conditions, I leave old code behind commented out. Such as if I am making major logic change and what is change is not big piece of code I leave it for historical comparison. Beyond that I don't get it what the code needs to be polluted with old code.
Yusuf
Oh didn't you notice, analogous to square roots, they recently introduced rectangular, circular, and diamond roots to determine the size of the corresponding shapes when given the area. Luc Pattyn[^]
|
|
|
|
|
just look at this beauty:
m_fooDictionary[m_fooList[p_fooIndex].BarTypeEnum][oldState]--;
the interesting thing is that this line is repeated numerous times across a 1500+ lines class, sometimes with "++" or "--" at the end..
truly a great way to start off your day
|
|
|
|
|
Looks OK, just add some horizontal space.
|
|
|
|
|
No error checking for array bounds.
«_Superman_»
|
|
|
|
|
There might be, just not in that snippet, or maybe that's was a design decision, I can't tell from just that one statement.
|
|
|
|
|
PIEBALDconsult wrote: Looks OK
Yes, if you mean OK as in syntactically correct.
But it's not very readable, this statement seems to say: I don't care too much about my team mates and/or maintainability. And if that is repeated many times throughout the class, sometimes with one - , sometimes with two, then it is only a question of time until a problem related to these statements will occur.
www.thomas-weller.de
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. Programmer - an organism that turns coffee into software.
|
|
|
|
|
Thomas Weller wrote: And if that is repeated many times throughout the class, sometimes with one -, sometimes with two, then it is only a question of time until a problem related to these statements will occur.
How could there be one '-'? Would that even parse? (BTW, the inability to parse a single trailing plus minus would seem a reason to favor i++ over ++i when the two operations would otherwise be interchangeable).
If there were only one or two such statements in the code, I would probably be inclined to create temporary variables to hold the outputs of the various subexpressions. If the exact bit of code is repeated extremely often, I might be inclined to define a separate method for it. Otherwise I would expect someone parsing the code to example that classes referenced therein and determine what the different methods or properties mean. The expression seems pretty straightforward; if it only appeared once, expanding it to use temporary variables would make it easier to read, but if it appears many times, expanding it in such fashion would make one instance (the first one examined) easier to read and the rest bloated and annoying.
|
|
|
|
|
Perfect for a Scheme macro, oh wait! You are not using Scheme!
xacc.ide - now with TabsToSpaces support IronScheme - 1.0 beta 2 - out now! ((lambda (x) `((lambda (x) ,x) ',x)) '`((lambda (x) ,x) ',x))
|
|
|
|
|
Here's one I spotted in a previous life:
We were working in C on protocol stacks. In every C file created by a group of contractors, we found the following statements:
#define True 0
#define False 1
This was endemic throughout the code produced by this particular group of contractors.
Fortunately, the product never came to be. The 2001 Tech Wreck did it in.
Geoff
Professional Geek,
Amateur Stage-Levelling Gauge
|
|
|
|
|
Ew. While I agree that true should be zero (there are many ways of being wrong, but only one way to be correct; it's also orthogonal with strcmp), I still wouldn't do that.
What we had at one place was:
#define true (0==0)
#define false (!true)
|
|
|
|
|
I've started to favour this form:
#define TRUE (!0)
#define FALSE (!TRUE)
But at least I put it in a header rather than within every single source file. In this case, it was in *.c. Can you say "maintenance nightmare"?
And they claimed they were a CMM level 5 company, too.
Professional Geek,
Amateur Stage-Levelling Gauge
modified on Wednesday, February 4, 2009 6:19 PM
|
|
|
|
|
The (0==0) may be more portable, which is what they were after.
I just tried (0==0) and (!0) on two compilers and both agreed that they equal 1, but that may not always be (or have been) the case.
|
|
|
|