|
Lovely horrendous code. Even a stringbuilder would not be an improvement, it would merely be some paint over a house that is nearly collapsing.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
Mopping with the crane open!
It's an OO world.
public class SanderRossel : Lazy<Person>
{
public void DoWork()
{
throw new NotSupportedException();
}
}
My blog[ ^]
|
|
|
|
|
Marc Clifton wrote: there must be something we can put into the water There is. Code reviews.
/ravi
|
|
|
|
|
Ravi Bhavnani wrote: There is. Code reviews.
How do you figure out that the guy you hired is creating crap, especially if you're a small outfit and you only have one dev, and it's this guy? Do you hire another consultant to do the code reviews?
BTW, here's is bio:
With degrees in Electrical Engineering and Computer Science, Mr. ... has been programming and designing computer applications for over 20 years. The last five years have been spent on developing mobile apps for iPhone, iPad, Android and Windows Phone and Windows 8 environments. Mr. ... skills also include being a MS SQL Server DBA as well as a web developer..
Now that's scary.
Marc
|
|
|
|
|
Marc Clifton wrote: How do you figure out that the guy you hired is creating crap, I don't see any way other than formal/informal code inspections. The sooner they're done, the easier they are to fix. Eyeballing check-ins at the end of the day may be a valuable yet lightweight approach. If there's no cause for alarm, further reviews may be unnecessary, or at least not frequently required.
You don't want to find yourself in a situation (as I expect you may be in) where several weeks of check-ins are of poor quality.
/ravi
|
|
|
|
|
Marc Clifton wrote: With degrees in Electrical Engineering and Computer Science, Mr. ... has been programming and designing computer applications for over 20 years That's like saying "with qualifications in refrigerator and microwave oven design, Mr. ... has been creating recipes for over 20 years".
The qualifications have little to do with the work he's doing.
I wanna be a eunuchs developer! Pass me a bread knife!
|
|
|
|
|
Ravi Bhavnani wrote: Marc Clifton wrote: there must be something we can put into the water There is. Code reviews.
Well, we could put the offending developer into the water ... head-first. That would solve the issue.
The good thing about pessimism is, that you are always either right or pleasently surprised.
|
|
|
|
|
I disagree. Copy-paste makes for highly-efficient coding. Not only do you get a perfect duplicate of a line, but the efficiency increases exponentially with the number of copies! Think about it... First you copy-paste one line, then you copy-paste those two lines, then four... You could be copying thousands of lines after only a dozen pastes!
And think about it... Unlike all of those silly objects and functions, you can change just one of those thousand copies without having to mess with all of the rest! It's so much better that way.
So everyone needs to copy-paste more....copy-paste more....copy-paste more....copy-paste more....copy-paste more....copy-paste more....copy-paste more....copy-paste more....copy-paste more....copy-paste more....copy-paste more....copy-paste more....copy-paste more....copy-paste more....copy-paste more....
(Chris needs to add a <sarcasm> tag to the forums, cause I know someone is going to take the above literally... Well, not now, because they'll read this message... Unless it's too small... Here, let me make it smaller.....)
|
|
|
|
|
Ian Shlasko wrote: you can change just one of those thousand copies without having to mess with all of the rest! It's so much better that way.
Or use it's evil twin, search and replace to easily change everything everywhere with the click of a mouse button!
You've changed my thinking, Ian! I shall strive to become a copy-paste-replace developer!
Marc
|
|
|
|
|
Copy is OK; it's paste that causes the trouble.
|
|
|
|
|
If he was being paid by number of lines of code, I congratulate him. I'd probably do the same.
I wanna be a eunuchs developer! Pass me a bread knife!
|
|
|
|
|
C&P is so called static modelling, where programmer runs the program (not the computer), evaluate the exit and then write exactly what he done in his head in code, so computer can repeat it. Ironic thing is that computer is made for automation and actually it is his job to do the repetitive stuff while human neural network (called brain) is very good in finding and giving short description of repetitive stuffs.
So apparently some brains are better than others.
|
|
|
|
|
So, I just compiled a small web service that I, of course, did not write.
Got almost 100 "Unreachable code detected" errors. Why? Here's an example:
case [some case]:
return CallSomeFunction(xmldata);
break;
Marc
|
|
|
|
|
Well, you wouldn't want it to fall through, would you?
|
|
|
|
|
Well, on a X86, you'd need at 3 bit errors on the instruction to convert a RET (0xC2) to a NOP (0x90), but hey, I'm all for defensive programming!
Marc
|
|
|
|
|
It is a correct message
The compiler should not "guess" that the break is redundant; it should give a warning for the programmer to ignore.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
|
Well there is the problem,
The last line says "Break" so it did
|
|
|
|
|
wouldn't those be warnings? are is "warnings as errors" turned on?
If your actions inspire others to dream more, learn more, do more and become more, you are a leader.-John Q. Adams You must accept one of two basic premises: Either we are alone in the universe, or we are not alone in the universe. And either way, the implications are staggering.-Wernher von Braun Only two things are infinite, the universe and human stupidity, and I'm not sure about the former.-Albert Einstein
|
|
|
|
|
TheGreatAndPowerfulOz wrote: wouldn't those be warnings? are is "warnings as errors" turned on?
They are warnings. I hate warnings. Warnings should be fixed, even if their not treated as errors by the IDE.
Marc
|
|
|
|
|
agreed
If your actions inspire others to dream more, learn more, do more and become more, you are a leader.-John Q. Adams You must accept one of two basic premises: Either we are alone in the universe, or we are not alone in the universe. And either way, the implications are staggering.-Wernher von Braun Only two things are infinite, the universe and human stupidity, and I'm not sure about the former.-Albert Einstein
|
|
|
|
|
Amen to that, I use code analysis tools to and eliminate all the issues those detect.
Occassionally I have to use a pragma/code comment when I really intentionally did something, but its rare, and worth it for the number of bugs I detect early.
"If you don't fail at least 90 percent of the time, you're not aiming high enough."
Alan Kay.
|
|
|
|
|
When I started programming, structured programming was all the rage, and one of its fundamental principles was "single entry, single exit" for every block of code. While structured programming in no longer a primary development paradigm, it's principles are still valid.
Putting a return inside a case is the Devil's work.
Software Zen: delete this;
|
|
|
|
|
I fundamentally disagree, but it does depend on the language.
In C++ and many other languages I use RAII instead to ensure nothing is ever missed.
"If you don't fail at least 90 percent of the time, you're not aiming high enough."
Alan Kay.
|
|
|
|
|
A customer called last week reporting a problem with a screen not updating properly. The screen in question uses a 3rd party grid control. I pulled out the laptop and start debugging. I found only one possible problem related to user input, that eventually will be fixed, but wanted to get her back working with an easy workaround. So, I called, thinking that it could all be resolved quickly with a remote. So I get connected, verify that everything is up to date, go to the problem screen, try a quick update to demonstrate that it works, and...it doesn't work!
I pull up the code on my desktop and it misbehaves. I traced the problem back to one of the grid's events not firing. The code and executable work perfectly on the laptop and on at least one other test computer I have checked. There has to be a logical explanation for why this one component is behaving differently on different clients. I checked the grid's libraries on all three workstations and they are identical. It's probably going to be some obscure windows utility library that has been recently updated. Move to damage control mode and find another event that is reliable. Longer term, it's time to look for another component.
It's not often that I am able to replicate these kind of customer issues, and tracking this down without an environment that exhibited the oddity would have been extremely difficult.
Edit: Tried it again (code) on the desktop and it worked fine. The executable however fails to fire the event. I gave up trying to understand and identified a half-dozen places where I was using the faulty event and moved the code to another event that worked. Progress!
"Go forth into the source" - Neal Morse
|
|
|
|