Comment On Units of Software

Marcus writes (via the Submit to The Daily WTF plug-in), "there are many days when I think that my company simply hired our development team because they were fast typists." [expand full text]
« PrevPage 1 | Page 2 | Page 3 | Page 4Next »

Re: Units of Software

2011-04-21 09:01 • by henke37
makeString2 is indeed redundant.

Re: Units of Software

2011-04-21 09:02 • by XXXXX (unregistered)
If you measure software in the number of Pieces Of Software (POS) that's exactly what you get.

Re: Units of Software

2011-04-21 09:11 • by Anon Too (unregistered)
Are you kidding me? WTF!

Re: Units of Software

2011-04-21 09:13 • by Your Name (unregistered)
You start paying by the line, you're gonna get more lines. What do you expect?

Re: Units of Software

2011-04-21 09:16 • by Machtyn (unregistered)
Are you seriously trying to pass this off as production code? That's first week of first semester of programming class mistakes (for those that have never looked at code prior to taking the class).

Re: Units of Software

2011-04-21 09:16 • by Some guy (unregistered)
344941 in reply to 344936
henke37:
makeString2 is indeed redundant.

It uses a completely different code path!

Re: Units of Software

2011-04-21 09:17 • by Pete (unregistered)
The optimist in me says this is fake, no one could possibly do this.

The realist says I have met people capable of this.

Re: Units of Software

2011-04-21 09:17 • by frits
Reading this article caused me to make poo.

Clearly the more elegant solution would account for all future needs:
Public Function makeTypeObject(Of t)(ByVal arg As t)

Return arg
End Function

Re: Units of Software

2011-04-21 09:17 • by Bob (unregistered)
Reminds me of the manager whose metric was a ratio of number of defects to lines of code. He offered a bonus to the programming staff if they could get the ratio below a certain threshold.

The programming staff worked one weekend to attack the problem. They inserted blank lines between all lines of code; in effect, they cut the ratio in half.

The manager was pleased with the result and convinced himself that he was a management genius.

Re: Units of Software

2011-04-21 09:24 • by vt_mruhlin (unregistered)
We can do better guys.

Public Function makeBoolean(ByVal b As Boolean)

if b is Boolean
return b as Boolean
else
return null
End Function


(I don't actually know VB, so I might have mixed some c# in there, but who cares if it's valid syntax. It's more lines!)

Re: Units of Software

2011-04-21 09:24 • by Nagesh
Not paid to argue

Are you not having weekly defect prevent meetings, where you do peer review of code?

Re: Units of Software

2011-04-21 09:28 • by Dan (unregistered)
344947 in reply to 344944
Bob:
Reminds me of the manager whose metric was a ratio of number of defects to lines of code. He offered a bonus to the programming staff if they could get the ratio below a certain threshold.

The programming staff worked one weekend to attack the problem. They inserted blank lines between all lines of code; in effect, they cut the ratio in half.

The manager was pleased with the result and convinced himself that he was a management genius.


If the policy resulted in programmers actually commenting their code that would have been genius (provided they were real comments).

Re: Units of Software

2011-04-21 09:28 • by Bas (unregistered)
Clearly Visual Basic does implicit type casting for such calls, and this is just a weirdly convoluted way of explicit type casting.

Re: Units of Software

2011-04-21 09:29 • by Keith (unregistered)
It is possible that the functions listed here are for the explicit purpose of creating new references, though it wouldn't be required for the value types and it would not work properly for the strings (due to interment).

Re: Units of Software

2011-04-21 09:31 • by Bill's Kid (unregistered)
I don't know, the MakeULong function might be useful. If it really works, that is.

Re: Units of Software

2011-04-21 09:33 • by anon (unregistered)
344951 in reply to 344944
Bob:
Reminds me of the manager whose metric was a ratio of number of defects to lines of code. He offered a bonus to the programming staff if they could get the ratio below a certain threshold.

The programming staff worked one weekend to attack the problem. They inserted blank lines between all lines of code; in effect, they cut the ratio in half.

The manager was pleased with the result and convinced himself that he was a management genius.


If it takes a team of programmers an entire weekend to add blank lines to their code, they're probably not the greatest programmers. Also, I know of nothing that includes blank lines when counting LoC. So basically, I'm pretty sure your story is bullshit.

Re: Units of Software

2011-04-21 09:34 • by Bumble Bee Tuna
I get emails advertising that makeULong function every day. It must be good code.

Re: Units of Software

2011-04-21 09:35 • by Larrik (unregistered)
344953 in reply to 344944
Bob:
Reminds me of the manager whose metric was a ratio of number of defects to lines of code. He offered a bonus to the programming staff if they could get the ratio below a certain threshold.

The programming staff worked one weekend to attack the problem. They inserted blank lines between all lines of code; in effect, they cut the ratio in half.

The manager was pleased with the result and convinced himself that he was a management genius.


It took a whole weekend to add line breaks to the source code? Now THAT is a WTF!

Re: Units of Software

2011-04-21 09:38 • by Menno (unregistered)
Shouldn't those be static functions? I think that's "Shared" in vb.

Re: Units of Software

2011-04-21 09:38 • by Larrik (unregistered)
344956 in reply to 344951
anon:


If it takes a team of programmers an entire weekend to add blank lines to their code, they're probably not the greatest programmers. Also, I know of nothing that includes blank lines when counting LoC. So basically, I'm pretty sure your story is bullshit.


That's easy, don't count LoC. Just count line breaks. I'm sure it'd easy to get that past this "manager".

Re: Units of Software

2011-04-21 09:38 • by m (unregistered)
344957 in reply to 344951
what about this instead of empty lines (added benefit: it makes the program run for longer, so it must be doing mode things, mustn't it!):

system ('echo "$random_string" >/dev/null');

captcha: genitus (genial I knew it..)

Re: Units of Software

2011-04-21 09:42 • by akatherder
344958 in reply to 344946
Nagesh:
Not paid to argue

Are you not having weekly defect prevent meetings, where you do peer review of code?


Yes. Yes we are not having those.

Re: Units of Software

2011-04-21 09:44 • by anonymouser (unregistered)
344959 in reply to 344946
Nagesh:
Not paid to argue

Are you not having weekly defect prevent meetings, where you do peer review of code?

I work with a bunch of Indian contractors; so, I have no peers.

Re: Units of Software

2011-04-21 09:46 • by Option Strict, Please (unregistered)
344960 in reply to 344948
Bas:
Clearly Visual Basic does implicit type casting for such calls, and this is just a weirdly convoluted way of explicit type casting.


Except that the return from all of these functions is of type Object

Re: Units of Software

2011-04-21 09:47 • by blarg (unregistered)
Public Function makeFristComment(ByVal u As Comment)
Return frist
End Function

Public Function makeRegularComment(ByVal u As Comment)
Return embededSystem
End Function

Re: Units of Software

2011-04-21 09:47 • by pussywhipped (unregistered)
344962 in reply to 344944
Bob:
Reminds me of the manager whose metric was a ratio of number of defects to lines of code. He offered a bonus to the programming staff if they could get the ratio below a certain threshold.

The programming staff worked one weekend to attack the problem. They inserted blank lines between all lines of code; in effect, they cut the ratio in half.

The manager was pleased with the result and convinced himself that he was a management genius.


I think I'm going to cry.

Re: Units of Software

2011-04-21 09:48 • by Le Forgeron (unregistered)
Assert#1: in C, LoC is measured by ";".
Rule #2: ";" by itself is a no-op.
Silly Target: double number of LoC.

Solution:
1. duplicate each ";" which ends a LoC (beware of actual ";" in text)
2. ...
3. Profit

Re: Units of Software

2011-04-21 09:49 • by gogol (unregistered)
344964 in reply to 344945
fixed


Public Function makeBoolean(ByVal b As Boolean)
if b is Boolean
return b as Boolean
else
return Boolean.FILE_NOT_FOUND
End Function

Re: Units of Software

2011-04-21 09:49 • by HonoreDB
These would get more effective (or possibly break everything forever if) you moved the right parenthesis a bit leftward.

Re: Units of Software

2011-04-21 09:49 • by pussywhipped (unregistered)
344966 in reply to 344946
Nagesh:
Not paid to argue

Are you not having weekly defect prevent meetings, where you do peer review of code?


As a peer reviewer, I am a peer. I will prove it by peeing all over it.

Re: Units of Software

2011-04-21 09:50 • by blarg (unregistered)
344967 in reply to 344944
Bob:
Reminds me of the manager whose metric was a ratio of number of defects to lines of code. He offered a bonus to the programming staff if they could get the ratio below a certain threshold.

The programming staff worked one weekend to attack the problem. They inserted blank lines between all lines of code; in effect, they cut the ratio in half.

The manager was pleased with the result and convinced himself that he was a management genius.


It took them a whole weekend to do something which a s/\n/\n\n/ style regex could have done in seconds?

Regardless.. the issue you highlight is exactly why people start using function point counts rather than line counts for their metrics, and this in turn is what drives people to do things such as this particular WTF

Re: Units of Software

2011-04-21 09:54 • by Nagesh
344968 in reply to 344958
akatherder:
Nagesh:
Not paid to argue

Are you not having weekly defect prevent meetings, where you do peer review of code?


Yes. Yes we are not having those.

No wonder poor quality of code.

Re: Units of Software

2011-04-21 10:02 • by Andy (unregistered)
In VB 6 this was the only way of doing casts, apart from creating another variable in the body of the code.

Re: Units of Software

2011-04-21 10:04 • by QJ (unregistered)
It's a bit like a piece of serial music.

It goes: "diddle-diddle-diddle-diddle-diddle-diddle-diddle-diddle-diddle ..." for ages, then suddenly does: "diddle-diddle-doodle-diddle ..." and then goes back to "diddle-diddle-diddle-diddle ..."

Utter genius.

Re: Units of Software

2011-04-21 10:05 • by SCSimmons
344971 in reply to 344967
blarg:
It took them a whole weekend to do something which a s/\n/\n\n/ style regex could have done in seconds?

If you do it in seconds, the manager will get suspicious of the huge improvement in the metric and start digging for details. If you bring the whole department in to work on it for the weekend, the 50% reduction in errors per line looks at least plausible. The manager doesn't need to know that the 60 hours of overtime he paid out was 2 minutes of writing replace scripts and 59 hours and 58 minutes of playing Quake.

Re: Units of Software

2011-04-21 10:12 • by QJ (unregistered)
344972 in reply to 344944
Bob:
Reminds me of the manager whose metric was a ratio of number of defects to lines of code. He offered a bonus to the programming staff if they could get the ratio below a certain threshold.

The programming staff worked one weekend to attack the problem. They inserted blank lines between all lines of code; in effect, they cut the ratio in half.

The manager was pleased with the result and convinced himself that he was a management genius.


The real WTF is that there are known defects in the code which are not being addressed. You can drastically reduce the number of defects in the code by fixing them when they come to light. Call me boring and old-fashioned but if (as that manager) I were to find what had been done (and if it were me, I would) then heads would roll. Granted, I would not use this metric in the first place, but that's not the point.

Re: Units of Software

2011-04-21 10:12 • by szeryf (unregistered)
I love makeString2 :)

Re: Units of Software

2011-04-21 10:19 • by Wonk (unregistered)
Someone told me this WTF had a cast of thousands.....I had no idea.

Re: Units of Software

2011-04-21 10:22 • by just me (unregistered)
344975 in reply to 344943
frits:
Reading this article filled me with the urge to defecate.


There, I Pink Floyded that for you...

Re: Units of Software

2011-04-21 10:22 • by Your Name (unregistered)
344976 in reply to 344972
QJ:
Bob:
Reminds me of the manager whose metric was a ratio of number of defects to lines of code. He offered a bonus to the programming staff if they could get the ratio below a certain threshold.

The programming staff worked one weekend to attack the problem. They inserted blank lines between all lines of code; in effect, they cut the ratio in half.

The manager was pleased with the result and convinced himself that he was a management genius.


The real WTF is that there are known defects in the code which are not being addressed. You can drastically reduce the number of defects in the code by fixing them when they come to light. Call me boring and old-fashioned but if (as that manager) I were to find what had been done (and if it were me, I would) then heads would roll. Granted, I would not use this metric in the first place, but that's not the point.


No, that is the point. If you are the sort of manager that uses useless metrics of the "defects per KSLOC" sort, you are likely also the sort of manager who won't look too closely (or even know how to look) at what your reports did to meet your useless metric.

Re: Units of Software

2011-04-21 10:27 • by boog
344977 in reply to 344946
Nagesh:
Not paid to argue

Are you not having weekly defect prevent meetings, where you do peer review of code?
Certainly you can't expect Marcus to point out the obvious asininity of this code in a formal peer review. He's sure to be labeled "that guy who hates on everyone else's code", and then he won't get invited to parties.

Yep, better to keep his mouth shut.

Re: Units of Software

2011-04-21 10:28 • by Lockwood
DirectCast()

Frist time I've been hit by Akismet. Am I now "one of the guys"?

Re: Units of Software

2011-04-21 10:29 • by Nagesh
344980 in reply to 344977
boog:
Nagesh:
Not paid to argue

Are you not having weekly defect prevent meetings, where you do peer review of code?
Certainly you can't expect Marcus to point out the obvious asininity of this code in a formal peer review. He's sure to be labeled "that guy who hates on everyone else's code", and then he won't get invited to parties.

Yep, better to keep his mouth shut.


marcus should do job with complete and total dedication. maybe he rise up and above in organization.

Re: Units of Software

2011-04-21 10:30 • by Rodnas (unregistered)
Everyone knows that more lines of code makes the software better, more stable and faster and more maintainable and ... well it is just better, Okay!

Re: Units of Software

2011-04-21 10:30 • by Nagesh
344982 in reply to 344978
Lockwood:
DirectCast()

Frist time I've been hit by Akismet. Am I now "one of the guys"?


Akismet love to hit me daily. In every post I make, I offer a small sacrificial post to Akismet.

Re: Units of Software

2011-04-21 10:30 • by Nagesh
344983 in reply to 344981
Rodnas:
Everyone knows that more lines of code makes the software better, more stable and faster and more maintainable and ... well it is just better, Okay!


Love sarcasm comment here.

Re: Units of Software

2011-04-21 10:32 • by Uncle Al (unregistered)
This reminds me of a story from a former boss. In his days working for a large defense contractor, management followed the well trodden, broad path (and we all remember where that path paved with good intentions leads, right? :-) ) to counting lines of code. However, they wanted to add a level of sophistication to the count. Since:
 

if (a) { b; }

and
 

if (a)
{
b;
}

are equivalent modulo formatting, they wanted to find a LOC metric that considered those equivalent. The method they hit on was counting semicolons (since this was C).

Subsequently, the development team's productivity soared... until the first external code review, which revealed that statements like the above had been replaced by the syntactically correct:
 

if (a) { b;; }

So much for that metric.

Re: Units of Software

2011-04-21 10:34 • by QJ (unregistered)
344985 in reply to 344977
boog:
Nagesh:
Not paid to argue

Are you not having weekly defect prevent meetings, where you do peer review of code?
Certainly you can't expect Marcus to point out the obvious asininity of this code in a formal peer review. He's sure to be labeled "that guy who hates on everyone else's code", and then he won't get invited to parties.

Yep, better to keep his mouth shut.


What you do is, you put your criticism in a sh*t sandwich.

Nice tasty complimentary (and ultimately non-nourishing) piece-of-bread comment to start with "What wonderfully neatly laid out code this is! I approve!"

Then give the sh*t: "... but surely we can accomplish this in an even more streamlined and enterprise-friendly manner by deleting the entire module."

Then the nice tasty complimentary (and ultimately non-nourishing) piece-of-bread comment to end with: "And how wonderfully bug-free it seems to be - no doubt it passed all its unit tests? Can we see the unit tests?"

You'll be rocketing up the promotion chain so fast you'll achieve escape velocity.

Re: Units of Software

2011-04-21 10:37 • by Anon (unregistered)
I know very little about VB / VB.NET, so could someone explain how this isn't largely equivalent to a) casting (e.g. (unsigned long) x); or b) forcing a type for an integer literal (e.g. 42lu); in C?

Re: Units of Software

2011-04-21 10:39 • by cheap nfl trolls (unregistered)
344987 in reply to 344982
Nagesh:

Akismet love to hit me daily. In every post I make, I offer a small sacrificial post to Akismet.

For this comment, inspired me, feeling this author words into my heart.
« PrevPage 1 | Page 2 | Page 3 | Page 4Next »

Add Comment