Salaries



  • @Oscar L said:

    Next in the sample questions, you posed the phone number formatting question.  I would have chosen regex's because I just recently figured out I could replace a recursive descent parser"

    Yup, nothing wrong with the regex solution.  This is a way of doing it without a regex:

    <FONT size=2>

    </FONT><FONT face="Courier New" color=#0000ff size=2>

            static string StripPhoneNumber(string str)
            {
                string ignoreList = " ()[]{}+-";
                StringBuilder sb = new StringBuilder();  
    
            // iterate through each char, keep numbers, ignore stuff on the
            // ignore list; return null if a bad char crops up
            foreach (char c in str)
            {
                if (char.IsDigit(c))  
                    sb.Append(c);
                else if (ignoreList.IndexOf(c) == -1)  
                    return null;   
            }
    
            // collect the results and check against the length
            // throw out any leading '1'
    
            string result = sb.ToString();
    
            if (result.Length &lt; 10) // not enough numbers
                return null;
            if ((result.Length == 10) &amp;&amp; (result[0] != '1'))
                return result;
            else if ((result.Length == 11) &amp;&amp; (result[0] == '1'))
                return result.Substring(1);
            else
                return null;  // too many numbers
        }
    

    </FONT><FONT face="Courier New" size=2></FONT>
    <FONT face="Times New Roman" color=#000000>And you can see in the results that you get the desired results...plus some unexpected ones thrown in.  Oh well, I never said it had to match ONLY those formats :)</FONT>
     
    <FONT face="Courier New"><FONT color=#0000ff size=2>425 555 1212 -> 4255551212 = PASSED
    425-555-1212 -> 4255551212 = PASSED
    (425) 555-1212 -> 4255551212 = PASSED
    +1 425 555-1212 -> 4255551212 = PASSED
    +1+4+2+5+5+5+5+1+2+1+2 -> 4255551212 = PASSED
    [[[]]][][]][[][4[25---555-[1[2][1][2] -> 4255551212 = PASSED
    425bbb1212 -> (null) = FAILED
    4425 555 1212 -> (null) = FAILED
    25 555 1212 -> (null) = FAILED</FONT>

    <FONT size=2></FONT>

    </FONT>


  • I think I would have done it similar to CW, even if it's "lowtech" compared to regexes. It's simpler, probably faster and easier to check for correctness.
    Anyway, I wonder what you guys do with international customers which have a much longer phone number. ;-)


  • ♿ (Parody)

    I avoid regexes as much as possible in long-term solutions. Although I can build and understand them fairly well (6 or 7 out of 10 maybe), I've found that most developers are frightened of them and have a very difficult time maintaining them.



  • @Alex Papadimoulis said:

    I avoid regexes as much as possible in long-term solutions. Although I can build and understand them fairly well (6 or 7 out of 10 maybe), I've found that most developers are frightened of them and have a very difficult time maintaining them.



    Is there any way to put comments in regexes? For example, a function checking the syntax of an email adress might contain comments like
    /* check the name part /
    /
    check the existence of exactly one @ /
    /
    check the domain /
    /
    check the TLD /

    The corresponding regex might look like that:
     "^[a-zA-Z][\w.-]
    [a-zA-Z0-9]@[a-zA-Z0-9][\w.-][a-zA-Z0-9].[a-zA-Z][a-zA-Z.][a-zA-Z]$"

    (just googled for it, no idea if it works or not; I've seen even longer regexes for that job)

    Would you want a junior programmer to implement the rule "domain cannot be all digits" into that regex?



  • @ammoQ said:

    @Alex Papadimoulis said:

    I avoid regexes as much as possible in long-term solutions. Although I can build and understand them fairly well (6 or 7 out of 10 maybe), I've found that most developers are frightened of them and have a very difficult time maintaining them.



    Is there any way to put comments in regexes? For example, a function checking the syntax of an email adress might contain comments like
    /* check the name part /
    /
    check the existence of exactly one @ /
    /
    check the domain /
    /
    check the TLD /

    The corresponding regex might look like that:
     "^[a-zA-Z][\w.-]
    [a-zA-Z0-9]@[a-zA-Z0-9][\w.-][a-zA-Z0-9].[a-zA-Z][a-zA-Z.][a-zA-Z]$"

    (just googled for it, no idea if it works or not; I've seen even longer regexes for that job)

    Would you want a junior programmer to implement the rule "domain cannot be all digits" into that regex?

    In perl and some perl-style regexes, yes.  You add the /x [extended] regex qualifier, and the regex engine no longer considers whitespace significant, and anything after a bare # is considered a comment.  In most PCREs, you can use (?#comment) or the option PCRE_EXTENDED. Yes, I comment my regexes, one grouping per line.

    My earlier solution is actually assuming that I'm going to accept a lot of things that aren't really formatted phone numbers, like 1-(601]-555-5555.  For example, I'm not attempting to match that the parens/blocks match, which is a very difficult job for most regexes.  Your above solution is similar to mine, except that I'm using an even more permissive approach.  Whether or not that's acceptable is dependant on the application: if you're writing a batch-loader, it might be, but if you're writing a UI, you'd probably want more checking to avoid bad entries in the first place. 

    Checking an email by the RFC by regex is actually very, very difficult.  Dealing with nestable comments, embedded whitespace and embedded newlines, without losing any data... is difficult.  I wrote a pretty good one, once, but it relied on multiple variable-length backreferences, so it doesn't really work all that well in some implementations.

    I don't think that adding the 'domain cannot be all digits' rule into that would be exactly trivial, but it could be done.  I'd agree that it'd be best, both maintainer-wise and performance-wise, to either split the regex pieces, or to write a real parser for that, as it became more complex.



  • @ammoQ said:

    I think I would have done it similar to CW, even if it's "lowtech" compared to regexes. It's simpler, probably faster and easier to check for correctness.
    Anyway, I wonder what you guys do with international customers which have a much longer phone number. ;-)


    Not necessarily a longer phone number, but different rules apply.  Once you start getting into National Numbering Plans, it all gets very scary very fast.  Regexes still work, but you have to have (potentially a bunch of) regexes per country.  Or some sort of generalised scanning engine at which point you're effectively reinventing regexes anyway...

    Yeah, I deal with this sort of stuff on a day-to-day basis.  Not only do I have to deal with phone numbers from most of the countries in the world, I also have to know if they are mobiles, premium rate, etc.  The US in particular is a pain for this (read: it's not possible to derive all that from the US NNP, although that's what NNPs are supposed to tell you).

    Simon



  • Just as an update, I had an interview candidate in just a few hours ago.  Relatively young, maybe 5 years of 'professional' experience, he answered the StringBuilder question just fine; jumped right to the linked list solution and then even wrote his own little linked list (rather than just using List<>) on the board.  Took him maybe 10 minutes to work through the problem and then we were on to talking about web stuff.

    I didn't ask him about polymorphism.

    We're making him an offer today.

    -cw



  • @CodeWhisperer said:

    the linked list solution and then even wrote his own little linked list (rather than just using List<>) on

    How would it have affected your assessment(or did it not matter) if he used List<>?



  • @Oscar L said:

    How would it have affected your assessment(or did it not matter) if he used List<>?

    Only marginally.  It was nice to see that he knew how to do it and understood some of the issues with working with them, but before he wrote any code he had said enough that I could tell that.  If he had used List<>, I'd have known that he understood what was going on underneath. 

    But, really, the tipper came later when I was asking him some ASP.NET stuff: the difference between Server.Transfer and Response.Redirect.  Generally that's just a toss-out to see if the person has even seen the functions; in this case he had and had used them, but didn't really know the difference. He did know that Server.Transfer screwed up the browser's URL sometimes...but didn't know why, I asked him to think about that for a second.  Then a little light came on over his head and he said "Oh, Server.Transfer never talks to the browser!".   Ta da. 

    Seems like a little thing, but a) he had some experience, b) he detected a pattern in it, c) he put it all together in a fairly stressful situation; and, d) he left the interview knowing something he didn't before.

    As far as I'm concerned, that's a really good sign in a relatively junior engineer.  I can't expect him to know everything, but I do expect him to be able to figure it out. :)

    -cw



  • @CodeWhisperer said:

    We're making him an offer today.

    Should he choose to accept your offer, I wish him all the best.



  • I found this today in Austria's newspaper "Kurier", it's a statistic about income in IT jobs:

    Software
    Junior Developer: 23830 EUR
    Application Developer: 40600 EUR
    Senior Application Architect: 55420 EUR
    Project Manager: 72840 EUR
    Manager Application Development: 104310 EUR

    Hardware (sic!)
    Server Administrator: 29400 EUR
    System Engineer: 44800 EUR
    Data Base(sic!) Engineer: 56970 EUR
    IT Controlling: 64410 EUR
    Manager Data Center/Infrastructure: 107207 EUR






  • @CodeWhisperer said:

    We're making him an offer today.
    Don't keep us in suspense. Did he accept the offer?

    He didn't...I bet you he didn't.

    LOL



  • Honestly not sure; two different guys started last week, another two start on Tuesday.   Even if that specific fellow didn't, I apparently don't scare too many of them off.

    -cw

     



  • @CodeWhisperer said:

    two different guys started last week, another two start on Tuesday.

    For a "$100M/year company" you guys sure hire a lot. How can the company afford that? Or is there high employee turnover perhaps?



  • You're awfully eager for something to be wrong.  

    I don't think we're hiring all that much compared to the area, nor is the turnover much different.  There are thousands of devs/engineers in the area, and there are still more jobs than devs to fill them -- and now Microsoft has said that they intend to hire something like 5,000 people in the next couple years.  And when MS grows, everyone around them tends to grow as well, so it's just going to get worse/better. All those people come from/go to somewhere else all the time, and for different reasons.  I think you'd find the dynamic quite a bit different than what you're used to. 

    In our case, we're ramping up so can run two pretty big new development efforts and put more people on a couple specific problem areas.   So, yeah we do hire a lot, some are permanent employees, but a fair number are contractors -- mostly because we can't get enough good guys to hire full-time. 

    Ironically, the permanent employees cost less than the contractors.  We pay $100/hour for most of the contractors.  All day, every day.  That's, what, $16K/month x 12 months = $192K/year.  Contracting company gets a big percentage of that, but yeah, it costs a bundle.

    -cw



  • I feel like jumping in here with another perspective because right now it looks like CodeWhisperer beating up on CPound...

    CPound,
    It looks like you are using the wrong yardstick to evaluate good code.  You seem to think that if it functions then it is as good as it could get.  That's like a custom car painter being happy if the paint sticks to the car.

    The absolute lowest level of acceptability of code is that it performs its intended function.  Next, it must be maintainable and then extensible.  Good programmers write maintainable code without even thinking about it.  They wouldn't dream of copy and pasting the same chunk of code 9 times -- not because they were taught that loops/functions/classes/whatever were "good" in school, but because they know that some day the requirements will change or a bug will be discovered and they'll never find the other eight.

    Good programmers also write methods that are "reusability friendly".  Meaning that they can be used in many situations without doing a whole lot of research as to whether the method will cause unexpected issues.  We do have fancy words for this stuff, like idempotent.  But, we don't use the words to scare away 23 year olds that didn't get a CS degree.  We name things that are important, these things aren't important to the rest of the world, so the names seem odd to most and it looks like we are trying to build some type of clique.  This is not ivory tower stuff, but real issues that are important even in 1000 line apps.  All of us have libraries of code that we use in many projects and we know from experience that methods with side effects cause us to have to work late at the least convenient times.

    We also know the common pitfalls of modern languages and the available solutions.  The interview question about String building was designed to see if the candidate was familiar with the perils of String concatenation and the available solutions and their tradeoffs.  That is very important stuff for writing reusable code.  You might write a library in a small app today and reuse it in a large app tomorrow.  If the library builds strings (maybe javascript generator), it should be second nature to choose the correct String building technique.  Making the wrong choice will lead to horribly slow code very quickly.  Sometimes questions like this could be considered "trick questions", for example; the .Net GetPixel() method of the BitMap class is horribly slow.  However, expecting that someone knows this at an interview would be a trivia question.  Expecting that they know that String concatenation is slow is not trivia.  It is far more common and is a result of the way that most modern languages handle Strings.

    As an example, I recently picked up some C# code that was written to wrap some common TWAIN API calls.  Well, the code did perform its intended function, but it was still amateur code.  Whenever the API returned an error code, the library hosed up the message pump of the form, locking it up (BTW, the asynchronous parts of TWAIN use the message pump to signal state changes -- yipee!!!).  This was very annoying and not all that fun to debug.  A few hours of coding later and it still worked just like it did before from a functional perspective.  However, now I could drop it into an app without expecting clients calling me back saying "there was no error message, it just locked up".

    Also, if you've never heard of polymorphism, then it means that you haven't spent a whole lot of time thinking about how interfaces could help to build extensible apps.  I've seen code written by guys like you.  After five or six years of maintenance, there are 100 if tests that check for a configuration option and implement a different chunk of code.  A good programmer would immediately see the advantage of interfaces and probably run-time loadable implementations (or plugins as people like to call them).  Not knowing the word doesn't mean that a person doesn't know about these things, but it would be very hard to read and talk about interfaces and plugins without bumping into the word polymorphism a few hundred times.  Someone who knows the word polymorphism is more likely to do extensibility right than someone who doesn't.  Also, at an interview, the interviewer would go a step further and not just find out if the candidate knew the word polymorphism, but also if he knew how to use it and where it is applicable.  I want to tell my higher end programmers "change that config switch to a plugin" and have them know what I'm talking about and go do it.

    Finally, I don't have a degree in CS.  I still managed to learn all the big words and find value in them.  A read a lot, not just API references, but about design patterns and architecture.  I try new stuff, and sometimes make a bigger mess than I started with.  I also make the type of salary mentioned earlier in the thread in a small US market as a full-time employee with benefits.  I feel that I'm far cheaper than two programmers at half my salary.



  • @CPound said:

    CW, please don't take offense by this, but so far this is the image I have of you based on what you have said so far. Let me know how accurate I am.

    I picture you as this fuddy-duddy analyst who proabably programmed in the early C/COBOL days. You are more than likely academic-minded versus business-minded. You miss the university days with a passion. At your present job, you typically pontificate and dispense high knowledge to the unlearned masses beneath you. You require daily confirmation and affirmation of your oh-so-knowledgeable status. Interviewing gives you this god-like power over others which you actually enjoy, because it's a constant I'm right-you're wrong scenario. That's more affirmation of your supreme intellect. One of your favorite television shows is The Weakest Link, for obvious reasons.

    Pretty accurate, huh?

    Feel free to do an assesment of me. I'll let you know how close you are.

    That's funny.

     

    The image I have of CW is that CW gives the kind of interviews I'd like to have ($100K is more than the $70K I'm on right now...) because they suggest to me that he's not looking for someone who can reel out buzzwords but can actually solve problems.

    And the image that I have of you is that you're the kind of idiot that we're seeing when trying to fill a couple of programming positions ourselves.  No aptitude at problem-solving whatsoever.  You don't have enough introspection to actually determine what you're not very good at, and without that you can never get any better.  You're shockingly dismissive of those who value such skills as "design" and "thinking".

     



  • @CPound said:

    @ammoQ said:
    I pay close to 800 EUR per month.

    That's like $1,000USD!

    I'm not even going to tell you guys where I work/live, because you may try to flock here and take our jobs. But $800+ for an apartment? $3+ for gas? Holy cow, that's ridiculous.

    Try $200-$300 for a decent apartment and a little over $2 for gas.

    You guys are getting ripped off.

    I don't think I'd want to live somewhere that a decent apartment was $300/month, because it's clearly not a very desirable place to live; certainly not in a major metropolitan area.

     



  • Isn't anybody going to come to my defense?



  • @CPound said:

    Isn't anybody going to come to my defense?

    Considering the way you've handled and presented yourself in this thread, probably not.



  • @CPound said:

    Isn't anybody going to come to my defense?

    It's not bloody likely, is it?

     



  • @CPound said:

    Isn't anybody going to come to my defense?

    Those who are stupid enough to share your view are at least clever enough to keep silent.



  • @Sgt. Zim said:

    Considering the way you've handled and presented yourself in this thread, probably not.
    Listen, I'm trying to establish a Cpound camp to combat the ever-growing CW camp. CW represents everything I stand against. I'm sure some of you disagree with his viewpoints too, but are too intimidated to admit it in the forum. I'm not ashamed to say I disagree with CW! Will someone join my crusade?



  • @CPound said:

    @Sgt. Zim said:
    Considering the way you've handled and presented yourself in this thread, probably not.
    Listen, I'm trying to establish a Cpound camp to combat the ever-growing CW camp. CW represents everything I stand against. I'm sure some of you disagree with his viewpoints too, but are too intimidated to admit it in the forum. I'm not ashamed to say I disagree with CW! Will someone join my crusade?

    The CW camp is called "software developers" and the CPound camp is called "cowboy coders". The TDWTF forum is (by its very nature) dominated by the first group of people. We (the software developers) do not always agree on the best way to make good software, but at least we agree that making good software is desirable. That's the big difference to people like you who do not care about quality. To find people of your kind, ask Google for "script kiddy".  (edited)



  • @CPound said:

    @Sgt. Zim said:
    Considering the way you've handled and presented yourself in this thread, probably not.
    Listen, I'm trying to establish a Cpound camp to combat the ever-growing CW camp. CW represents everything I stand against. I'm sure some of you disagree with his viewpoints too, but are too intimidated to admit it in the forum. I'm not ashamed to say I disagree with CW! Will someone join my crusade?


    Count me in the CW camp.

    sincerely,
    Richard Nixon



  • @CPound said:

    Listen, I'm trying to establish a Cpound camp to combat the ever-growing CW camp. CW represents everything I stand against.

    CW represents competence.

     

     



  • @CPound said:

    @Sgt. Zim said:
    Considering the way you've handled and presented yourself in this thread, probably not.
    Listen, I'm trying to establish a Cpound camp to combat the ever-growing CW camp. CW represents everything I stand against. I'm sure some of you disagree with his viewpoints too, but are too intimidated to admit it in the forum. I'm not ashamed to say I disagree with CW! Will someone join my crusade?

    While following this thread, I've avoided adding my comments, because they'd pretty much be "Me Too!" and I hate that shite.

    As a fairly klutzy anti-cowboy that more or less makes his living dealing with other people's WTFs, I must firmly put myself in the CW camp.  I've been doing this professionally for 17 years, right out of high school.  (I'm one you likely consider "ancient" at 35).  I haven't finished my CS degree yet, and there are times when I question the intelligence of those that designed the curriculum that I am currently going through.  (I've been "too busy working," but my career is stalled until I have that sheepskin to back up my experience, so I must get my degree.  YMWV).  That said, I firmly believe that all knowledge is useful, and as screwed up as some of my classes have been, I do still learn things.

    College is not necessarily about learning whatever it is that you're majoring in.  It's about showing prospective employers that you have the sack to see a project to completion, no matter how inane it may be.  It's about your ability to [b]learn[/b], whether what you are learning is [b]how to decide on[/b] the best way to physically lay out your DBMS on the filesystem, what the underlying issues behind World War II were, or how to take the lessons of sociology from "classic" films (one of the strangest classes I've ever taken, and the instructor was a fscking loon, but that's another issue).  A college degree isn't a magic bullet, and it's not proof of superiority.  Like many others have mentioned, I too have an experience where the worst coder I know was the college-educated one.  What matters is your ability to solve problems intelligently, not take the shotgun approach, and hope that one of the 100 "fixes" you throw at the problem happens to actually "make it work."

    You've said on more than one occasion that "all that matters is that it works," and that twenty-somethings should just jump right into $100k jobs.  Bullshit.  If I want to get a steaming pile of ordure that's going to cause me migraines maintaining for the next 20 years, I can get it for a hell of a lot cheaper than by hiring you for $100k.  You're not worth it.  Given the choice between "doing it right" and "making it work," I will always choose doing it right.  I don't recall who said it, but "it's usually cheaper to do it right the first time."

    On top of that, between comments you've made in this thread, and your "Huh?" thread, I've decided that you're full of shit, and likely a troll.  The two stories don't jibe.  That's another strike.

    You probably have the potential to be a decent human being.  You need to learn that you don't know it all, that you are not automatically superior to everyone else, and that if you're truly making as much as you claim to make, and in the position that you claim to hold, that you've been damn lucky.  It's going to catch up with you eventually.  Save youreslf and the rest of us some pain and grow up.

    I do kind of wish that I knew where you are located.  I'd avoid that area, because, unlike CW, I'm tired of cleaning up other people's messes.  I'm also intrigued by your claim of $300 rent and $100k jobs.  I'd suggest you read up on economics.  It'll make you a better liar.

    [i]Disclaimer[/i]:  This post is only intended to offend one person on this planet.  If you happen to be offended ... Oh well, that's not my problem.  Come over to my house and I'll bash you with my Clue Stick™.



  • @CPound said:

    Listen, I'm trying to establish a Cpound camp to combat the ever-growing CW camp. CW represents everything I stand against.

    I have a 'camp'?  Cool!

    If you want to win people to your side, you need to explain to them what it is exactly you believe, other than "CW is wrong".

    -cw



  • @CodeWhisperer said:

    If you want to win people to your side, you need to explain to them what it is exactly you believe, other than "CW is wrong".
    It's not that you're "wrong" CW. It's just that you're not "right" all the time. That's what is so hard to get through to you "manager types". You think you've achieved programming godhood and you've attained all software development knowledge. There's no room for innovation or growth with you people. It's either "your way" or else. For example, your trick question (yes, it was a trick)...if the candidate answers one way, he's wrong. If he answers the other way, he's wrong. There's actually a hidden answer which is your answer to the question. That answer is right. And of course you score the candidate based on that. The only thing is, the candidate will never get it right. It's a failure setup to begin with. You know exactly what I'm referring to, so don't even act like you don't know what I'm talking about! I've seen it a zillion times with you "manager types". It's like this ego thing or something. It's really quite disgusting. So, that in essence is what I'm standing against. Who's with me?



  • @CPound said:

    There's actually a hidden answer which is your answer to the question.

    Are we reading the same thread?  In one case a bunch of us discussed a few different ways to solve the string builder problem, and there were at least two solutions to the phone number validation problem.   I spent a fair amount of time talking about how it was more important to see the thought processes unfold in the context of solving a problem.  

    My (and apparently your) definition of a trick question is exactly the sort of question for which there is only one right answer and relies on you making the exact mental leap required, but the problems we discussed had more than one right answer, more than one approach -- ergo, they weren't trick question.   Here's a much trickier question from a microsoft interview -- my own interview, in fact:

    "Imagine you have to move 4 people across a bridge at night, but you only have one lantern, and only one or two people can cross the bridge at a time and the lantern has to be with whoever crosses the bridge.  Person A can cross the bridge in 1 minute, Person B takes 2 minutes, Person C takes 5 minutes, and Person D takes a whopping 10 minutes.   If two people cross the bridge, they move at the speed of the slowest person.   What is the minimum time to get all 4 people from one side of the bridge to the other?"  

    It's not too hard to get down to 18 or 19 minutes, but there's a solution for 17 -- and they stared at the back of my head while I tried to work my way down for about a quarter hour.   There's ways to systematically work the answer, but talk about a contrived problem! 

    @CPound said:

    It's a failure setup to begin with.

    Then how come so many people successfully complete the process?  I get candidates all the time who answer both questions and blow right on to through to the more interesting stuff.   

    In fact, since I started doing the interviews this way, the quality of our dev staff has gone up, the quality of the code has gone up, and we're tackling more difficult problems more easily.  For something that is set up to be a failure, it seems to work awfully well.

    @CPound said:

    So, that in essence is what I'm standing against.

    I'd say "nice straw man you've got there", except it isn't.  

    According to you, I don't innovate; which, a) you have no evidence for or against; and b) will come as a big shock to the people I work with -- they seem to think all that academic stuff comes in handy in filling out patent applications.

    The only thing you really seem to be against is people who might know more than you, and that's just unfortunate.  I spend a lot of time talking with, and learning from, other developers and architects.  I like meeting people I can learn from -- I even go and read up on things that people seem to think are important, even if I disagree, just to make sure I'm not missing something.  Oh that ego of mine.  

    -cw



  • Since everyone seemed to like the interview questions section that punctuated the tirades, here's one from a "programming challenge" that one company uses to screen applicants:

    Design and implement a class or set of functions to work with the following encoding of a fixed-point number. We often work with client hardware that uses proprietary or unusual protocols or data formats.

    In this instance, a fixed-point number is packed into a 32-bit unsigned integer as follows:

    s i i i i i i i   i i i i i i i i   i f f f f f f f   f f f f f f f f
    

    where:

    <FONT style="BACKGROUND-COLOR: #eeeeee">s</FONT> : sign bit (1 == negative)

    <FONT style="BACKGROUND-COLOR: #eeeeee">i</FONT> : 16 integer bits

    <FONT style="BACKGROUND-COLOR: #eeeeee">f</FONT> : 15 fraction bits

    Examples:

    <COLGROUP> <COL width="20%"> <COL width="80%"></COLGROUP>
    Value Fixed Point encoding
    1.0 <FONT style="BACKGROUND-COLOR: #eeeeee">0x00008000</FONT>
    -1.0 <FONT style="BACKGROUND-COLOR: #eeeeee">0x80008000</FONT>
    2.0 <FONT style="BACKGROUND-COLOR: #eeeeee">0x00010000</FONT>
    -2.5 <FONT style="BACKGROUND-COLOR: #eeeeee">0x80014000</FONT>

    Your class should support at least the following operations:

    • Create Fixed Point object from floating point value
    • Create Fixed Point object from packed 32-bit value
    • Idiomatic conversion to string (as <<optional sign>><<integer part>>.<<fractional part>>)
    • Convert value to closest floating point equivalent

    -cw



  • @CPound said:

    For example, your trick question (yes, it was a trick)...if the candidate answers one way, he's wrong. If he answers the other way, he's wrong. There's actually a hidden answer which is your answer to the question. That answer is right.

    Considering that I live thousands of miles away from CW and have a completely different educational and technological background (Java/Oracle vs. MS technologies), how was it possible for me to answer this "trick question" correctly?

    One possible solution - mine - has good characteristics in terms of memory usage and performance. I'm pretty confident CW would accept all other possible solutions with the same (or even better) characteristics. Memory usage and performance are properties that really matters for such a basic class like StringBuilder, which is uses very often in most programs. For that reason, you should not expect CW - or any other reasonable manager - to accept solutions which are by far inferior, just because they kind-of work.



  • Ok CW, you win this round. But I just need to know something. Does anyone else reading this thread even remotely sympathize with my cause? Even a little bit?



  • @CPound said:

    Ok CW, you win this round. But I just need to know something. Does anyone else reading this thread even remotely sympathize with my cause? Even a little bit?

    I think you've missed the point -- a lot of people do sympathize with you, or at least the mindset, because we've been there.  

    A number of folks, myself included -- and let's not forget Alex :) -- have all piped up and shaken their heads in embarassment and said "yeah, I remember when I thought that way".   We learned what we still had to learn.   A lot of us started as self-taught, ego-driven cowboys, who then have to work toward developing the techniques and tools necessary to approach our craft at a higher level -- once we realized there was a higher level to aspire to.    And we pretty much all spoke of a moment where we were confronted by someone and called on our BS, and how we learned from it.  

    I think a lot of us sympathized with that feeling -- but we're not sympathizing with your apparent belief that you have nothing left to learn and the sense of entitlement that apparently comes with it..

    Jeff



  • @CodeWhisperer said:

    "Imagine you have to move 4 people across a bridge at night, but you only have one lantern, and only one or two people can cross the bridge at a time and the lantern has to be with whoever crosses the bridge.  Person A can cross the bridge in 1 minute, Person B takes 2 minutes, Person C takes 5 minutes, and Person D takes a whopping 10 minutes.   If two people cross the bridge, they move at the speed of the slowest person.   What is the minimum time to get all 4 people from one side of the bridge to the other?"  

    It's not too hard to get down to 18 or 19 minutes, but there's a solution for 17 -- and they stared at the back of my head while I tried to work my way down for about a quarter hour.   There's ways to systematically work the answer, but talk about a contrived problem! 


    Is the trick that the definition is missing the sentence "if two persons cross the bridge, they have to cross it in the same direction"? So I could say
    A and D from left to right. (10)
    A from right to left and C from left to right (+5).
    A and B from left to right. (+2)
    = 17 minutes

    Or is it something else? I actually got 19 without that "trick", using the most obviuos solution (A + X from left to right, A back, etc)


  • @TDC said:

    Is the trick that the definition is missing the sentence "if two persons cross the bridge, they have to cross it in the same direction"?

    Ooo, good guess, but no :)  That was an oversight on my part -- people crossing the bridge have to go in the same direction (basically, no person can cross the bridge without light, and there's only one lantern, so travel can only go in one direction at a time).



  • @CPound said:

    Ok CW, you win this round. But I just need to know something. Does anyone else reading this thread even remotely sympathize with my cause? Even a little bit?

    I've been reading this thread for a while and I would say I would fall in CW's camp.  My college degree is in Mechanical Engineering although I work primarily in IT & Busineess Process Development.  My career path has been sysadmin, programmer, web developer, data warehouse architect ending with my current position as a solutions integrator.  For each transition, I was chosen not necessarilly because I was the most skilled but rather because I had the drive and capacity to learn the skills and business knowledge needed for the role.

    Looking back at my work from a few years ago, I'd say some of it was poorly architected and hard to maintain, although they got the job done and performed well.  Reflecting on those projects, I've endeavored to learn best practices so I can avoid my previous mistakes.  I strive expand my knowledgebase everyday. Doing so will allow me to bring more business value to my employer and make me more attractive (professionally, anyway).

    Life is all about growth - If you have the same skillsets/knowledge today as you had five years ago, you are failing and need to reevaluate your personal beliefs and values. 

    Larry



  • @TDC said:

    @CodeWhisperer said:

    "Imagine you have to move 4 people across a bridge at night, but you only have one lantern, and only one or two people can cross the bridge at a time and the lantern has to be with whoever crosses the bridge.  Person A can cross the bridge in 1 minute, Person B takes 2 minutes, Person C takes 5 minutes, and Person D takes a whopping 10 minutes.   If two people cross the bridge, they move at the speed of the slowest person.   What is the minimum time to get all 4 people from one side of the bridge to the other?"  

    It's not too hard to get down to 18 or 19 minutes, but there's a solution for 17 -- and they stared at the back of my head while I tried to work my way down for about a quarter hour.   There's ways to systematically work the answer, but talk about a contrived problem! 


    Is the trick that the definition is missing the sentence "if two persons cross the bridge, they have to cross it in the same direction"? So I could say
    A and D from left to right. (10)
    A from right to left and C from left to right (+5).
    A and B from left to right. (+2)
    = 17 minutes

    Or is it something else? I actually got 19 without that "trick", using the most obviuos solution (A + X from left to right, A back, etc)


    A+B -> +2 = 2
    B <- +2 = 4
    C+D  -> +10=14
    A <- +1 = 15
    A+B -> +2 = 17

    The trick is to let the two slow people walk together


  • @TDC said:

    @CodeWhisperer said:

    "Imagine you have to move 4 people across a bridge at night, but you only have one lantern, and only one or two people can cross the bridge at a time and the lantern has to be with whoever crosses the bridge.  Person A can cross the bridge in 1 minute, Person B takes 2 minutes, Person C takes 5 minutes, and Person D takes a whopping 10 minutes.   If two people cross the bridge, they move at the speed of the slowest person.   What is the minimum time to get all 4 people from one side of the bridge to the other?"  

    It's not too hard to get down to 18 or 19 minutes, but there's a solution for 17 -- and they stared at the back of my head while I tried to work my way down for about a quarter hour.   There's ways to systematically work the answer, but talk about a contrived problem! 


    Is the trick that the definition is missing the sentence "if two persons cross the bridge, they have to cross it in the same direction"? So I could say
    A and D from left to right. (10)
    A from right to left and C from left to right (+5).
    A and B from left to right. (+2)
    = 17 minutes

    Or is it something else? I actually got 19 without that "trick", using the most obviuos solution (A + X from left to right, A back, etc)

    Actually, it's still not a trick question, in that the wording is hiding the answer. It's a mathmatical optimization question. There are actually _2_ paths which will give you 17, and only 108 possible minimal solutions. [I worked it out on paper last night]. Doing it under pressure would be difficult for me; I'm shy and nervous to begin with.


  • @CPound said:

    Ok CW, you win this round.

    CPound, this is not a game with a winner and a loser. This is, at least for most of us, serious business. We do not talk about our hobby, we talk about our work. Our own success and that of our customers/employers depend on whether or not we are doing it right.
    If you are right, CW and me and lots of other developers waste a lot of time and money everyday doing what we call "best practices" (ok, let's settle on "good practices"). On the other hand, if we are right, you and your team are on the way to maintenance hell. What you make may work now, but it will not stand the test of time.



  • @CodeWhisperer said:

    "Imagine you have to move 4 people across a bridge at night, but you only have one lantern, and only one or two people can cross the bridge at a time and the lantern has to be with whoever crosses the bridge.  Person A can cross the bridge in 1 minute, Person B takes 2 minutes, Person C takes 5 minutes, and Person D takes a whopping 10 minutes.   If two people cross the bridge, they move at the speed of the slowest person.   What is the minimum time to get all 4 people from one side of the bridge to the other?"
    I hate these types of questions. They're so...confining. When I first read the question, thoughts came to mind like, "Can you levitate across?" or "How deep is the water? Do you have to take the bridge?" or "Is the bridge merely an obstacle? Maybe there is a better way across the river. Blow up the bridge." Once again, that's me thinking "outside the box". Sorry about that. Don't want people to get too creative now, do we?



  • @CPound said:

    I hate these types of questions. They're so...confining.

    Oh please. Clear rules, clear answers. Either you find the solution or you are inapt.

    When I first read the question, thoughts came to mind like, "Can you levitate across?" or "How deep is the water? Do you have to take the bridge?" or "Is the bridge merely an obstacle? Maybe there is a better way across the river. Blow up the bridge." Once again, that's me thinking "outside the box". Sorry about that. Don't want people to get too creative now, do we?

    This is because you are unable to find the right answer. You are even unwilling to exert yourself for this task. Thinking outside the box is a good thing, but you have to know the rules in order to break them.



  • @ammoQ said:

    Oh please. Clear rules, clear answers. Either you find the solution or you are inapt.

    Heh...I didn't get the answer at the time.  

    I don't like that sort of question either, in part because there isn't much creativity involved and because it's too easy for the person to hit a wall and freeze up (like I did).  In the more 'design something that does this' sort of questions, there is room for the idea to evolve, to ask questions, provide feedback, etc. 

    This specific question came from my interview at microsoft a number of years back, and for a while it was official policy at MS to use questions like that -- which explains a lot of what I saw once I was inside.  They were all very clever people, but management had deluded themselves into thinking that "clever people + free soda = good code".  Didn't really work out that way; not in the group I was with, at least.

    I understand that they've changed their hiring process recently, not sure what it's like now.

    -cw



  • @CodeWhisperer said:

    @ammoQ said:

    Oh please. Clear rules, clear answers. Either you find the solution or you are inapt.

    Heh...I didn't get the answer at the time.  

    I don't like that sort of question either, in part because there isn't much creativity involved and because it's too easy for the person to hit a wall and freeze up (like I did).  In the more 'design something that does this' sort of questions, there is room for the idea to evolve, to ask questions, provide feedback, etc. 

    This specific question came from my interview at microsoft a number of years back, and for a while it was official policy at MS to use questions like that -- which explains a lot of what I saw once I was inside.  They were all very clever people, but management had deluded themselves into thinking that "clever people + free soda = good code".  Didn't really work out that way; not in the group I was with, at least.

    I understand that they've changed their hiring process recently, not sure what it's like now.

    -cw


    It's also too easy for someone like me, with enough domain-specific knowledge [math, in this case], to find or know the right answer without showing how I _think_ about the problem.  I enjoy working those problems, but as for a digest for how I tackle a problem, it's greatly lacking.  It simply shows that I was in a decent math program at one point.


  • @TheDauthi said:


    It's also too easy for someone like me, with enough domain-specific knowledge [math, in this case], to find or know the right answer without showing how I think about the problem.  I enjoy working those problems, but as for a digest for how I tackle a problem, it's greatly lacking.  It simply shows that I was in a decent math program at one point.

    I guess a lot of people (including me, I admit) have heard this riddle before, so it's probably not a good question for a job interview. The StringBuilder question is much better - precise enough to avoid interpretation problems, but still leaving enough room for bad, good and better solutions.



  • I hate these types of questions. They're so...confining. When I first read the question, thoughts came to mind like, "Can you levitate across?" or "How deep is the water? Do you have to take the bridge?" or "Is the bridge merely an obstacle? Maybe there is a better way across the river. Blow up the bridge." Once again, that's me thinking "outside the box". Sorry about that. Don't want people to get too creative now, do we?

    In other words, you try to be evasive instead of acknowledging that there are limits to your ability.

    That's not a good sign.

     



  • @ammoQ said:

    I guess a lot of people (including me, I admit) have heard this riddle before, so it's probably not a good question for a job interview.

    Excellent point, and another good reason not to like that sort of question.  In the Seattle/Redmond area, there are thousands of devs, stories get around, the questions get re-used.  I had one interview where I 'passed' on 3 questions in 2 hours because I already knew the trick.  

    Not only does it happen innocently, in some cases recruiters will ask candidates what questions they were asked, and then future candidates are given the questions in advance to prepare.  

    -cw



  • @DrPizza said:

    In other words, you try to be evasive instead of acknowledging that there are limits to your ability.
    It's not that I'm being evasive, I just refuse to answer stupid questions. Sure, I can do the math problems. I aced all my CS calculus classes (Calculus I-III) and thought they were no-brainers. On top of that, I was recently tested to have an IQ of 130. And I'm not talking about some online IQ test. I took the real deal. (How many of you in this forum can say you have an IQ above 70?) I'm not trying to be insulting, I'm just letting you know that I can do the math. It's just that I choose not to. It's insulting to me to be asked that type of math question because it doesn't give me enough options. In the real business world, we have to come up with creative solutions for our customers on the fly. That means you have to think "outside the box". And quickly. No real-life customer is going to ask you the lantern/bridge question. That's complete trivia. A typical customer request could be "Make my VB.NET application with MS Access backend run across four servers with no performance loss to the end user. Oh, and make it enterprise." Keep in mind you can't choose another backend. That's the type of quick, creative-thinking we have to do on our job. Just out of curiosity, how would you handle this customer request? (I'm smiling right now, thinking about all the wacky "inside the box" ideas you guys will give me.)



  • @CPound said:

    I was recently tested to have an IQ of ...

    Dude...don't...just, don't.  For so many reasons.


    @CPound said:

    It's just that I choose not to.

    Can't blame you, I was royally pissed off to have had a question like that; and after the fact I wished that I had told them exactly what I thought of such a question.  But, in the end, you're trying to give them reasons to hire you, and refusing to answer a question doesn't work in your favor; at least trying to work the problem is something.


    @CPound said:

    No real-life customer is going to ask you the lantern/bridge question.

    Exactly.  But they might ask you to do something that involves string building, or phone number standardization, or representing a foreign data type (Fixed point number, in this case), and you also refused to answer those.


    @CPound said:

    A typical customer request could be "Make my VB.NET application with MS Access backend run across four servers with no performance loss to the end user.

    See, now that's a good start to design question.  "Here's a problem, how would you solve it?"  No definitions, no true/false questions.  Just a real (or realistic, at least) problem to be solved with realistic questions you can ask to get more detail. 

    I've never used Access in any serious way except to help migrate away from it, so I don't know what specific problems you're trying to work around... what is causing the performance decrease?  Is it constant? or just while reports are running, for instance.  is it because of how the vb code interacts with access, or because of something lacking in access directly?  

    -cw



  • @CodeWhisperer said:

    I've never used Access in any serious way except to help migrate away from it, so I don't know what specific problems you're trying to work around... what is causing the performance decrease?  Is it constant? or just while reports are running, for instance.  is it because of how the vb code interacts with access, or because of something lacking in access directly?  



    Think old-school databases based on flat files with packed fields, variable schemas, etc and you'll get a good idea about the limitations of Access.  Although the implementation is different, they have many of the same limitations.  One of the biggest problems is the number of records/table.  Microsoft says the upper limit is 1M, but I've run into performance problems at points around 200k.  It also does not perform very well in multiuser environment (everybody is essentially accessing a 200Mb file over the network).  To perform a query, the client must retrieve the entire contents of the file over the network before the query even begins to be processed.  Another annoying feature is that any change (creating a temp query, table, etc) causes the file to increase in size, and does not get released until a compact (equivalent to a reorganization) is performed.  Access is good tool for prototyping and ad-hoc analysis, but is not a good choice for a backend for medium to high load and/or multi-user applications.


    @CPound said:
    A typical customer request could be "Make my
    VB.NET application with MS Access backend run across four servers with
    no performance loss to the end user.


    What is the customers business strategy? Where are they and where do they want to be?  How does this request relate to the strategy?  What is the underlying business requirements?  Is the requirement to scale out for performance or redundancy reasons?  The approach is highly dependent on the answers to these questions. 

    Without more specifics on the exact nature of the problems, I can only speak to how I generallly approach providing solutions.  I would approach the request by sitting with the customer to understand what they are trying to accomplish and where they want to go.  Based on the meeting, I would provide several alternatives to solve the issue outlining the pros/cons, costs, time to deployment, and potential for growth.  Sometimes, I even recommend a non-technical solution because the underlying issue is not technical but rather process related.  The customer can then make a decision that best serves their interests.  Even if I believe they make the wrong decision, at least I've educated the customer about the consequences.

    Larry


Log in to reply