• Little Bobby Tables (unregistered)

    "Got no room for you in this department. Would you mind if I passed your CV to the Java team?"

  • (nodebb)

    Since this guy was all for improvement, Erik should at least have helped him improve himself, by reminding him you're supposed to write unit tests for your own code, not for the standard library.

  • bvs23bkv33 (unregistered)

    no comment should be longer than 400 lines

  • (nodebb)

    Despite the fact the candidate was off on unit testing, being proud of a sloppy bullshit codebase with 0 unit tests is a huge part of the major problem in this industry: Nobody cares about the technical debt until it grows so large that the company undergoes "technical bankruptcy" when their garbage app collapses. And it will happen at some point. It may be so far off into the future that it's not on the radar, but it's still there festering and building up.

  • Tim Ward (unregistered)

    The answer to "why are you leaving your previous job" is ALWAYS "because I got pissed off with management". But you must NEVER say that, because no hiring manager is going to hire someone who can't take management, are they.

    So, the interviewer always asks "why are you leaving your previous job", and knows perfectly well that the answer is "because I got pissed off with management", and knows perfectly well that that's not what the interviewee is going to say.

    The game is for the interviewee to try to think of something different to say that's actually true (and of course any sane interviewee knows they're going to be asked this question and has thought up the answer in advance). The interviewer then scores the answer on inventiveness.

  • Just for Laughes (unregistered)

    Ms. Bailey: I have yet to read your article although I do intend you.

    I felt it necessary to tell the people from "the county" that the signal has been received, and whether this is from way above my paygrade, or a micro social engineering exercise, I now have outside response for my personal reflection each day.

  • Just for Laughes (unregistered)


  • Just for Laughes (unregistered)

    It's a mistake to think companies, especially in San Fransisco, a port on the Pacific standing against Asia with a major military presence, are filled with nice people.

    "dictating demands in the interview wasn't exactly a strong recommendation"

    If you yes someone to death, you end up being beheaded!

    And yes. If you are doing something with STIG, that needs cold testing for form fit and function, unit testing standard libraries is a must, considering Huawei can poison you with WIFI.

    You know, just a free thinking in response to a growing malevolence, from both sides. Fascist, Marxists ... ... ... whoever.

    The face of the criminal, his mind, his hands, his heart, there really is only just one story, dating long before a material existence themselves.

    Before you critique unit tests, know there's someone like you, probably down on their luck, starving, and their not your pet for your immature childish games.

    That attitude, of people as fuel or food, right there, is why people die, children shoot up schools, and cities burn.

  • Uhh (unregistered)

    Erik is the real WTF in this story right?

    You don't have to write all your unitests in one go, just write them for every new feature you develop and write them whenever you modify/update an old piece of functionality? That would be the bare minimum for someone who freely admits their codebase is bad and needs fixing.

  • MiserableOldGit (unregistered) in reply to Medinoc

    Yeah, that did seem odd. They seemed to rule out that he'd done this just to demonstrate the approach rather than actually waste time testing maths.abs

    Only time I can imagine finding myself writing that kind of test is if I have convinced myself, in an incredible bug hunt, that my code is perfect and the problem lies in the standard library. Somewhere north of 99% of the time I'll be proving myself wrong and quietly brushing the testing work under the carpet.

  • (nodebb)

    Hey every once in 10 years, if you live in the jungle, an actual bug will crawl onto the motherboard and cause Math.Abs to fail. Gotta make sure it doesn't happen.

  • Anon9 (unregistered)

    Maybe Alarik was the author of the Math library.

  • (nodebb) in reply to Mr. TA

    Alarik definitely was onto something! https://github.com/dotnet/try/issues/290

  • Brian (unregistered) in reply to Tim Ward
    Tim Ward:
    The answer to "why are you leaving your previous job" is ALWAYS "because I got pissed off with management".

    Funny, the reason for leaving my previous job was that it was a startup company that folded. And I wasn't terribly annoyed at that development, as the commute was pretty horrible and I was already contemplating leaving anyway if I couldn't negotiate a decent WFH deal. In fact, the management was all for me paying off some technical debt with modern-day best practices (except for the veteran CTO who had written that code according to the customs of software development in the '80s).

  • Feeling lucky (unregistered) in reply to Tim Ward

    Au contraire, I once lost my job because I pissed of management .. for a perfectly good reason ..

  • Argle (unregistered) in reply to Tim Ward

    I'm not sure whether to agree or disagree. My last job, management was me and a late wife who helped destroy the business. But my first job after college was a great one that I left... because of management. However, at the same time I was enticed away by a 40% salary increase. So, yes, nicer to say that than say "I took another job because the new manager we got, who was an incompetent crony of the new president, managed to deeply insult every junior and senior member of our team and I left before he could do the same to me." A year I later contacted the guy who hired me. He never had a bad word to say about anyone, but just commented that, with the president and his cronies gone, life was a bit better there.

  • Kleyguerth (github)

    I was hoping for a big reveal that Alarik worked in Microsoft, and was part of the C# dev team... That would explain the tests for Math.abs and String.split...

  • (nodebb)

    Code file length? 11,000 lines to long? 1000 lines to long? 400 lines to long? Ok, what is the proper length for a code file because honestly I cant judge any answer given to the previous questions. If the guy answer with a number I ask how he picked that number, because I will tell you this, anyone that has an arbitrary number is most definitely, absolutely, without a doubt, WRONG. If you have 20 lines and doing more then one thing you are wrong, if you have 50 lines but performing one thing you are right. It doesn't come down to length of the function, class, file, it comes down to proper application of standard principles. If that application gives you only 10 lines, fine, if that application gives you 50 lines, fine, but to put an arbitrary number on it is wrong because then you are looking at the wrong measurement. Granted longer functions, classes files have a higher CHANCE of breaking those principles, but they do not automatically do so. Yes, I have had this discussion many times and each and every time someone puts out an arbitrary number they cannot validate that number in any way, you can validate the principle and it does lead to shorter line counts but it does not lead to line counts of exactly 10 lines or less.

  • Karl Bielefeldt (github)

    While you can't put an exact number on when a file is too big, that doesn't mean you can't make broad generalizations. At 11,000 lines, we start talking about whether an entire service needs splitting, let alone a single code file.

  • davidgutierrezpalma (github) in reply to Medinoc

    Some time ago, I found one Math function in Unity which was returning an unexpected value when compared to the equivalent function in the C# standard library. This behaviour was documented by Unity, but I introduced a bug in the code because I incorrectly assumed its behaviour was the same than the behaviour of the equivalent function in the standard library.

    At the end of the day, I managed to fix the bug because I wrote Unit Tests to check the behaviour of that Unity function with the parameters which were triggering the unexpected behaviour, so those Unit Tests were certainly useful. However, the real WTF was that I didn't find out earlier because I didn't read that function documentation.

  • (nodebb) in reply to Karl Bielefeldt

    That is already addressed in my statement. Following the principle does lead to shorter line counts. It's the issue of picking an arbitrary number that is the problem which the guy being interviewed is guilty of. Having 11,000 lines has a very high chance that more than one thing is happening, and that chance very possibly is as close to 100% as to have no consequence in the difference. But remember I talk principles not lines of code.

  • Barf4Eva (unregistered) in reply to Just for Laughes

    ...because of 0 unit tests? right?

  • löchlein deluxe (unregistered)

    Nice change from the usual brownfield stories of "They dumped 11kloc of undocumented unstructured code with no specs on me. Of course there was a bug somewhere, but they wouldn't let me do anything but debug-by-printf" we usually get. ;-)

  • (nodebb) in reply to KattMan

    Well, obviously the correct number of lines for a code file is 42.

  • Say what (unregistered)

    I'm on Alarik's side on this (and yes, I have done interviews, on both sides of the table). From a candidate, I would like to know what they value and what technical matters they would consider quitting over. Or shall we begin with lies, avoid areas of disagreement, and continue into passive-aggressive sniping at work, instead? The real WTF here is the company. If a candidate suggests a best practice and the company management is too spineless to tell the candidate what the situation is at their workplace and figure out whether they can come to agreement, then that's management's problem ... and it's a red flag for the company, too.

    As for being proud of 0 unit tests three years on ... good luck with that. The dangers of this are well-known. Some people drive drunk or speed recklessly on country roads and some of them don't come to a sticky end. It doesn't mean that those behaviours are the smart ones, it just means that they are lucky! But luck has a tendency to run out ... write in again in 10 years, if your software is still worth anything.

  • Ian (unregistered)

    I don't think I quite trust Erik's account. While he claims to know what UT's are, he seems to think they're just a pointless affectation for making things look nice and "craftsmanship'y", and he seems rather proud that his product keeps on plodding along as a crappy, untested hugeblob of a technical debt timebomb. And it's not even that they didn't have the means to test the old stuff, they didn't even add unit tests to new things introduced into it, as that would increase that number past 0.

    The Math.Abs() test sounds like it was meant to show off Alarik's ability to write good unit tests on something simple with known expected behaviour, not a demonstration that Alarik thinks he needs to unit test library functions. But alas, Erik's questionable competence in this area naturally led him to this interpretation instead. Honestly, it sounds like Alarik probably dodged a bullet here.

  • (nodebb) in reply to Ian

    The Math.Abs() test sounds like it was meant to show off Alarik's ability to write good unit tests on something simple with known expected behaviour, not a demonstration that Alarik thinks he needs to unit test library functions.

    Except that when prompted for a sample of a unit test that he wrote for a job, he offered a different test of the built-in functionality of a core .Net class.

  • Fnord (unregistered) in reply to davidgutierrezpalma

    Or sometimes the function documentation is wrong. Take Math.atan2(y, x) in Java. Way, way back, I was working this this puppy via Codewarrior. I don't know WHO buggered up the documentation - I've found it rather difficult to find even mentions of Java 1.08 in this day and age - but it clearly said you passed it x, y as any sane person would expect instead of the actual y, x (which is TRWTF of this comment). When I started getting obvious garbage answers, I started digging. Sure enough, blown documentation.

  • Stephen Cleary (unregistered)

    Years ago I was hired in for a job as a C# developer, but my 3rd year with the company they needed an embedded engineer. "Embedded" as in C, not C++, with no dynamic memory allocation, and no OS - just a sort of thread switcher that didn't handle floating-point registers.

    Anyway, I ran into a problem with abs() in the C stdlib for that processor; it took a long time to duplicate and track down. It turned out that my code assumed that the result from abs() would never be a negative number. But for this implementation, abs(-2147483648) == -2147483648

    In C#, Math.Abs(-2147483648) throws OverflowException.

  • Brian Boorman (google) in reply to Steve_The_Cynic
    Except that when prompted for a sample of a unit test that he wrote for a job, he offered a different test of the built-in functionality of a core .Net class.
    He's simply demonstrating that you don't have to worry about IP theft with him.
  • Maia Everett (github)

    In C#, Math.Abs(-2147483648) throws OverflowException.

    That's C#. Even in Java, it just silently returns -2147483648.

  • anon (unregistered)

    This post breaks my RSS reader with the message "LibXML error 9 at line 121 (column 69): xmlParseCharRef: invalid xmlChar value 24 ". There is a character '\x18' between the two dots at the end of the line ""Ah, yes. Here is my test for String.split.." Please remove it.

  • Carra (unregistered)

    Erik's company seems to be wtf.

    I get it, you don't have unit tests. At least add them for new code or code you're refactoring.

  • Varstahl (unregistered)

    I just wanted to notify you guys that "Ah, yes. Here is my test for String.split.. completely invalidated and broke the RSS feed. You might want to fix that.

  • Ian (unregistered) in reply to Steve_The_Cynic

    Except that when prompted for a sample of a unit test that he wrote for a job, he offered a different test of the built-in functionality of a core .Net class.

    Well, we're back to the question of trusting Erik's account to accurately portray what happened. Which I don't, and said as much. There's perfectly understandable explanations of this too if we don't assume Erik to actually be a fully reliable narrator.

  • doubting_poster (unregistered)

    It's a nice change of pace to see the WTF from the other side, the company that is at fault.

  • Just A Guy (unregistered)

    There's nothing really wrong with unit tests, or TDD. And it is a good idea to re-evaluate and refactor code. I do agree that doing it in parallel is difficult, but it is possible.

    Tidy, well-organized, readable code is easier to write and easier to maintain, and therefore more cost-friendly.

  • (nodebb) in reply to KattMan

    There is a maximum file length, but it is tool dependent. That maximum length is whatever is the maximum that can be displayed as a diff in your code review tool. After that good code review becomes too cumbersome and very likely to be neglected. In (at least) some tools that maximum length is measured in lines.

  • (nodebb)

    Let see...

        UnitTest.Assert(Math.Abs(4) == 4);
        UnitTest.Assert(Math.Abs(-4) == 4);
        UnitTest.AssertException(Math.Abs(Int.MinValue) = Int.MinValue, OverflowException);

    (Not tested, but it expresses the ideas. If I was submitting it as a code sample, it would definitely be run in the IDE and I would have the output from the test.)

  • (nodebb) in reply to Stephen Cleary

    C programs generally do not break on integer overflows/underflows. You have to make the check after your operation to see if it applies to your operation, including library functions.

  • Neveralull (unregistered)

    My manager checked in his own code without unit tests, although we weren't allowed to check in our code without unit tests. Subsequently, I would be assigned to add a feature requiring me to update his code, which I couldn't test without writing a complete set of unit tests for his code along with my changes. Then I get dinged for taking too long for such a small change.

  • (nodebb)

    I'm glad to see this. Most of the comments and articles I've seen over the years at TDWTF are quite intolerant of such business realities.

  • (nodebb) in reply to Tim Ward

    Yes. Interviews go to the candidate who's the best in salesmanship, not necessarily the best programmer.

  • Cbuttius (unregistered)

    Companies sell a product, not code. When the product works, they concentrate on what brings in more sales.

    And almost inevitably you get shortcuts but those who wrote it are proud of it, it works and has brought them in loads of money from clients. They don't want a newcomer coming in and refactoring their code.

    The worst thing is they will often seek the strongest developers and pay the money for it then relegate them to junior to maintain "their" code.

    To have unit tests you need units to test. Code that can be tested on its own, but no doubt you can't do that with their codebase where everything relies on everything else.

Leave a comment on “A Passion for Testing”

Log In or post as a guest

Replying to comment #:

« Return to Article