• (cs) in reply to Djinn

    Djinn:
    What the hell is wrong you people who don't think this is a WTF? Okay, the variable name reuse is shitty, but it won't break anything,

    It may not break anything but it makes maintenence difficult. Especially if its a huge 500+ line function. You see the variable called szOwnerName = SzGetOwnerName(); at the top of the function.

    You think great, I got the OwnerName, I need it down here at the bottom of the function. Good I'm done...

    Little do you know the variables been used and abused and whored to death, and is no longer the OwnerName... Granted the maintainer should probably have done a quick search to make sure it was stillt he OwnerName, but still...

    Writing good code isn't always about writing code that works. It is about writing code that works AND can be easily updated in the future. By someone else.

  • (cs) in reply to jsmith
    jsmith:

    BTW, this turns out to be irrelevant.  Try this in Java or C#:

    String foo = "foo";
    String bar = "foo";
    String baz = bar;

    So, .Clone() is unnecessary as the language will create a new instance for you when you modify it.

    Great thanks C Pound for doing something I didn't ask you to do.

    I told you bas is equal to bar. Therefore when bar changes, baz should reflect that change. I didn't say "let baz get a copy or bar" I said "let baz equal to bar"

  • .* (unregistered) in reply to chrismcb
    chrismcb:
    jsmith:

    BTW, this turns out to be irrelevant.  Try this in Java or C#:

    String foo = "foo";
    String bar = "foo";
    String baz = bar;

    So, .Clone() is unnecessary as the language will create a new instance for you when you modify it.

    Great thanks C Pound for doing something I didn't ask you to do.

    I told you bas is equal to bar. Therefore when bar changes, baz should reflect that change. I didn't say "let baz get a copy or bar" I said "let baz equal to bar"

    Does that mean that this should work?

    int a = 5; int b = 6; int c = b; c += 2;

    // b now equals 8??


    = copies the data, in pretty much every language (even C, where it copies the address of the pointer).

  • .* (unregistered) in reply to chrismcb

    I'll try that again.

    chrismcb:
    jsmith:

    BTW, this turns out to be irrelevant.  Try this in Java or C#:

    String foo = "foo";
    String bar = "foo";
    String baz = bar;

    So, .Clone() is unnecessary as the language will create a new instance for you when you modify it.

    Great thanks C Pound for doing something I didn't ask you to do.

    I told you bas is equal to bar. Therefore when bar changes, baz should reflect that change. I didn't say "let baz get a copy or bar" I said "let baz equal to bar"

    Does that mean that this should work?

    int a = 5;
    int b = 6;
    int c = b;
    c += 2;

    // b now equals 8??

    ---------------------------------------

    The '=' operator copies the data, in pretty much every language (even C, where it copies the address of the pointer).

  • Robert (unregistered) in reply to chrismcb
    chrismcb:
    jsmith:

    BTW, this turns out to be irrelevant.  Try this in Java or C#:

    String foo = "foo";
    String bar = "foo";
    String baz = bar;

    So, .Clone() is unnecessary as the language will create a new instance for you when you modify it.

    Great thanks C Pound for doing something I didn't ask you to do.

    I told you bas is equal to bar. Therefore when bar changes, baz should reflect that change. I didn't say "let baz get a copy or bar" I said "let baz equal to bar"



    But it's already been pointed out that strings in .NET (and Java) are not mutable. It wouldn't make sense that the assignment of a new object to bar (as in changing the string, the changed string actually being a new object) would affect that which is now pointed to by baz.
  • (cs) in reply to chrismcb
    chrismcb:
    jsmith:

    BTW, this turns out to be irrelevant.  Try this in Java or C#:

    String foo = "foo";
    String bar = "foo";
    String baz = bar;

    So, .Clone() is unnecessary as the language will create a new instance for you when you modify it.

    Great thanks C Pound for doing something I didn't ask you to do.

    I told you bas is equal to bar. Therefore when bar changes, baz should reflect that change. I didn't say "let baz get a copy or bar" I said "let baz equal to bar"

    It actually does "let baz equal to bar".  The fact that bar==baz, even in Java proves that.  The one they mess with is the concatenation.

    baz += "more";

    is acually implemented more like:

    baz = baz.clone().append("more");

    That's why bar!=baz after the concatenation.  This behavior is intentional.  One of the biggest problems in C/C++ is that strings are treated as char arrays.  If a mistake is made on a bound check, it could lead to a very difficult to find bug or a buffer overrun vulnerability.  Modern high-level languages fix this by always reallocating strings and never editing them in place.  I've yet to meet a language where strings aren't at least a little weird.  For example, they are usually one of the only classes with a literal expression form.

  • Anonymous (unregistered) in reply to jsmith

    I think it's quite obvious that whilst he was hired as the contractor chargin the second highest rate, they only had 2 contractors apply for the position. It would explain a lot :P

  • (cs) in reply to pmagill

    Yeah its c# (DateTime.Now.ToString(), 'string' vs 'String' etc).

  • (cs) in reply to brazzy
    brazzy:
    Making the decision by looking who asks for the second-highest rate is only marginally less idiotic that looking for who asks for the lowest. How about asking *gasp* technical questions? Like, in an interview for a permanent position? There really shouldn't be much difference when hiring consultants. But ofcourse it requires you to already have at least one person who can ask the right questions and tell well-thought-out answers from buzzword bullshit.


    Or if you don't have anybody on hand to do that you could ask for a code sample. Have the consultant write a "Hello World!" app for you. Anyone who mis-spells "World", tries to be too fancy or generally handset in more than 10 lines of code, should be slapped across the face with a Cheque book, and sent on there merry way. Anybody else... might just be worth the risk.
  • (cs) in reply to ChiefCrazyTalk
    Anonymous:
    Alex Papadimoulis:

    someString = anotherString.ToString().ToString();

     

    Oh, and regarding this... perhaps the second ToString() is in case the first one doesn't work?  Maybe triple redundancy is needed here?



    Of course it is needed.  Every **expert consultant** knows that triple (at least) redundancy is essential in "mission critical" applications.
  • (cs) in reply to chrismcb
    chrismcb:
    jsmith:

    BTW, this turns out to be irrelevant.  Try this in Java or C#:

    String foo = "foo";
    String bar = "foo";
    String baz = bar;

    So, .Clone() is unnecessary as the language will create a new instance for you when you modify it.

    Great thanks C Pound for doing something I didn't ask you to do.

    I told you bas is equal to bar. Therefore when bar changes, baz should reflect that change. I didn't say "let baz get a copy or bar" I said "let baz equal to bar"

    It doesn't do something you didn't ask him to do, it does what it's supposed to do and you didn't understand what you asked for.

    Here, bar and baz are two names bound to the same object, two references to the same object, think of two pointers to the same location. Good.

    Now the big thing is that you can't modify the object referenced, since it's a string and both Java and C# strings are immutable. This is the first part.

    The second part is that when you later do baz = "chocolate", you're not modifying the object baz holds a reference to (the object the baz name is bound to), you're rebinding baz to a new object... which isn't the object bar is bound to anymore.

    If you want mutable strings, use mutable strings.

  • (cs) in reply to LordHunter317
    Anonymous:
    jsmith:
    BTW, C# interprets == as a value comparison for strings and Java interprets == as a reference comparison.
    The difference being that Java is consistent in it's application of ==, and C# is not.  In C#, == is an address comparision unless explictly overloaded.  This is confusing, especially since MS's policies on should be overloaded are retarded.


    Nope, that is consistent, on user-defined types the only way to automatically define the equality of two objects is to use identity.

    C# can't have the knowledge of the semantics of your object, it therefore uses the lowest common denominator: an object is equal to itself. That's perfectly sensible and logical.

  • FittMunken (unregistered) in reply to Volmarias

    Assuming this is C# (ToString() instead of toString(). I'm in no way familiar with Java, though.), string.Clone() does not return an actual clone, but rather a reference. This is an exception for strings, reason being that strings are immutable. You can't alter a string, so there's no point in copying it.

    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfSystemStringMethodsTopic.asp

    Remarks

    The return value is not an independent copy of this instance; it is simply another view of the same data. Use the Copy or CopyTo method to create a separate String object with the same value as this instance.

  • Toumal (unregistered) in reply to Rank Amateur

    So? Why let this fact get in your way?

  • (cs) in reply to masklinn
    masklinn:
    Anonymous:
    jsmith:
    BTW, C# interprets == as a value comparison for strings and Java interprets == as a reference comparison.
    The difference being that Java is consistent in it's application of ==, and C# is not.  In C#, == is an address comparision unless explictly overloaded.  This is confusing, especially since MS's policies on should be overloaded are retarded.

    Nope, that is consistent, on user-defined types the only way to automatically define the equality of two objects is to use identity.

    C# can't have the knowledge of the semantics of your object, it therefore uses the lowest common denominator: an object is equal to itself. That's perfectly sensible and logical.


    What he's calling inconsistent is not that part, it's the behaviour after the (allowed) overloading  of the operator. I smell another debate on operator overloading coming...

    Perhaps we can avoid it by focusing on the other part: what are MS's "policies" (coding standards?) on overloading == and what's retarded about them?

  • (cs) in reply to somejackass

    where it also was useful to avoid the hassle of scrolling up to the beginning of your function to declare another variable...


    I'm sorry but anyone who alters there code style based on the tediousness of scrolling to create a variable belongs in their own daily entry, not commenting on why todays could be justified.

  • (cs) in reply to somejackass
    Anonymous:
    This is a pretty lame WTF... I can see legitimate/semi-legitimate reasons to do most of these things.

    As for the different ways of setting a string value (with the exception of the last, which is silly), it seems like these were probably taken out of context. On this site we always assume the worst of the submission, but without context can we really tell? Couldn't the context have been:
    someObject = anotherObject.Clone();
    someString = anotherString.Clone();

    Likewise for the casting and .copy methods...

    I also don't see what's so wrong with re-using a variable name (in this case, docOwnerUsername). Yes, it's counterintuitive, but it can reduce memory usage on functions that recurse deeply (I got in this habit when I was doing a lot of C coding - where it also was useful to avoid the hassle of scrolling up to the beginning of your function to declare another variable). Naturally, this applies less in Java, where you can declare variables on the fly and, and you really should use a more generic name to avoid confusion (say, scratch or junk), but it is entirely possible this is just a strange habit being carried over to a new language.

    As for setting the string to be "null" instead of null, that's lame, sure, but is it that big of a deal? Probably not.

    Are any of these really all that horrible, except perhaps the double ToString() ? Nope.


    The post I'm refering to in my post

  • (cs) in reply to MeMyselfandI
    Anonymous:

    Mikademus:
    Seriously, I can't understand why everyone still seem to be so suprised over things like this. We already know that for every good programmer there are, say, 10 medicore and 100 asshat ones. We also know that managerial knowledge of code and coders is null (pun intended), wherefore they will use other standards for assessing "quality". In short, most code will be bad code. SNAFU rules unimpeded. FUBAR is and will be. Real Programmers will be increasingly disillusioned. News at 11.

    And the other rule is, we all seem to think that we're the one good programmer out of your 111.


    Heh, just thought about it today... How many of us (well, not including myself, obviously) code things that others go 'WTF?!?!?' when they see them ;)

    Anyway, I think this was a decent WTF!
  • bob (unregistered)

    >Initialize all variables at the point of declaration; null is prefered for reference
    > types and strings while min- and max- values are preferred for value types,
    > e.g. DateTime.MinValue.

    Besides the obvious issues with the code, may I mention that this is really lame in practice- any time you step through a constructor, you have to wade through a bunch of fields being initialized before you actually get to the meat of the constructor's code.

    Plus, nullable types make it all irrelevent if you're using 2.0...

  • Just a Bloke (unregistered) in reply to Randolpho

    Anonymous:
    I want to take that programmer into a small room and do unspeakable things to him. Seriously...... [^o)] WTF?

     

    .... but enough of your sexual fantasies[^o)] , what about the standard of his work????

  • ChiefEngineer (unregistered) in reply to .*
    Anonymous:
    chrismcb:
    jsmith:

    BTW, this turns out to be irrelevant.  Try this in Java or C#:

    String foo = "foo";
    String bar = "foo";
    String baz = bar;

    So, .Clone() is unnecessary as the language will create a new instance for you when you modify it.

    Great thanks C Pound for doing something I didn't ask you to do.

    I told you bas is equal to bar. Therefore when bar changes, baz should reflect that change. I didn't say "let baz get a copy or bar" I said "let baz equal to bar"

    Does that mean that this should work?

    int a = 5; int b = 6; int c = b; c += 2;

    // b now equals 8??


    = copies the data, in pretty much every language (even C, where it copies the address of the pointer).



    Well, you can get such behavior in C++ by declaring c as a reference to b, i.e.:

    int b = 6;
    int& c = b;
    c += 2;     // now b = 8!

  • (cs) in reply to jsmith
    jsmith:
    chrismcb:
    jsmith:

    BTW, this turns out to be irrelevant.  Try this in Java or C#:

    String foo = "foo";
    String bar = "foo";
    String baz = bar;

    So, .Clone() is unnecessary as the language will create a new instance for you when you modify it.

    Great thanks C Pound for doing something I didn't ask you to do.

    I told you bas is equal to bar. Therefore when bar changes, baz should reflect that change. I didn't say "let baz get a copy or bar" I said "let baz equal to bar"

    It actually does "let baz equal to bar".  The fact that bar==baz, even in Java proves that.  The one they mess with is the concatenation.

    baz += "more";

    is acually implemented more like:

    baz = baz.clone().append("more");

    That's why bar!=baz after the concatenation.  This behavior is intentional.  One of the biggest problems in C/C++ is that strings are treated as char arrays.  If a mistake is made on a bound check, it could lead to a very difficult to find bug or a buffer overrun vulnerability.  Modern high-level languages fix this by always reallocating strings and never editing them in place.  I've yet to meet a language where strings aren't at least a little weird.  For example, they are usually one of the only classes with a literal expression form.

    This sort of confusion with reference variables is precisely why we should all go back to using plain C, where variables are explicitly holding pointers or values. Buffer overrun, buffer schmoverun. We should allocate memory manually, like real men, preferably by reaching into RAM with a fine pair of tweezers.

    --Rank

  • (cs) in reply to Ann Coulter
    Anonymous:

    Generally, using toString is not the way to convert objects to strings. Using format or convert objects is better especially if you need to worry about internationaliztion or localization. The toString should really be used for debugging.

    WTF? are you serious?

    ToString() is simply a function that returns a string of some kind. The default implementation (at least in C#) for value types is typically to return the object's value formatted as a string. For reference types, it usually returns the object's class name, but should be overridden to return a string that has more semantic relevance.

    String.Format() gives you culture-specific formatting, but it calls ToString() on the object internally.

    I see no reason to relegate ToString() to debugging.
  • (cs) in reply to somejackass
    Anonymous:
    This is a pretty lame WTF... I can see legitimate/semi-legitimate reasons to do most of these things.

    As for the different ways of setting a string value (with the exception of the last, which is silly), it seems like these were probably taken out of context. On this site we always assume the worst of the submission, but without context can we really tell? Couldn't the context have been:
    someObject = anotherObject.Clone();
    someString = anotherString.Clone();

    Likewise for the casting and .copy methods...

    I also don't see what's so wrong with re-using a variable name (in this case, docOwnerUsername). Yes, it's counterintuitive, but it can reduce memory usage on functions that recurse deeply (I got in this habit when I was doing a lot of C coding - where it also was useful to avoid the hassle of scrolling up to the beginning of your function to declare another variable). Naturally, this applies less in Java, where you can declare variables on the fly and, and you really should use a more generic name to avoid confusion (say, scratch or junk), but it is entirely possible this is just a strange habit being carried over to a new language.

    As for setting the string to be "null" instead of null, that's lame, sure, but is it that big of a deal? Probably not.

    Are any of these really all that horrible, except perhaps the double ToString() ? Nope.



    Just a personal note here, but if someone reused a variable name as THREE DIFFERENT VARIABLE TYPES (Date, Boolean, Filename), even if they are all string representations, and the variable is named anything except "StupidStorageString" they are completely incompetent. That kind of crap makes code unmaintainable, and is the worst kind of sloppiness.

  • (cs) in reply to JoeyLemur
    JoeyLemur:
    I have to wonder why core Java just doesn't define String.toString to throw a YouDumbassException...

    Huh?
    For a start, the above is C#, secondly, Huh? Why?
  • (cs) in reply to chrismcb
    chrismcb:
    <If your function recurses, it doesn't matter if you reuse the variable or not. You are getting another one on the stack. <p>I reuse variables, they tend to be called "i" for an index. If you are worried about reducing memory (if you are why are you using java or c#?) then scope your variables. This will also save the tediousness of hitting the page up key.

    True, but if you are recursing deeply you can run out of stack space. If you can reuse one int (4 bytes on a typical system) inside a function, you save the space of that one int each time your function is called. If your function needs to call itself 1 million times (presumably this is a bottle neck anyway and you are looking for every little trick to get more speed out of it), you can save 4 megabytes of memory. Carefully reuse it in 5 different ways, and you have saved 20 megabytes. If you are using other variables that cannot be reused (perhaps some strings), and you might be hitting swap, so not having these extra variables around can result in a large speed increase.

    If the dataset will only results in a couple levels of recursion, this is a waste of time. Most recursive functions never get more than 100 levels (if that much) in my experience, so it isn't worth bothering with memory savings.

    Of course it is a WTF to not use a union (at least in C/C++) for variables that you reuse, as the union will indicate that you really meant to reuse it.

  • Grim Reaper (unregistered)

    Folks to put this to rest... the plain and simple nonpreferential WTF isn't what the programmer assigned the default variables to but rather that this consultant failed to understand the [simple] standards.

    RIP

  • (cs) in reply to FORTRAN slinger

    All that ToString().ToString() redundancy is just silly. Why not just be a typical clever consultant and get it over with recursion?

    public string ToString(string s) {
      return ToString(s);
    }

    -J-

  • Not Second Best (unregistered) in reply to somejackass
    Anonymous:
    This is a pretty lame WTF... I can see legitimate/semi-legitimate reasons to do most of these things.

    As for the different ways of setting a string value (with the exception of the last, which is silly), it seems like these were probably taken out of context. On this site we always assume the worst of the submission, but without context can we really tell? Couldn't the context have been:
    someObject = anotherObject.Clone();
    someString = anotherString.Clone();

    Likewise for the casting and .copy methods...

    I also don't see what's so wrong with re-using a variable name (in this case, docOwnerUsername). Yes, it's counterintuitive, but it can reduce memory usage on functions that recurse deeply (I got in this habit when I was doing a lot of C coding - where it also was useful to avoid the hassle of scrolling up to the beginning of your function to declare another variable). Naturally, this applies less in Java, where you can declare variables on the fly and, and you really should use a more generic name to avoid confusion (say, scratch or junk), but it is entirely possible this is just a strange habit being carried over to a new language.

    As for setting the string to be "null" instead of null, that's lame, sure, but is it that big of a deal? Probably not.

    Are any of these really all that horrible, except perhaps the double ToString() ? Nope.




    You're kidding, right?

    I don't do Java, but if I saw a string set to "null", I'd be pretty sure that there was no enlightenment to be had in the rest of the code.

    Neeeeeexxxxxxxt. . .




  • Not Second Best (unregistered) in reply to aakoch
    aakoch:
    Anonymous:

    As for setting the string to be "null" instead of null, that's lame, sure, but is it that big of a deal? Probably not.


    Sorry, but that is just WRONG!

    String someString = "null";
    is not the same as
    String someString = null;

    So, later in the code, when others are checking for null, they're doing...
    if (someString == null) {
        ...
    }

    and you just broke their software!


    Hey, I think I some some data files the null-man created.  Interspersed in client address fields was the word "null" (not quoted).

    Sigh. . .





  • 2 cents (unregistered) in reply to Tony Morris
    Anonymous:
    Serves them right for having such a ridiculous code guideline.
    <ideological>
    They should teach definite assignment semantics and their advantages in school, and ban C programmers from making code guidelines for C#/Java. And while ya there...
    </ideological>



    C#, Java programmers can drive cars.

    C programmers can fix cars.


  • Hiro (unregistered)

    This has "code generator" + lazy written all over it.

  • hoser (unregistered) in reply to Hiro

    Enough with the syntax corrections.

    How about some hints on how to spot these useless people.

  • (cs) in reply to chrismcb
    chrismcb:

    Djinn:
    What the hell is wrong you people who don't think this is a WTF? Okay, the variable name reuse is shitty, but it won't break anything,

    It may not break anything but it makes maintenence difficult. Especially if its a huge 500+ line function. You see the variable called szOwnerName = SzGetOwnerName(); at the top of the function.

    You think great, I got the OwnerName, I need it down here at the bottom of the function. Good I'm done...

    Little do you know the variables been used and abused and whored to death, and is no longer the OwnerName... Granted the maintainer should probably have done a quick search to make sure it was stillt he OwnerName, but still...

    Writing good code isn't always about writing code that works. It is about writing code that works AND can be easily updated in the future. By someone else.



    Did you even read what I wrote?
  • (cs) in reply to hoser
    Anonymous:
    Enough with the syntax corrections.

    How about some hints on how to spot these useless people.

    Look in the mirror?

    <font size="2">sorry, couldn't resist <g></font>
  • Me (unregistered) in reply to Strydyr

    I'm gonna back you up on this one as well...

        public static void main(String[] args) {
            final List list = Arrays.asList(new String[]{"a", "b", "c", "d", "e"});
            // imagine you don't know exactly what's in this list 
            final Iterator iterator = list.iterator();
            while (iterator.hasNext()) {
                Object o = iterator.next();
                System.out.println(o.toString());
            }
        }

    At least in Java, toString() comes from java.lang.Object:

    toString

    public String toString()
    Returns a string representation of the object. In general, the toString method returns a string that "textually represents" this object. The result should be a concise but informative representation that is easy for a person to read. It is recommended that all subclasses override this method.

    The toString method for class Object returns a string consisting of the name of the class of which the object is an instance, the at-sign character `@', and the unsigned hexadecimal representation of the hash code of the object. In other words, this method returns a string equal to the value of:

     getClass().getName() + '@' + Integer.toHexString(hashCode())

    Returns:
    a string representation of the object.

    so obviously a "String representation" of a String would be the same String, but the reason toString is present in String is because of OO.
  • (cs) in reply to Me
    Anonymous:
    At least in Java, toString() comes from java.lang.Object

    As opposed to which language?

  • (cs) in reply to Volmarias
    Volmarias:
    I get the feeling that he's actually creating a new string, then appending each character to it (in the processes, creating a new string each time)


    I certainly hope he's using recursion to copy the characters one at a time.
    (Holding prayer-beads, hitting Post)
  • (cs) in reply to chrismcb
    chrismcb:

    Reminds me of a memory leak I had to track down. If I remember correctly it went something like this (paraphasing the code)

    CBstr *cbstrOrginal = new CBstr();

    CBstr *cbstrNew = cbstrOriginal.Copy();

    CBstr is a class that wraps a BSTR. Of course it overrides the = operator, which does the appropriate thing and makes a copy of the BSTR. So TWO copies of the orignal was created, one was assigned to cbstrNew and the other was leaked.

     


    No, only ONE copy is made. You're confusing CBstr with CBstr* (by the way, why are you using such a class? MSVC++ already gives you _bstr_t).


    CBstr can override this:

        CBstr foo, bar;

        foo = bar;


    But it can't override this:

    CBstr *foo, *bar;
    foo = bar;



  • LordHunter317 (unregistered) in reply to brazzy
    brazzy:
    Perhaps we can avoid it by focusing on the other part: what are MS's "policies" (coding standards?) on overloading == and what's retarded about them?
    Immutables only, which is so fucking retarded as to make the feature worthless.  It simply shouldn't have been incldued, or another operator provided for reference comparsions.

    The fact it's impossible to have a value of a UDT, only a pointer, is the whole problem here and why this issue doesn't exist in C++.

  • John the Baptist (unregistered) in reply to Randolpho

    Actually...YOU left out the "Ho Ha Ha", then comes the guard, dodge, parry, thrust, then ANOTHER "Ha", Then spin...

  • Thomas Eyde (unregistered) in reply to Randolpho
    Anonymous:
    I want to take that programmer into a small room and do unspeakable things to him. Seriously...... [^o)] WTF?


    Yes. Speakable things wouldn't hurt too much.
  • (cs) in reply to masklinn
    masklinn:
    Anonymous:
    At least in Java, toString() comes from java.lang.Object

    As opposed to which language?



    You picky bitch. Get off your high horse, Narcissus.
  • Robert (unregistered) in reply to jamisonkfox
    jamisonkfox:
    where it also was useful to avoid the hassle of scrolling up to the beginning of your function to declare another variable...


    I'm sorry but anyone who alters there code style based on the tediousness of scrolling to create a variable belongs in their own daily entry, not commenting on why todays could be justified.


    Not even mentioning that there's likely to be something very wrong if you have functions long enough to require much scrolling to reach the top of them.
  • John Hensley (unregistered) in reply to Oliver Klozoff
    Oliver Klozoff:
    No, only ONE copy is made. You're confusing CBstr with CBstr* (by the way, why are you using such a class? MSVC++ already gives you _bstr_t).

    I think you just answered your own question
  • someone (unregistered) in reply to Volmarias

    However, since there doesn't appear to be a String.Copy method, I have the sinking suspicion that he created a string class, which extends String,


  • (cs) in reply to masklinn
    masklinn:
    Anonymous:
    At least in Java, toString() comes from java.lang.Object

    As opposed to which language?


    I think Sun would object litigatiously to any other language having a class called java.lang.Object.

    But I susped he was aiming at languages without a single-root inheritance tree, such as C++, where there are no methods you can assume to be present in every class.
  • andy (unregistered) in reply to aakoch

    That's ridiculous! Of course you should write the test like this:
    if (someString == null || someString == "null") {
      // someString is really null. Both by normal convention and by consultant conventions
    }

    Always make your code prepared for attacks by consultants which might step into it and fsck it.
    :P

  • andy (unregistered) in reply to andy

    Hm, seems like the quote for my post disappeared so it doesn't make much sense. New attempt:

    *** Quote ***
    Sorry, but that is just WRONG!

    String someString = "null";
    is not the same as
    String someString = null;

    So, later in the code, when others are checking for null, they're doing...
    if (someString == null) {
        ...
    }

    and you just broke their software!
    *** End quote ***

    That's ridiculous! Of course you should write the test like this:
    if (someString == null || someString == "null") {
      // someString is really null. Both by normal convention and by consultant conventions
    }

    Always make your code prepared for attacks by consultants which might step into it and fsck it.
    :P



    (hope this ends up correct, otherwise I resign :))

  • ChucK Levasseur (unregistered)

    Haha,

    Once, I work with that king of consultant.  Ahaah, all variable was “Alpha”, “Beta”, “Gamma”, ....  

     

    Men!  What a head hash! <?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p>

Leave a comment on “The Replacement”

Log In or post as a guest

Replying to comment #:

« Return to Article