• A Kiss My (unregistered) in reply to Lockwood
    Lockwood:
    DirectCast()

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

    What is this Akismet? I've been commenting here for years and I've never seen it. Let's try...

  • phew (unregistered) in reply to Patrick
    Patrick:
    If you delete a 2MB file of bad code, does that count negatively on your production?

    "Well, I'm pleased you got that entire project finished in one week, but unfortunately it says here that you only wrote four lines of code." "... well, that's..." "In one week. Do you know how much code the other members of our 'TEAM' write in a week?" "But they..." "And this project only took four lines, I mean what were you doing the rest of the time? Should I have doubts about the other estimates you give me?"

    A colleague had a script that looked at all the changes he had submitted and came up with a line count. It was something like -100000 LOC. Of course, it also generated a lines changed and that was in the millions...

  • Luiz Felipe (unregistered) in reply to gogol

    lol, i laught megabytes. it isnt even visual basic nor csharp some kind of visual sharp perhaps.

  • Gordon Bennett (unregistered)

    But the code actually works and does something. Ok, it relies on you not having Option Strict set on (and I prefer my languages to be very strict), but

    Dim i As Integer = 2 Dim o As Object = MakeLong (i)

    and o is actually a Long now..... The functions implicitly convert the parameter to the correct type and give a return value of the same type as the parameter.

    Of course Dim i As Integer = 2 Dim l As Long = MakeLong (i)

    is not better than Dim i As Integer = 2 Dim l As Long = i

    I'm not understanding why you want functions to convert types (instead of using built-in conversions), when you're going to allow the compiler to do implicit conversions anyway...

  • Luiz Felipe (unregistered) in reply to Luiz Felipe
    Luiz Felipe:
    lol, i laught megabytes. it isnt even visual basic nor csharp some kind of visual sharp perhaps.
    'Adendum, wtf i clicked wrong button, need to stop with vodka. Public Function makeBoolean(ByVal b As Boolean) if b is Boolean return b as Boolean else return null End Function
  • Luiz Felipe (unregistered)

    "Counting program development by lines of code is same as counting airbus construction by weight" Bill Gates "Everty time you try to measure development eficiency by code count (independently if it is function point or lines of code, or whatever) the programmers will game with it." (dont remenber who said)

  • Luiz Felipe (unregistered) in reply to hoodaticus
    hoodaticus:
    The generic version:
    Public Function MakeAnything(o)
         Return o
    End Function
    This is not the generic version. This is the generic versiom:
    Function MakeAnything(of T)(O as Object) AS T
         Return DirectCast(o,T)
    End Function
    
    But it is broken.
    Function MakeAnything(of T) AS T
         'Insert code here to random create objects on the fly, perhaps emiting IL for fun
         Return x
    End Function
    
  • WTF (unregistered) in reply to Bob

    Please tell me its a joke :-) nnnnnnnnnnnnoooooooooooooooooooooooooooooooo wwwwaaaaaaaaaaaaaayyyyyyyy !!!! That would a good WTF post.

  • WTF (unregistered) in reply to Bob
    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.

    This is a joke, right ? :-) Please tell me its a joke.

    If its not, please make a WTF post for this :-)

  • trtrwtf (unregistered) in reply to dohpaz42
    dohpaz42:
    boog:
    {{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{
      printf("I'm ");;;;;;;;;;;;;;;;;;;;
      printf("sure ");;;;;;;;;;;;;;;;;;;;
      printf("you're ");;;;;;;;;;;;;;;;;;;;
      printf("joking.\n");;;;;;;;;;;;;;;;;;;;
      printf("This ");;;;;;;;;;;;;;;;;;;;
      printf("is ");;;;;;;;;;;;;;;;;;;;
      printf("valid ");;;;;;;;;;;;;;;;;;;;
      printf("C.\n");;;;;;;;;;;;;;;;;;;;
    }}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}

    It has nothing to do with the validity of code; I was simply thinking of a different way to count lines of code - with respect to developers trying to game the system by adding useless semi-colons and whitespace, etc.

    Exactly. How many lines would the quoted code come out to?

  • MojoFilter (unregistered) in reply to Bumble Bee Tuna

    Zing, sir!

  • n_slash_a (unregistered)

    no no no, it's very simple to add useless LOC

    if (false) { // add whatever you want here bool thisMetricIsStupid = true; // infinite loops just for fun for (;;) while(true) {;} }

  • (cs) in reply to dohpaz42
    dohpaz42:
    boog:
    dohpaz42:
    1. Strip out all comments. 2. Strip out all new lines. 3. Insert new lines after opening and closing curly braces. 4. Insert new lines after every semi-colon. 5. Strip out all semi-colons. 6. Count lines.
    {{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{
      printf("You ");;;;;;;;;;;;;;;;;;;;
      printf("missed ");;;;;;;;;;;;;;;;;;;;
      printf("the ");;;;;;;;;;;;;;;;;;;;
      printf("point?\n");;;;;;;;;;;;;;;;;;;;
      printf("Maybe ");;;;;;;;;;;;;;;;;;;;
      printf("you're ");;;;;;;;;;;;;;;;;;;;
      printf("not ");;;;;;;;;;;;;;;;;;;;
      printf("joking.\n");;;;;;;;;;;;;;;;;;;;
    }}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}

    It has nothing to do with the validity of code...

    I assume you mean the syntax, and it certainly matters if C allows the above syntax. Which it does.

    dohpaz42:
    I was simply thinking of a different way to count lines of code - with respect to developers trying to game the system by adding useless semi-colons and whitespace, etc.
    Acknowledged. I was simply posting code demonstrating that developers could still game the system under your new approach. Or was your approach not to be followed step-by-step in the listed order?
  • Ã (unregistered)

    Believe it or not, this is necessary in Hyderabad. They're implementations of several programming languages removes several features, so you have to make sure your program works correctly by adding seemingly redundant code. You get the added bonus of being able to charge by line of code, but I'm sure the poor fool who wrote this (looking at you Nagesh) didn't realize he was getting paid by the hour.

  • The Great Lobachevsky (unregistered) in reply to Lockwood
    Lockwood:
    DirectCast()

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

    We aren't all guys here :)

  • Gunslnger (unregistered) in reply to anon
    anon:
    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.

    Open a file in Programmer's Notepad (make sure the option to display line numbers is enabled), hit Ctrl-End, read the line number of the last line. There, you know how many lines of code are in the file [if you're a manager].

  • Worf (unregistered) in reply to Your Name
    Your Name:
    You start paying by the line, you're gonna get more lines. What do you expect?

    In the early days of Apple, they had the same metric. Until one of their star programmers went to have fun with it and removed 2,000 lines of code. He put in -2000 as the number of lines he wrote.

    http://www.folklore.org/StoryView.py?project=Macintosh&story=Negative_2000_Lines_Of_Code.txt&sortOrder=Sort%20by%20Date&detail=medium&search=-2000%20lines

  • Gunslnger (unregistered) in reply to Andy
    Andy:
    In VB 6 this was the only way of doing casts, apart from creating another variable in the body of the code.

    Uh, that's not true. Besides, you should never need to do casts without using a new variable anyways.

  • (cs) in reply to Gunslnger
    Gunslnger:
    Andy:
    In VB 6 this was the only way of doing casts, apart from creating another variable in the body of the code.

    Uh, that's not true. Besides, you should never need to do casts without using a new variable anyways.

    Especially since casts always create a copy.

  • ÃÆâ€â„ (unregistered) in reply to Andy
    Andy:
    In Hyderabad this was the only way of doing casts, apart from creating another variable in the body of the code.
    FTFY
  • (cs) in reply to Gunslnger
    Gunslnger:
    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.

    Open a file in Programmer's Notepad (make sure the option to display line numbers is enabled), hit Ctrl-End, read the line number of the last line. There, you know how many lines of code are in the file [if you're a manager].

    Indeed. Or in any other text editor. Or by running "wc -l". In fact, most ways I can think of to count lines include blank lines unless you explicitly say to ignore them (or remove them yourself).

    So basically, I'm pretty sure the GP's comment about being pretty sure the GGP's story is bullshit is bullshit.

  • iMalc (unregistered) in reply to Bumble Bee Tuna

    Not good enough to prevent you being passed through the makeSingle function, I expect.

  • iMalc (unregistered) in reply to Bumble Bee Tuna
    Bumble Bee Tuna:
    I get emails advertising that makeULong function every day. It must be good code.
    Not good enough to prevent you being passed through the makeSingle function, I expect.
  • Cyt (unregistered) in reply to dohpaz42
    dohpaz42:
    You know, that is actually a very valid point. I once interviewed for a company that had absolutely no development environment. In fact, all of their developers (there were more than 5 at the time) would work on production files. When I asked if it were permissible to install and work off of a development environment (i.e., on the local work station), I was scoffed at as if this was some crazy idea. Thankfully, I never did get that job.

    I take that your convincing skills wouldn't be able to convince anyone that umbrellas help you not get wet when you're out in the rain either.

  • PRMan (unregistered) in reply to QJ
    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.

    Actually, that is EXACTLY the point.

  • (cs) in reply to n_slash_a
    n_slash_a:
    no no no, it's very simple to add useless LOC

    if (false) { // add whatever you want here bool thisMetricIsStupid = true; // infinite loops just for fun for (;;) while(true) {;} }

    QFT +1001

  • Bas (unregistered) in reply to Option Strict, Please
    Option Strict:
    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

    Sure, then you just double-casted, as the function argument still casts.

  • Splognosticus (unregistered) in reply to frits

    Shit. Shit. Tell me you just made that syntax up. I don't want to live in a world where freaking Visual Basic has generic types!

  • Bill Clinton is the Man (unregistered) in reply to Bas

    No VB'er worth their salt will code without 'Option Explicit On'

  • Franz Kafka (unregistered) in reply to frits
    frits:
    It's usually called a "complement sandwich" and a well known passive-agressive management technique for delivering criticism. I think QJ's is much more acurate, since I would never expect a real sandwich to be named by its bread only.

    It's main effect, when used on me, is to be immediately suspicious of any complement from a manager.

  • (cs) in reply to Splognosticus
    Splognosticus:
    Shit. Shit. Tell me you just made that syntax up. I don't want to live in a world where freaking Visual Basic has generic types!
    Generics, anonymous functions, LINQ, multiline lambdas, collection initializers, ...

    From 2010 forwards, all major language features will be introduced in both VB and C# at the same time. The teams have been merged at Microsoft.

  • Barry (unregistered)

    Stupid VB programmers.. what else do you expect?

  • moz (unregistered) in reply to Anonymous Coward
    Anonymous Coward:
    In that context, I shudder to think what the makeUShort would entail.
    Oh, it's not that scary. You give some money to them, and you never see it again, leaving you short.
  • (cs) in reply to Bumble Bee Tuna
    Bumble Bee Tuna:
    I get emails advertising that makeULong function every day. It must be good code.

    But it's nobody ever gets ads for makeUShort. I smell a business opportunity here!

    "Tired of hitting your head when you walk through a door frame? Sick of telling people no, you don't play basketball? Well, now there's a solution! Introducing the all new makeUShort function! Only eleven easy payments* of only nineteen-ninety-nine-ninety-nine-ninety-nine-ninety-nine! That's right, only eleven easy payments of only $19.999999*!! Just call 1.80056E9!

    • (That should be just $19.99. Sorry, our in-house proprietary floating-point arithmetic library is a little glitchy.)"
  • KITT (unregistered) in reply to Poochy.EXE
    Poochy.EXE:

    But it's nobody ever gets ads for makeUShort. I smell a business opportunity here!

    "Tired of hitting your head when you walk through a door frame? Sick of telling people no, you don't play basketball? Well, now there's a solution! Introducing the all new makeUShort function! Only eleven easy payments* of only nineteen-ninety-nine-ninety-nine-ninety-nine-ninety-nine! That's right, only eleven easy payments of only $19.999999*!! Just call 1.80056E9!

    • (That should be just $19.99. Sorry, our in-house proprietary floating-point arithmetic library is a little glitchy.)"

    Just ask for Procrustes, he'll take care of you.

  • trtwtf (unregistered) in reply to Franz Kafka
    Franz Kafka:
    frits:
    It's usually called a "complement sandwich" and a well known passive-agressive management technique for delivering criticism. I think QJ's is much more acurate, since I would never expect a real sandwich to be named by its bread only.

    It's main effect, when used on me, is to be immediately suspicious of any complement from a manager.

    Even a two's complement?

  • C-Octothorpe (unregistered) in reply to frits
    frits:
    hoodaticus:
    Meep:
    riiiiiiiiiiiiiiiiiiiight:
    Okay, I think we can establish now for sure that hoodactius and nagesh are the same person.

    I'm not so sure, I thought they were life partners. The real question is which one is the top and which is the bottom?

    My heart will always belong to Morbius Wilters.
    I thought he was an Asian chick.

    Anyway, are we allowed to talk about him here?

    Yeah, what ever happened to that effeminate asian dude? Never before have I met someone as funny and angry at the same time as him...

  • (cs) in reply to Franz Kafka
    Franz Kafka:
    frits:
    It's usually called a "compliment sandwich" and a well known passive-agressive management technique for delivering criticism. I think QJ's is much more acurate, since I would never expect a real sandwich to be named by its bread only.

    It's main effect, when used on me, is to be immediately suspicious of any compliment from a manager.

    FTFY

  • Not of this Earth (unregistered) in reply to Andy

    Again, TRWTF is Java. Carthago delendam esse!

    // Voila! template <typename T> inline T make(T foo) { return foo; }

    But wait... Compiler isn't paid for units of software!

  • oheso (unregistered)

    Don't see the problem here. Code works as specified.

  • Moritz (unregistered) in reply to Bob

    Being paid for lines of code is like being paid for bugs found.

    Thank you, Dilbert: http://dilbert.com/strips/comic/1995-11-13/

  • A. Manager (unregistered) in reply to Gunslnger
    Gunslnger:
    anon:
    I know of nothing that includes blank lines when counting LoC. So basically, I'm pretty sure your story is bullshit.

    Open a file in Programmer's Notepad (make sure the option to display line numbers is enabled), hit Ctrl-End, read the line number of the last line. There, you know how many lines of code are in the file [if you're a manager].

    If you're a manager you use Word to open the file and hold the down arrow until you get to the bottom. Then you read the line number.

    Bonus wages for wrapped lines.

  • (cs) in reply to Matt Westwood
    Matt Westwood:
    Franz Kafka:
    frits:
    It's usually called a "compliment sandwich" and a well known passive-agressive management technique for delivering criticism. I think QJ's is much more acurate, since I would never expect a real sandwich to be named by its bread only.

    It's main effect, when used on me, is to be immediately suspicious of any compliment from a manager.

    FTFY

    You can spell. Good for you.

  • Anon (unregistered) in reply to A Kiss My

    Is me a spam?

  • (cs) in reply to frits
    frits:
    Matt Westwood:
    Franz Kafka:
    frits:
    It's usually called a "compliment sandwich" and a well known passive-agressive management technique for delivering criticism. I think QJ's is much more acurate, since I would never expect a real sandwich to be named by its bread only.

    It's main effect, when used on me, is to be immediately suspicious of any compliment from a manager.

    FTFY

    You can spell. Good for you.

    And you can't, so much the worse for you. It makes you come across as even more ignorant than you actually are, which for you is saying something.

  • (cs) in reply to Matt Westwood
    Matt Westwood:
    frits:
    Matt Westwood:
    Franz Kafka:
    frits:
    It's usually called a "compliment sandwich" and a well known passive-agressive management technique for delivering criticism. I think QJ's is much more acurate, since I would never expect a real sandwich to be named by its bread only.

    It's main effect, when used on me, is to be immediately suspicious of any compliment from a manager.

    FTFY

    You can spell. Good for you.

    And you can't, so much the worse for you. It makes you come across as even more ignorant than you actually are, which for you is saying something.

    Oh, I'm sorry. I must have missed the string of mind-blowing enlightenment coming from "Matt Westwood". I'll stay tuned from now on. That way I'll learn how to snobbishly correct others' spelling mistakes and not contribute a single interesting comment.

  • (cs) in reply to frits
    frits:
    Matt Westwood:
    frits:
    Matt Westwood:
    Franz Kafka:
    frits:
    It's usually called a "compliment sandwich" and a well known passive-agressive management technique for delivering criticism. I think QJ's is much more acurate, since I would never expect a real sandwich to be named by its bread only.

    It's main effect, when used on me, is to be immediately suspicious of any compliment from a manager.

    FTFY

    You can spell. Good for you.

    And you can't, so much the worse for you. It makes you come across as even more ignorant than you actually are, which for you is saying something.

    Oh, I'm sorry. I must have missed the string of mind-blowing enlightenment coming from "Matt Westwood". I'll stay tuned from now on. That way I'll learn how to snobbishly correct others' spelling mistakes and not contribute a single interesting comment.

    YHBT etc.

  • (cs) in reply to Matt Westwood
    Matt Westwood:
    frits:
    Matt Westwood:
    frits:
    Matt Westwood:
    Franz Kafka:
    frits:
    It's usually called a "compliment sandwich" and a well known passive-agressive management technique for delivering criticism. I think QJ's is much more acurate, since I would never expect a real sandwich to be named by its bread only.

    It's main effect, when used on me, is to be immediately suspicious of any compliment from a manager.

    FTFY

    You can spell. Good for you.

    And you can't, so much the worse for you. It makes you come across as even more ignorant than you actually are, which for you is saying something.

    Oh, I'm sorry. I must have missed the string of mind-blowing enlightenment coming from "Matt Westwood". I'll stay tuned from now on. That way I'll learn how to snobbishly correct others' spelling mistakes and not contribute a single interesting comment.

    YHBT etc.

    Riiiight

  • e john (unregistered)

    All this whining ! Yuo KNOW you are going to need a UShort - at least now you have a way to get one ! And it's a reusable, standard way !

    Geez ....

  • (cs) in reply to Cyt
    Cyt:
    dohpaz42:
    You know, that is actually a very valid point. I once interviewed for a company that had absolutely no development environment. In fact, all of their developers (there were more than 5 at the time) would work on production files. When I asked if it were permissible to install and work off of a development environment (i.e., on the local work station), I was scoffed at as if this was some crazy idea. Thankfully, I never did get that job.

    I take that your convincing skills wouldn't be able to convince anyone that umbrellas help you not get wet when you're out in the rain either.

    Some people can't be convinced.

    "It will take too long to get the umbrellas in place." "We've always worked in the rain, why should we change?" "What if an umbrella breaks and stabs a customer in the eye?" "Rain is stable." "Real programmers don't mind rain." "Umbrellas are for those big fancy companies."

    Also see: "Why don't you/yes but."

Leave a comment on “Units of Software”

Log In or post as a guest

Replying to comment #:

« Return to Article