As was foretold, we've added advertisements to the forums! If you have questions, or if you encounter any bugs, please visit this thread: https://forums.penny-arcade.com/discussion/240191/forum-advertisement-faq-and-reports-thread/

YA[Programming]T :: Interview? That's an MVC thing, right?

19495969798100»

Posts

  • InfidelInfidel Heretic Registered User regular
    kime wrote: »
    pssst, Infy, you brought back the original mistake:
    End wrote: »
    Perhaps what you wanted is == not =

    :P

    (Just in case someone ends up copying that code or something and not noticing that)

    Pfffft that isn't even my bracket style!

    But yes, you'll want to fix the uncompilable error again.

    OrokosPA.png
  • BryonyBryony Registered User regular
    Craziness - I totally just added the extra = sign and it compiled and appeared to work as intended, though it was supposed to output a 'not equal' result.

    As an experiment I tried changing the file that was giving it the numbers that weren't equal so that they were equal to see if it would keep outputting the not equal result (like you said) but it's giving the correct result - it now says it's equal.

    With Infidel's code it compiles but throws an exception when it gets to the part where it compares equality. I'm going to bet your code is more correct than mine because I'm a total beginner, so I'm going to poke at it and try work out why there's an exception. My suspicion is that it has something to do with the hashcode method and that I don't know what a hashcode method is when it's at home so I don't think I have any. The link Monkey Ball provided looks promising though.

    That Stupid Hat - A Wargaming Blog
  • bowenbowen How you doin'? Registered User regular
    Feel free to PM me again for that one @Bryony.

    not a doctor, not a lawyer, examples I use may not be fully researched so don't take out of context plz, don't @ me
  • Jimmy KingJimmy King Registered User regular
    Ugh. I'm feeling like honky today (although still not really even half as bad). I keep being harassed like every 2 hours starting yesterday about my progress on writing a tool to export data from a home grown CMS I've never touched, to an XML based format I've never heard of, to be imported into another CMS I've never heard of. No requirements/mapping of which of our fields map to theirs, no use cases or user stories, nothing.

    I miss the days of just a couple months ago when I had a proper scrum team, doing closer and closer to true scrum every day, and actually making serious progress on shit.

  • InfidelInfidel Heretic Registered User regular
    Bryony wrote: »
    Craziness - I totally just added the extra = sign and it compiled and appeared to work as intended, though it was supposed to output a 'not equal' result.

    As an experiment I tried changing the file that was giving it the numbers that weren't equal so that they were equal to see if it would keep outputting the not equal result (like you said) but it's giving the correct result - it now says it's equal.

    With Infidel's code it compiles but throws an exception when it gets to the part where it compares equality. I'm going to bet your code is more correct than mine because I'm a total beginner, so I'm going to poke at it and try work out why there's an exception. My suspicion is that it has something to do with the hashcode method and that I don't know what a hashcode method is when it's at home so I don't think I have any. The link Monkey Ball provided looks promising though.

    Uhh, what is the equality check actually comparing? We never saw that.

    OrokosPA.png
  • bowenbowen How you doin'? Registered User regular
    Jimmy King wrote: »
    Ugh. I'm feeling like honky today (although still not really even half as bad). I keep being harassed like every 2 hours starting yesterday about my progress on writing a tool to export data from a home grown CMS I've never touched, to an XML based format I've never heard of, to be imported into another CMS I've never heard of. No requirements/mapping of which of our fields map to theirs, no use cases or user stories, nothing.

    I miss the days of just a couple months ago when I had a proper scrum team, doing closer and closer to true scrum every day, and actually making serious progress on shit.

    Hey at least you're not getting your neck breathed down because your fully function EHR isn't ready to be licensed and used within a 5 month period.

    not a doctor, not a lawyer, examples I use may not be fully researched so don't take out of context plz, don't @ me
  • Grey PaladinGrey Paladin Registered User regular
    Is it bad practice to write succinct code that works but uses some of the language's more obscure rules and so risks confusing newbies and the inattentive? Should I write superfluous code to make it more readable?

    "All men dream, but not equally. Those who dream by night in the dusty recesses of their minds wake in the day to find that it was vanity; but the dreamers of the day are dangerous men, for they may act their dream with open eyes to make it possible." - T.E. Lawrence
  • bowenbowen How you doin'? Registered User regular
    Only if it's a requirement.

    For instance I can't seem to not abuse Linq at all anymore. I pity the poor kid who reads this shit when I leave.

    not a doctor, not a lawyer, examples I use may not be fully researched so don't take out of context plz, don't @ me
  • InfidelInfidel Heretic Registered User regular
    Is it bad practice to write succinct code that works but uses some of the language's more obscure rules and so risks confusing newbies and the inattentive? Should I write superfluous code to make it more readable?

    I recommend always going for readable code unless the succinct version has a non-trivial performance impact. Lots of times the "cool" way or language-specific way doesn't make anything better, and just makes it harder to grok for people not familiar that much with the language.

    What that exactly applies to is a judgment call, because it is kind of a qualitative assessment.

    OrokosPA.png
  • PhyphorPhyphor Building Planet Busters Tasting FruitRegistered User regular
    No. At the very least if you comment it they can't complain

  • Jimmy KingJimmy King Registered User regular
    I tend to try to write the first version my code so that someone who has only been coding for 6-12 months could easily figure out what it does, even if they wouldn't have thought to write it in the first place.

    Like Infidel said though, it's a judgement call. Sometimes that "less clear" version is actually more clear, obvious, and readable for someone who is more familiar with the language or framework than the simplified version. I find myself doing that a lot with the early Django code I wrote here. I'll come across it now and think "man, that's an ass backwards way to have written that and add 10 extra lines to decipher" and then put it in for refactoring. But at the time it seemed like the clear way to write it.

  • InfidelInfidel Heretic Registered User regular
    Jimmy King wrote: »
    I tend to try to write the first version my code so that someone who has only been coding for 6-12 months could easily figure out what it does, even if they wouldn't have thought to write it in the first place.

    Like Infidel said though, it's a judgement call. Sometimes that "less clear" version is actually more clear, obvious, and readable for someone who is more familiar with the language or framework than the simplified version. I find myself doing that a lot with the early Django code I wrote here. I'll come across it now and think "man, that's an ass backwards way to have written that and add 10 extra lines to decipher" and then put it in for refactoring. But at the time it seemed like the clear way to write it.

    And keep in mind that succinct use of language can be the more readable form, which in that case "go with the readable" still.

    I'd rather see
    for (auto it = something.iterator(); ...)
    

    over
    for (somethings::type<ohgod,makeitstop>::fuckthis::iterator_t it = something.iterator(); ...)
    

    The format is more succinct, using language features, and entirely exists for readability.

    OrokosPA.png
    bowen
  • an_altan_alt Registered User regular
    Three language mini-project today. Manipulate data in Python and load it into a db, make accessible via a Java web service, and pull it into the VFP desktop app. It's fun being able to switch back and forth and see the same data flow in different languages.

    The hard part? Each language uses different characters to mark comments. That and loops always screw me up.

    As for readability, I'm with Infidel - unless it's a performance issue (and it usually isn't) go for readability. However, I'd be more inclined to use language specific conventions for two reasons. First, if somebody is Googling, making your code look the way the language is normally found is making it more readable. Secondly, in some languages the conventions (and built-in data structures, etc) are optimized behind the scenes.

    Pony wrote:
    I think that the internet has been for years on the path to creating what is essentially an electronic Necronomicon: A collection of blasphemous unrealities so perverse that to even glimpse at its contents, if but for a moment, is to irrevocably forfeit a portion of your sanity.
    Xbox - PearlBlueS0ul, Steam
    If you ever need to talk to someone, feel free to message me. Yes, that includes you.
  • InfidelInfidel Heretic Registered User regular
    New thread in remembrance of ecco's batch file adventures!

    OrokosPA.png
This discussion has been closed.