• Guest (unregistered) in reply to A Wizard a True Star
    So, in which languages do you think Hungarian Notation would actually be useful?
    In any language that a) does accept one name to be used multiple times as long as the type is different and b) does not have a strong type-checking.
  • D. T. North (unregistered) in reply to panzi
    panzi:
    Top Cod3r:
    On Error Resume Next

    One of the "greatest" features of Visual Basic. "Just ignore all errors." shudder

    And isn't that the root of everything coded by Microsoft?

  • zoips (unregistered) in reply to Sam B
    Sam B:
    But quote honestly, who cares, right?

    You should care. If you don't feed and appreciate good trolls, they go away and all you get are shitty trolls that are unbearable and annoying instead of amusing.

  • (cs)

    If the company's purpose was to find prime numbers I would be worried that the CEO didn't know that 1 was not prime. However, I wouldn't want to work for a company that was just finding prime numbers. I am sure that at least some of the people I do work with probably think that 1 is prime and I have no problem with that. I would be more worried about hiring someone who spends his free time calculating prime numbers and not something more productive.

  • (cs) in reply to Ville
    Ville:
    Or alternatively use a proper programming language where you always know the type and the proper use of "On Error Resume Next" is to never use it.
    So you refer to some language that doesn't have typed variables and doesn't support try catch style semantics?

    And even in VB6, try-catch-finally semantics can be implemented. Given the following:

    On Error Goto Catch 'Working code here Goto Finally Catch: 'Error trapping code here Finally: 'clean up code here

    You get the try-catch-finally semantics very easily. Now notice that On Error Resume Next breaks even this, so yes, the appropriate usage of OERN is to not use it.

  • (cs) in reply to SarcasmFTW
    SarcasmFTW:
    You kinda have to assume that the first interview is for a position requiring a fair amount of mathematical knowledge. Because unless I have really fallen out of touch, knowing off the top of your head how to calculate the nth prime is not something everyone is expected to know how to do. Unless of course, they were expected the exhaustive search method, but if they were only expecting that, why even bother ask the question.

    I think it's a pretty fair question as long as the interviewer is willing to give some hints. Most people probably don't know the solution off the top of their head but all developers should know what a prime number is, and how to determine if any given number is a prime.

    There's also plenty of room for modifying the problem, such as adding a look-up table or some wacky recursive solution or something.

  • Chiper (unregistered) in reply to Global Warmer
    Sounds to me like you are the one who thinks "he knows it all" and is unwilling to learn.
    And that would be the point of the post. I got the joke, why didn't you?

    I can name one disadvantage of MVC, at least in web projects. Code overhead. By pure definition you have three or more files required to create one page (in the case of some frameworks like CakePHP, you have over a dozen includes). If said page is small and/or simple, those extra files are just wasted bulk, as is the memory required to pass data between all those files.

    Of course, now I've fed the anti-php trolls. You're welcome, enjoy your sustenance.

  • Chris (unregistered) in reply to A Wizard a True Star

    int iValue;

    ... 20,000 lines later...

    Oops, we need to handle more widgets than we expected. Make iValue a 'long'.

    Now what do you do? Do you change every instance of 'iValue' to 'lValue'? How long will that take? Remember to include time for testing, documentation, etc. This may not even be possible, e.g., if this is in a published libraries used by others.

    Or, you could say 'iValue' is an exception. But that means you're not using pseudoHungarian notation any longer and you can't trust your prefixes. So they not only no longer helpful, they're actively misleading in some cases.

    Then there's the whole 'far pointer to an array of pointers to functions expecting a string and an integer and returning nulls' prefix thang. (Oops, not the function takes a long!). Any meaningful prefix for that will be a nightmare to read -- "fpApfvSia[i++] = fpApfvSib[j++];" anyone?

    The bottom line is that the original HN was an interesting idea. The pseudoHN pushed by Microsoft is a cute idea that fails horribly in the real world.

  • Ville (unregistered) in reply to KattMan
    KattMan:
    And even in VB6, try-catch-finally semantics can be implemented.
    Yes, I'm aware of that. But the guy I quoted was referring to "a proper programming language" that by his explanation would not have typed variables nor support for try catch style semantics. So I was just wondering, what "proper" programming language he was referring to.
  • Ville (unregistered) in reply to Chris
    Chris:
    Now what do you do? Do you change every instance of 'iValue' to 'lValue'? How long will that take? Remember to include time for testing, documentation, etc. This may not even be possible, e.g., if this is in a published libraries used by others.
    If that would be public property of a class or a member of structure, then yes, changing the name would be a problem in a published library. But wouldn't changing the data type be at least equally problematic? For functions changing the name of a parameter wouldn't be a problem at all in most languages, but changing the data type would be.
  • (cs)

    The problem with not registering and creating an identity for yourself is that someone will come along and register your name.

    See you under your new login name, or you can buy this one off me for the right price :)

    ~Not Top Cod3r

  • Expatriot (unregistered) in reply to Sam B
    Sam B:
    Well, this being the Internet, where it's already difficult to detect satire or sarcasm, one must make an "extra effort", as it were, to ensure that people get your point.

    But notice I said "so veiled as to be undetectable". There's a difference between "difficult to detect" and "virtually undetectable". There was no indication that what "Top Cod3r" said was sarcastic or satiric. None whatsoever.

    Well, it tripped my satire detector in the second sentence, and it was pretty unambiguous by the end. You don't need to hang around here long to pick up that "On Error Resume Next" and excessively enterprisey application architectures are running jokes.

    Yay! I win at Internet!

  • Sam B (unregistered) in reply to zoips
    zoips:
    Sam B:
    But quote honestly, who cares, right?

    You should care. If you don't feed and appreciate good trolls, they go away and all you get are shitty trolls that are unbearable and annoying instead of amusing.

    True enough! Wise words indeed :)

  • (cs)

    Usually Interview WTFs are my only true enjoyment that I derive from this website... but man these sucked.

    And what happened to all the math fascists that normally would rejoice in this kind of post? The grammar nazi's are in full reign?

    Actually, I think prior to the grammar nazi's, it was the logic communists that had large movement a couple of years ago... So, it is definitely not the right time for the math fascists to strike. Ahh.. I see now. You all are biding your time... waiting for the perfect moment to strike.

  • Sam B (unregistered) in reply to Chris
    Chris:
    int iValue;

    ... 20,000 lines later...

    Oops, we need to handle more widgets than we expected. Make iValue a 'long'.

    Now what do you do? Do you change every instance of 'iValue' to 'lValue'? How long will that take? Remember to include time for testing, documentation, etc. This may not even be possible, e.g., if this is in a published libraries used by others.

    Well, Visual Studio 8 (and even 7, AFAIK) makes it really easy to rename variables. It will refactor the code accordingly.

    But, I get your point and agree with you.

  • Sam B (unregistered) in reply to Expatriot
    Expatriot:
    Sam B:
    Well, this being the Internet, where it's already difficult to detect satire or sarcasm, one must make an "extra effort", as it were, to ensure that people get your point.

    But notice I said "so veiled as to be undetectable". There's a difference between "difficult to detect" and "virtually undetectable". There was no indication that what "Top Cod3r" said was sarcastic or satiric. None whatsoever.

    Well, it tripped my satire detector in the second sentence, and it was pretty unambiguous by the end. You don't need to hang around here long to pick up that "On Error Resume Next" and excessively enterprisey application architectures are running jokes.

    Yay! I win at Internet!

    While I've been following Daily WTF now for a bit over a year, I've not really read the comments. So I guess it's partly my fault, then, too, for not understanding the memes floating around here xD

  • (cs)

    Two WTFs, that aren't? Say it isn't so!

    WTF #1: Obviously, the WTF is the person complaining that 1 isn't prime when, just like the interviewer said, it's a "maybe".

    WTF #2: If the guy did the test that many times, you might not employ him (up to you, I'd have him in for an interview myself, I like people who think outside the box), but perhaps you should congratulate him for being smart enough to figure out how to ace the test, and for pointing out a flaw in your scoring system (the flaw being that you return results while the exam is still available). Deriding him for taking it 140 times is deriding yourself 139 times, IMHO.

    I know when I was in College, if I had figured out to do something like this to pass a test in a programming class, I'd have a 50/50 shot of either impressing the hell out of the teacher, or getting in some (minor) trouble and having to take a new (fixed) exam.

  • iamunregistered (unregistered)

    To all the people laughing at the On Error Resume Next question: it is not necessarily used to ignore errors. I guess you guys would fail the question because you don't know how it's supposed to be used.

    http://www.powerasp.com/content/new/on-error-resume-next.asp

    Sheeesh.

    My captcha was "immitto".

  • Franz Kafka (unregistered) in reply to gabba
    gabba:
    So David passed up an opportunity with a promising startup because of this nerdy pedantic prime number disagreement? They're better off without him.

    And Greg passed up an enterprising candidate who finds unconventional ways to solve difficult problems? Nice.

    Lots of WTFs here, but not in the ways the authors intended.

    Well, David passed up a startup that had 4 people in it and 2 CEOs. I'd bolt too. Greg passed up some idiot who took the brute force approach - how is that good as a consultant? We make fun of those guys in here.

  • (cs) in reply to Chris
    Chris:
    int iValue;

    ... 20,000 lines later...

    Oops, we need to handle more widgets than we expected. Make iValue a 'long'.

    Now what do you do? Do you change every instance of 'iValue' to 'lValue'? How long will that take?

    [image]

  • Andrew (unregistered) in reply to Vroomfundel
    Vroomfundel:
    Top Cod3r:
    the importance of naming your variables with a prefix that tells you what type it is

    WTF? Why don't you ask why Jesus is so much cooler than Buddha?

    Easy, Buddha has more body fat.

  • (cs) in reply to Top Cod3r
    Top Cod3r:
    I like to start off with simple questions like the proper use of On Error Resume Next, and the importance of naming your variables with a prefix that tells you what type it is. Then I move on to more complex questions about theory, such as choosing between different application designs, 2-tier, 3-tier, 4-tier and 5-tier (with and without a facade). I then ask them other theory questions, such as "Name 3 disadvantages of the MVC design pattern".

    The last couple years, we have had problems with new developers questioning the code and methodology we use, so I decided to add some real-life questions with some actual code examples from our apps to make sure that they are willing to learn from my code and not think that they know it all.

    It doesn't sound like you're identifying the best developers. It sounds like you're asking some subjective questions and then assessing whether the candidate feels the same way about them as you.

    These questions are valuable to you - obviously you have a very specific way of doing things that you consider architecturally correct. You clearly don't want to work with people who don't agree with you on these topics.

    But don't kid yourself - you're not finding the best developers. You're finding people who agree with you.

    Incidentally, I don't think we would agree. My responses would be:

    1. On Error Resume Next should be avoided because it hides failures. Individual errors can be specifically squelched using "catch" blocks, although even that technique should be used with caution and justified with a comment. In release builds, I do tend to use something like On Error Resume Next (although I don't use VB) in order to squelch exceptions that do make it to production. Typically, I just catch, maybe log, and squelch these at the outermost level possible. All of this is based on the value of the DEBUG preprocessor macro, which allows me to apply error squelching appropriately.

    2. Hungarian notation is a dying and discredited technique that attempted to make C++ more usable for Windows programming. Even Microsoft has abandoned it recently. In more modern languages, this notation really just clutters the code and serves to make me reach for the Shift key too often.

    3. The 2-tier architecture arises from the need to put data on a distinct machine (or machines) from the UI. The 3-tier architecture arises from a desire for better maintainability: stakeholders want a way to change GUIs without throwing away what's perceived to be a whole bunch of non-GUI logic. In my experience, 2-tier is often essential; 3-tier is sometimes justified, particularly if different, identifiable presentation tiers exist. Presumably 4+ tiers would exist to make an app more robust with respect to future changes. I don't generally advocate 4+ tiers because there's a point of diminishing returns to all this. For example, if inputs are validated at every tier, then 4+ tiers can really result in a lot of redundant code.

    4. I don't remember exactly what the facade pattern is, and I'm not going to close my eyes and try and remember so that I can parrot it back to you. When I study design patterns, I do so to perhaps see people using the OO features of a language in ways I didn't anticipate. I think it's infantile to file these patterns mentally and then walk around looking for opportunities to use them. And when I'm discussing OO design, I want to speak at a lower level (class hierarchy, declarations, etc.) than the vocabulary of patterns allows.

    5. MVC has the same drawbacks as any tiered approach. The most obvious examples for me are extra validation and poor designer support (because abstraction confuses things like VS.NET's "Go to Definition")

    So I guess you wouldn't hire me. But I don't think this make s me a bad developer. Where I am working now, we had a test that asked very specific questions about things like closures, the ASP.NET page lifecycle, and so on, where's there's no room for subjectivity. And I am the all-time leading scorer on that.

    If people are questioning your methodology, there may be a damn good reason!

    Addendum (2008-08-26 13:55): EDIT: On number 5, I would add that many things are by nature "MVC"... ASP.NET is an example. These native implementations don't really suffer from the problems I raised... I am speaking of people who try to "roll their own" MVC implementations using high-level code in an existing tool

  • Franz Kafka (unregistered) in reply to Chris
    Chris:
    int iValue;

    ... 20,000 lines later...

    Oops, we need to handle more widgets than we expected. Make iValue a 'long'.

    Now what do you do? Do you change every instance of 'iValue' to 'lValue'? How long will that take? Remember to include time for testing, documentation, etc. This may not even be possible, e.g., if this is in a published libraries used by others.

    This takes about 10 seconds to change in any decent IDE (refactoring code), and you hopefully have decent unit tests already. If this is a published interface, then you're sort of screwed, but you can refactor up to the API wall, then publish updated interfaces that take a long (and do a better job next time). This works okay depending on how widely your interface is distributed. HN isn't really the problem in here anyway - it's a nuisance, but it doesn't break things. Real HN, where it describes what the variable means, doesn't have this problem.

  • J B (unregistered)

    Seriously, you have an out of the box thinker. Someone with potential, they hack away a bit - and you pass him up. You're an id10t.

    Seriously wtf.

  • the real wtf (unregistered) in reply to zoips
    zoips:
    Sam B:
    But quote honestly, who cares, right?

    You should care. If you don't feed and appreciate good trolls, they go away and all you get are shitty trolls that are unbearable and annoying instead of amusing.

    I have to concur, top cod3r's posts were pretty good. I almost bit.

  • Franz Kafka (unregistered) in reply to beau29
    beau29:
    1) On Error Resume Next should be avoided because it hides failures. Individual errors can be specifically squelched using "catch" blocks, although even that technique should be used with caution and justified with a comment. In release builds, I do tend to use something like On Error Resume Next (although I don't use VB) in order to squelch exceptions that do make it to production. Typically, I just catch, maybe log, and squelch these at the outermost level possible. All of this is based on the value of the DEBUG preprocessor macro, which allows me to apply error squelching appropriately.

    I can think of one situation where ORNE is a good idea - if you're processing a large amount of records and some small portion are assumed to be anomalous, structure your code to not persist anything if there are errors and run the records through your ORNE loop, then examine the leftovers in more detail. Especially handy when accepting user input that can be messed up if you don't want to just toss the bad data.

  • stone (unregistered) in reply to Top Cod3r
    The last couple years, we have had problems with new developers questioning the code and methodology we use, so I decided to add some real-life questions with some actual code examples from our apps to make sure that they are willing to learn from my code and not think that they know it all.
    Yeah because you do.
  • (cs) in reply to Expatriot
    Expatriot:
    Sam B:
    Well, this being the Internet, where it's already difficult to detect satire or sarcasm, one must make an "extra effort", as it were, to ensure that people get your point.

    But notice I said "so veiled as to be undetectable". There's a difference between "difficult to detect" and "virtually undetectable". There was no indication that what "Top Cod3r" said was sarcastic or satiric. None whatsoever.

    Well, it tripped my satire detector in the second sentence, and it was pretty unambiguous by the end. You don't need to hang around here long to pick up that "On Error Resume Next" and excessively enterprisey application architectures are running jokes.

    Yay! I win at Internet!

    My God, if TopCod3r is a troll, he/she/it sure knows how to push my buttons.

  • Global Warmer (unregistered) in reply to shepd
    shepd:
    Two WTFs, that aren't? Say it isn't so!

    WTF #1: Obviously, the WTF is the person complaining that 1 isn't prime when, just like the interviewer said, it's a "maybe".

    WTF #2: If the guy did the test that many times, you might not employ him (up to you, I'd have him in for an interview myself, I like people who think outside the box), but perhaps you should congratulate him for being smart enough to figure out how to ace the test, and for pointing out a flaw in your scoring system (the flaw being that you return results while the exam is still available). Deriding him for taking it 140 times is deriding yourself 139 times, IMHO.

    I know when I was in College, if I had figured out to do something like this to pass a test in a programming class, I'd have a 50/50 shot of either impressing the hell out of the teacher, or getting in some (minor) trouble and having to take a new (fixed) exam.

    I completely agree. I would add to your second WTF, as someone else pointed out that the author has no way to be sure it was actually this person taking the test 140 times.

  • (cs) in reply to Top Cod3r
    Top Cod3r:
    the importance of naming your variables with a prefix that tells you what type it is.

    You need to get yourself a more loosely-typed language, son. And declench in any case.

  • Jesus (unregistered) in reply to Vroomfundel
    Vroomfundel:
    Top Cod3r:
    the importance of naming your variables with a prefix that tells you what type it is

    WTF? Why don't you ask why Jesus is so much cooler than Buddha?

    Oh, I think we already know the answer to that one.

  • Buddha (unregistered) in reply to Jesus
    Jesus:
    Vroomfundel:
    Top Cod3r:
    the importance of naming your variables with a prefix that tells you what type it is

    WTF? Why don't you ask why Jesus is so much cooler than Buddha?

    Oh, I think we already know the answer to that one.
    FUCK YOU JESUS!!

  • (cs) in reply to A Wizard a True Star
    A Wizard a True Star:
    So, in which languages do you think Hungarian Notation would actually be useful?
    Hungarian, presumably.
  • Andy L. (unregistered) in reply to gabba
    gabba:
    And Greg passed up an enterprising candidate who finds unconventional ways to solve difficult problems? Nice.

    The candidate proved two things :

    1. He can deploy unconventional ways to solve difficult problems.
    2. He does not have the experience level Greg was looking for.

    I don't see why not hiring him is a WTF.

    (He also proved that he didn't think through his actions well enough to anticipate that Greg would check the logs.)

  • Franz Kafka (unregistered) in reply to wee
    wee:
    Top Cod3r:
    the importance of naming your variables with a prefix that tells you what type it is.

    You need to get yourself a more loosely-typed language, son. And declench in any case.

    loosely typed languages need real HN even more - how are you supposed to know what variable x is supposed to be unless you tag it with something like name or amount?

  • John Locke (unregistered) in reply to zip
    zip:
    Top Cod3r:
    I like to start off with simple questions like the proper use of On Error Resume Next, and the importance of naming your variables with a prefix that tells you what type it is.

    This might be the best troll I've ever seen here.

    Dude, you let the cat out.

  • (cs)

    Hey guys, sorry but someone has been "stealing" my name and impersonating me on this thread, so I just registered it, so it won't happen again hopefully. I didn't post any of the offensive stuff before.

    But I am passionate about sharing my best practices with junior developers, so they can aspire to achieve MCAD certification someday!

  • (cs) in reply to Buddha
    Buddha:
    FUCK YOU JESUS!!
    Take three slow, deep breaths, and say, "Ommmmmm...."
  • (cs) in reply to Franz Kafka
    Franz Kafka:
    loosely typed languages need real HN even more - how are you supposed to know what variable x is supposed to be unless you tag it with something like name or amount?

    Ummm... you're a very serious person, aren't you?

  • (cs) in reply to A Wizard a True Star
    A Wizard a True Star:
    So, in which languages do you think Hungarian Notation would actually be useful?
    pI advActually vLove adjHungarian nNotation advSo adjMuch, pI vUse pIt advAll artThe nTime! pIt advSure vMakes nEnglish adjEasier prepTo vUnderstand. vImagine cIf pYou vHad prepTo vRead pThis prepWithout pIt. pYou vWould vHave adjNo nClue advWhat pThese nWords vMeant prepWithout pTheir nParts prepOf nSpeech!
  • Marvin the Martian (unregistered) in reply to Vroomfundel
    Vroomfundel:
    John:
    For those that think their knowledge of maths is excellent (myself included), have a look at this: http://xkcd.com/179/
    Man, if you have to go to quickmath to verify this, then I seem to have a serious gap in my command of English
    On the plus side, XKCD has gone light the last few months, and only posts throwaway /b/ meme jokes. This kind of embarassment is now officially archaic!

    I don't know what this kind of calculus has to do with the given simple programming exercise --- but if you get a symbolic calculus programming task during an interview, hm, that's a toughie. The obvious task is to check with the supervisor (in this case, the acting-CEO annex king&tyrant annex president-for-life) on a standard [1 prime or not]: both for interviewer AND interviewee it is important --- if the applicant says "screw this I define my own reality" you have a problem, if the supervisor cannot see the ambiguity and resolve it straightforwardly (or temporarily until standards are revised) then the whole shop is doomed.

    Knowing maths in and out doesn't imply being a historian of number theory so the explanation that the supervisor may have been far smarter than he seemed does not hold much water here, it doesn't really change anything in the interaction.

  • Mark (unregistered)

    Man, I though 1 was prime as well. I'm glad I'm not alone!

  • (cs) in reply to El Duderino
    El Duderino:
    A Wizard a True Star:
    So, in which languages do you think Hungarian Notation would actually be useful?
    pI advActually vLove adjHungarian nNotation advSo adjMuch, pI vUse pIt advAll artThe nTime! pIt advSure vMakes nEnglish adjEasier prepTo vUnderstand. vImagine cIf pYou vHad prepTo vRead pThis prepWithout pIt. pYou vWould vHave adjNo nClue advWhat pThese nWords vMeant prepWithout pTheir nParts prepOf nSpeech!
    Freaking awesome!
  • JohnFx (unregistered) in reply to panzi

    [quote user="panzi"][quote user="Top Cod3r"]On Error Resume Next[/quote]

    One of the "greatest" features of Visual Basic. "Just ignore all errors." shudder

    Don't be so hasty. I hate to defend the often atrocious use of the OERN construct to "ignore all errors", it is merely an alternative to allow in-line error handling instead of a makeshift catch block using "ON ERROR GOTO". Sometimes turning on OERN and then checking the error object is a much more concise and readable way to write an error handler, at least it was until VB.NET FINALLY introduced the try...catch...finally syntax.

  • Ville (unregistered)

    It's interesting to see how many here thinks ORNE is only suitable for hiding errors.

    The only times I've used ORNE are basically something like the following

    On Error Resume Next Open FileToRead for Input as #FileId If Err Then ReturnValue = FAILED_FILE_INACCESSIBLE Exit Sub End If On Error Goto 0

  • Ville (unregistered) in reply to Ville

    Sorry, I meant OERN, not ORNE

  • WC (unregistered)

    The problem I see wasn't that he didn't know 1 wasn't prime. The problem was that he wasn't interested in the truth, he was only interested in winning the argument. Have you ever tried to work with someone like that? Imagine trying to work -for- them. Every single day would be an up-hill battle just to complete tasks as the boss argues that no matter what he wrote, that wasn't what was wanted. And you should have known that, somehow.

    I wouldn't want to work for them, either, no matter how 'promising' they are.

  • panzi (unregistered) in reply to Eam
    Eam:
    panzi:
    I'm curious, what are disadvantages of the MVC design pattern? I can't think of any. It's not overly complex, it does not add a lot of overhead... what are the disadvantages?

    It's a bit concerning that no one can think of any disadvantages to MVC. Don't get me wrong, I use MVC often, but it's not always appropriate.

    It may not add much complexity, but it adds enough that it should not be used for small projects. Also, it pretty much always requires some duplication of business logic across the tiers (the alternative being lots of added complexity).

    The trick to applying MVC is evaluating the current and potential future scale of your project, then balancing logic duplication with complexity.

    Yes, for very small projects it does not make much sense. I didn't understand the question that way. I immediately thought about a project where one would choose that pattern. And then there are no downsides. g

  • Franz Kafka (unregistered) in reply to wee
    wee:
    Franz Kafka:
    loosely typed languages need real HN even more - how are you supposed to know what variable x is supposed to be unless you tag it with something like name or amount?

    Ummm... you're a very serious person, aren't you?

    A philosopher, some would say.

  • (cs) in reply to Franz Kafka
    I can think of one situation where ORNE is a good idea
    On Resume, Next Error?? Wow. That's some pretty good material for all the VB/ASP/VBScript haters out there.

Leave a comment on “It Depends & Too Good To Be True”

Log In or post as a guest

Replying to comment #:

« Return to Article