|
One developer I worked with used to like
Assert(DateTime.Now < new DateTime(2011, 10, 1))
He'd check stuff in and it would break in QA a few days later.
|
|
|
|
|
OMG - I can't think many coding faux pas worse than that - fingers/hammer combination seems to be all I can recommend - I see you are in the States so hopefully I will never have to work with him
|
|
|
|
|
|
A friend of mine wrote this little pearl a while ago. When I took the keyboard and wrote "true", we laughed for a good 5 mins. ...the next step was getting rid of the crazy infinite loop.
while(Convert.ToBoolean(1))
{
}
|
|
|
|
|
while(true) is one of my pet hates.
"You get that on the big jobs."
|
|
|
|
|
Why?
Oxfords English < Official CCC Players Dictionary
Excuse me for my improper grammar and typos.
It's because English is my primary language, not my first language.
My first languages are C# and Java.
VB, ASP, JS, PHP and SQL are my second language.
Indonesian came as my third language.
My fourth language? I'm still creating it, I'll let you know when it's done!
|
|
|
|
|
while(true) isn't self-documenting
while(true)
{
.... lots of code
if(drunk) break;
drinkBeer();
.... lots more code
}
I much prefer
while(!drunk)
{
.... lots of code
drunk = true;
if(drunk) continue;
drinkBeer();
.... lots more code
}
Although its probably just the drink beer bit I really like
"You get that on the big jobs."
|
|
|
|
|
RobCroll wrote: while(true) isn't self-documenting
Guess that's where comments comes in handy.
RobCroll wrote:
while(true)
{
.... lots of code
if(drunk) break;
drinkBeer();
.... lots more code
}
I much prefer
while(!drunk)
{
.... lots of code
drunk = true;
if(drunk) continue;
drinkBeer();
.... lots more code
}
I'm a fan of while(true) but the first is simply garbage, I never used it like that.
Oxfords English < Official CCC Players Dictionary
Excuse me for my improper grammar and typos.
It's because English is my primary language, not my first language.
My first languages are C# and Java.
VB, ASP, JS, PHP and SQL are my second language.
Indonesian came as my third language.
My fourth language? I'm still creating it, I'll let you know when it's done!
|
|
|
|
|
You've got my interested now. So how do you use while(true) without coding garbage like break; (or return)?
"You get that on the big jobs."
|
|
|
|
|
No, no, don't misunderstand me. I use break;, continue;(above loop) or return;
It's the context that I disagree with (ie. if you can make it simple with just a boolean, why do you need a while(true)?).
Oxfords English < Official CCC Players Dictionary
Excuse me for my improper grammar and typos.
It's because English is my primary language, not my first language.
My first languages are C# and Java.
VB, ASP, JS, PHP and SQL are my second language.
Indonesian came as my third language.
My fourth language? I'm still creating it, I'll let you know when it's done!
|
|
|
|
|
I actually have a LOT of While 1=1 in MS SQL...
It's very cool, works great, and I just love to see the face of programmers when I show them with pride my nested while 1=1 loops in recursive stored procs...
|
|
|
|
|
I think we all know that writing software is a matter of black and white. There may be many different ways to successfully solve a given problem, but the different methods will produce concrete results - unless you are writing in Prolog, then you may not know the outcome. We also tend to find a method that ‘works for us’ and continue to use that same sequence of code to solve similar problems.
A programmer working with me many years ago either had a short attention span or leaned on his professors’ admonition that everything in the world is gray… He would never reuse a snippet that worked and because we were asked to comment our code (this was back in cryptic Assembler/Fortran land) he would liberally sprinkle ‘THIS MIGHT WORK’ anywhere there was questionable logic.
Lesson: Don’t hire Philosophy Majors for Dev projects!
Gray beard, but no holey tee-shirts, 50+ yrs writing software.
|
|
|
|
|
Frank Towle wrote: Lesson: Don’t hire Philosophy Majors for Dev projects!
FTFY
|
|
|
|
|
@Bert, that's not P.C. you know
|
|
|
|
|
|
Actually, Edsger Dykstra pointed out in the early '90s that computer science programs were producing inferior programmers compared to other programs, most notabley physics, math, psychology...and philosophy.
What you have there is simply a compulsively honest nerd. Don't blame the higher education, I assure you this set of habits probably got ingrained somewhere in elementary school.
|
|
|
|
|
Obviously it's not, I got 1-voted for it. But it was 100% worth it.
|
|
|
|
|
You've reached this conclusion from a sample size of one?? The first expert system (XCON) was conceived and written by a philosophy major.
|
|
|
|
|
@Alan, this is fun. I actually co-designed and implemented an Expert/AI system for telecom troubleshooting in the late 1980's (NOT with my philosophy friend) using Prolog, C, Peer-to-Peer networking, fault-tolerance, USGS Mapping, Touch screen, voice response and anything else we could get our hands on. Our hand picked development team was a real cross section of life and skill set including our Prolog instructor. We even attended the 'Third Annual Artificial Intelligence and Advanced Computer Technology Conference', Long Beach, CA, April 1987.
We presented our working prototype to the Senior Engineers of a major telecom company who doubted this could be done - they brought in AI PROFESSORS from the same university XCON/OPS5 came out of... The professors said Artificial Intelligence was still in the investigation stage and wasn't ready for prime time.
Final result: The 'major' telecom company used OUR system in their fancy demo facility to show prospects the future of telecom systems management.
|
|
|
|
|
Wow, I had not seen OPS5 in print anywhere in a long time.... Used to do that on a DEC MicroVAX II.
I need a 32 bit unsigned value just to hold the number of coding WTF I see in a day …
|
|
|
|
|
So, let me get this straight- you hire one kid with a philosophy degree that sucks and that implies all programmers with philosophy degrees suck? Now, that's questionable logic! Or are you suggesting that an employer just shouldn't hire some one to do a job that he hasn't been formally trained to do? If that's the case, then why single out people with philosophy backgrounds? I have a BA in philosophy and an MS in computer science. Prima facie, my philosophy training may seem irrelevant to software dev, but in fact it enhances my dynamic skills. I'm willing to bet that you imagine the philosopher to be some idealistic nitwit who sits in dingy coffee shacks and smokes hand-rolled tobacco while pondering the meaning of life. But in fact, philosophy, especially contemporary analytical philosophy, is a stringent discipline exalting logic and reasoning above all things. If this kid knowingly compromised the rules of logic, then he does not have a philosophical background at all. Any first year philosophy major learns that the foundation of meaning and understanding rest on the shoulders of unyielding logic. Another thing these 18 year-old children learn that you seemed to miss is that- there exist an X does not imply that for all X.
|
|
|
|
|
It's a generality, not true across the board.
Most programmers could play football (real football, not the gay soccer kind), but few should be on an NFL roster.
Now soccer, or even basketball, we could probably do. I bet most of us could flop pretty well, and we're almost all good at bitching about everyone else.
|
|
|
|
|
Bert Mitton wrote: real football, not the gay soccer kind
Funny thing that, it's in American handoval that people lie in piles grabbing each others crotches, while the real football as it's played in the rest of the world is supposed to be gay...
|
|
|
|
|
|
Compensated the downvote, that was funny too.
|
|
|
|