A lot of these seem to be attempts to fit into existing "best practices". Unit tests that prove nothing. Boilerplate Java code that does nothing. Maybe we should reevaluate some best practices. I have debated before on here that many unit tests seem useless as the units are too small, and you essentially end up testing your language or framework which you already know works. Integration testing on the other hand make…
Shit programmers write
41–50 of 82 posts
Re: Shit programmers write
#42A lot of these seem to be Microsoft technologies like C# or SQL server. Is that because the owner is more familiar with the MS stack? Or do MS devs have more to complain about?
From my experience, such code is not specific to MS technologies, but is indeed often found in “enterprisey” code, a lot of which just happens to be in Java and C#. And enterprisey code is like that because it's often outsourced to the lowest bidder. I once had to print a method that took 50 pages of paper, so I could understand what it does, and after 15 minutes I realized it's the same 60 lines repeated over and ov…
On the plus side, the code still had comments for the punchcard numbers, so it was pretty easy to keep the pages in order :)
Re: Shit programmers write
#43Re: Shit programmers write
#44 if (Math.random() == 0.1234567890)
{
for (var i = 0; i
Reminds me of the code I have to insert to prevent overzealous compilers from completely optimizing away my benchmark loops.Re: Shit programmers write
#45A lot of these seem to be Microsoft technologies like C# or SQL server. Is that because the owner is more familiar with the MS stack? Or do MS devs have more to complain about?
From my experience, such code is not specific to MS technologies, but is indeed often found in “enterprisey” code, a lot of which just happens to be in Java and C#. And enterprisey code is like that because it's often outsourced to the lowest bidder. I once had to print a method that took 50 pages of paper, so I could understand what it does, and after 15 minutes I realized it's the same 60 lines repeated over and ov…
Re: Shit programmers write
#46Earlier quoted context omitted.
From my experience, such code is not specific to MS technologies, but is indeed often found in “enterprisey” code, a lot of which just happens to be in Java and C#. And enterprisey code is like that because it's often outsourced to the lowest bidder. I once had to print a method that took 50 pages of paper, so I could understand what it does, and after 15 minutes I realized it's the same 60 lines repeated over and ov…
Just curious: Why does printing it on paper helps you to understand code better than reading it on screen?
Sometimes, if you're really lucky, the blocks of working code don't modify their own conditionals, and you can 'fold' them and just look at the if's and loops...
Re: Shit programmers write
#47 return bolReturn;
}The above actually seems reasonable if you assume the programmer that wrote it was intelligent. I'm imagining that the above code is called multiple times by the application, for a new optional feature in development. Currently, they haven't developed the feature, and so we are always returning false. But in the future, we likely will want to show the feature given some condition. So this programmer has (hopefully) decided that (s)he will write the current code to take this future development into account, and rather than pass some boolean or config value throughout the code, has isolated it to one specific method.
Now, when they go to implement Optional, whatever that is, that developer can just update this one method with the expression, and go about coding their feature without any knowledge of the previous code base, which is exactly what's supposed to happen.
Re: Shit programmers write
#48"I Don’t Know".ToJson();
public string ToJson()
{
var s = new StringBuilder("{");
for (var i = 0; i Re: Shit programmers write
#49Earlier quoted context omitted.
From my experience, such code is not specific to MS technologies, but is indeed often found in “enterprisey” code, a lot of which just happens to be in Java and C#. And enterprisey code is like that because it's often outsourced to the lowest bidder. I once had to print a method that took 50 pages of paper, so I could understand what it does, and after 15 minutes I realized it's the same 60 lines repeated over and ov…
Just curious: Why does printing it on paper helps you to understand code better than reading it on screen?
Also, faster and more flexible annotation (drawings, etc), but that's secondary.
Re: Shit programmers write
#50I haven't slept well lastnight (only 4 hours) so please bear with me... but what is the joke on this snippet? "I Don’t Know".ToJson(); public string ToJson() { var s = new StringBuilder("{"); for (var i = 0; i