Code interviews for a PHP developer roles - eviltoast
    • Veraxus@lemmy.world
      link
      fedilink
      arrow-up
      4
      ·
      8 months ago

      Any sufficiently skilled developer has a bunch of things they hate about the language they use the most, and are happy to tell you about it.

      This is a characteristic I unironically keep an eye out for when hiring.

  • themusicman@lemmy.world
    link
    fedilink
    arrow-up
    87
    ·
    edit-2
    9 months ago

    “Introductions and a bit of smalltalk” - I would shit myself if an interviewer started asking about smalltalk… /s

    • Pandantic [they/them]@midwest.social
      link
      fedilink
      English
      arrow-up
      27
      ·
      edit-2
      9 months ago

      I was thinking the same thing. I mean, I just did a coding test for a potential job, and I know I did at least as good as, and likely better than this.

      edit: just to prove to myself, I went ahead and wrote the program without looking things up. I’m self-taught so I feel pretty proud. It took about 25 mins, and it works!

      • Dagamant@lemmy.world
        link
        fedilink
        arrow-up
        7
        ·
        8 months ago

        Yeah, I use Python as a hobby and I my biggest project is a discord bot that does a bunch of things. Just for kicks I tried answering the questions without google and made working solutions. I don’t know if they are optimal but they work and I didn’t have to look things up.

  • Björn Tantau@swg-empire.de
    link
    fedilink
    arrow-up
    55
    ·
    9 months ago

    I used to work at a company that used XSLT. They know that it’s an obscure language that probably none of the potential candidates have ever worked with. But it’s easy enough to learn the basics in an hour or two.

    So the entry test was to strip some tags from an XML file. You had a day or two (maybe more) to do it. My solution wasn’t ideal, I didn’t use several of the shortcuts available in the language. But at least it did what it was supposed to.

    A few weeks after I had started working there my boss came up to me, visibly frustrated and asked me whether the test was too hard. Thinking back on my problems I replied that maybe having the desired output ready so that you could test your own solution against it might be nice. But my boss’s problem was that none of the last 5 candidates could even send in a solution that would run.

    You had so much time, and running an XSLT script is really easy and takes no time at all. And for some inane reason these people couldn’t even manage to test their code and still decided to send it in.

    And I thought I was an idiot when I didn’t know if it was spelled grey or gray in CSS during the in-person interview.

    • oldfart@lemm.ee
      link
      fedilink
      arrow-up
      24
      ·
      9 months ago

      It is very good test for the ability to research, I think. The amount of people who painstakingly went through some video tutorial on PHP and are now developers is insane. I’m sure there’s place in the market for them (writing Wordpress themes/plugins, for example), but it’s hard to find a programmer with ability to think these days. Not because people are more stupid, but because every other person is a programmer now.

    • dejected_warp_core@lemmy.world
      link
      fedilink
      arrow-up
      19
      ·
      8 months ago

      You had a day or two […] none of the last 5 candidates could even send in a solution that would run.

      As harsh as this sounds, this test was doing its job. Assuming you’re not hiring junior candidates, that is.

      One day is enough to research XSLT enough to get the gist, and two is enough for a polished solution. And since we’re just stripping tags, we’re really just selecting for all the inner text, which is weird but not hard to do with the right selector expression. The task also selects for people that understand XML processing as programmatically manipulating a DOM, which is crucial to wrapping your head around more advanced tasks.

    • Caveman@lemmy.world
      link
      fedilink
      arrow-up
      13
      ·
      8 months ago

      grey and gray are both in CSS. If you’ve worked with CSS long enough there’s a chance you’ve seen both. :)

    • MonkderDritte@feddit.de
      link
      fedilink
      arrow-up
      10
      ·
      edit-2
      8 months ago

      I would prefer your kind of test a hundred times over the one on top here.

      That said, why would they expect you to know the css color values by heart? I see no usecase for that.

      • Björn Tantau@swg-empire.de
        link
        fedilink
        arrow-up
        17
        ·
        8 months ago

        It just came up in a discussion. The test was to spot mistakes in some HTML code. I marked the “gray”. The guy I did it with said that that’s not a mistake. At least he thinks it’s not. We were musing about that for a minute and later found out that I was wrong. Nothing major. I just felt stupid about it.

        I felt especially stupid because he seemed to be rather important. While everyone’s e-mail address was firstname.lastname@company.tld his was joe@company.tld.

        But he was just a nice guy and apparently I did well and got my rather high salary approved.

      • Björn Tantau@swg-empire.de
        link
        fedilink
        arrow-up
        7
        ·
        9 months ago

        I wanted to answer “grey”, full of confidence. Then I decided to look it up to be sure and found out that it’s “gray”.

        The test was to spot mistakes in a simple html file. So I couldn’t substitute anything. And my favourite gray color is #666.

      • jkrtn@lemmy.ml
        link
        fedilink
        arrow-up
        5
        ·
        8 months ago

        GrAy for Americans and grEy for Europeans. I used to basically flip a coin but I read that mnemonic once and have never forgotten since.

        • Syn_Attck@lemmy.today
          link
          fedilink
          arrow-up
          2
          ·
          8 months ago

          referrer, meet referer.

          probably the easiest way to spot someone that’s spent a decent amount of time messing with HTTP/1.x headers.

    • kuneho@lemmy.world
      link
      fedilink
      arrow-up
      5
      ·
      8 months ago

      XSL is like that, I guess.

      Some shit still use XSL at my workplace, and once I got a task with them, so… I hit up some online resources and fixed the issue.

      I kid you not, from there on, I was (and still am) the XSL guy and gave me more XSL designing and work.

      I mean, it’s not hard, a tiny little bit complex, but I really just spent half hour researching and some googling during work to complete these tasks, it in its own way makes sense.

      But they just… aren’t willing to maintain those XSLs, because they indeed looks really ugly and scary in a way.

  • Socsa@sh.itjust.works
    link
    fedilink
    arrow-up
    48
    ·
    8 months ago

    You can tell this is fake because the code interview actually tests basic knowledge instead of giving you 13 minutes to create a templated polymorphic class which accepts arbitrary flatbuffer arguments and implements factory pattern constructors written in Haskell, with the end goal of recursively sorting nanoparticles by bond strength. Intro level position, $8/hr, must supply your own MacBook.

    • uis@lemm.ee
      link
      fedilink
      arrow-up
      6
      arrow-down
      4
      ·
      edit-2
      8 months ago

      Ewwwww, macbook. Oh, wait. It was sarcasm I guess.

  • PolarisFx@lemmy.dbzer0.com
    link
    fedilink
    arrow-up
    44
    ·
    edit-2
    8 months ago

    Oh geez, I’m one of those people who can’t code on paper. I was applying for something ages ago and I went in for a programming test and they handed me a paper test and my mind completely shut down. Put me in front a computer and I have no issues at all… It was embarrassing.

    • mipadaitu@lemmy.world
      link
      fedilink
      English
      arrow-up
      29
      ·
      8 months ago

      I would just write down the steps I would take, just some psudocode. It doesn’t have to work, it just has to make sense in the style of the language you’re talking about.

      import random library  
      import any GUI/display libraries required for the outcome desired
      
      build array of integers [1..52] (or 0..51 if you're being fancy)
      for loop 1..1000
             select random number A 1..52 (or 0..51 if you used that above)
             select random number B 1..52 (or 0..51 if you used that above)
             swap elements in the array A and B
      pop first two elements from array
      decode at display time what the two numbers represent in terms of playing cards
      

      If the test requires more than that, then they’re crazy. The syntax doesn’t matter, just that you can logic yourself through the problem.
      You can use the IDE, google, or whatever to fill in the specifics. If you wanted me to do that in literally any programming language, once the psudocode is done, you just spend an hour or so looking up the details.

      • renzev@lemmy.world
        link
        fedilink
        arrow-up
        10
        ·
        8 months ago

        If you wanted me to do that in literally any programming language, once the psudocode is done, you just spend an hour or so looking up the details.

        In some cases, you can even use an AI chatbot as a “pseudocode compiler”. Just tell it to translate your pseudocode to an actual language. I’ve done it for shell scripts a couple of times, works surprisingly well. Not that I would do this at a job interview haha.

    • jkrtn@lemmy.ml
      link
      fedilink
      arrow-up
      12
      ·
      8 months ago

      Even the odd numbers stuff? I think interviewers account for nerves and being outside an IDE. You might draw a blank but would you be would be randomly adding things like these did?

      • PolarisFx@lemmy.dbzer0.com
        link
        fedilink
        arrow-up
        6
        ·
        8 months ago

        No this was just crazy, I have worked with people like that though where stackoverflow was permanently on a second monitor, and I wondered how they made it through the interview process

    • kuneho@lemmy.world
      link
      fedilink
      arrow-up
      10
      ·
      8 months ago

      for some reason I still needed to know programming on paper so much so that at the university, in class prgramming we had to do the exam on paper. every time. no matter if it was Java or C++…

      I strangely enjoyed it, but it still was kinda weird.

      • uis@lemm.ee
        link
        fedilink
        arrow-up
        4
        ·
        8 months ago

        In university I written on papers programs in pure C. They did compile. They even worked. But they were school olympiad-level, so it doesn’t count I guess.

        Oh, and I was supposed to write in Python.

      • PolarisFx@lemmy.dbzer0.com
        link
        fedilink
        arrow-up
        2
        ·
        8 months ago

        I lucked out, my university was digital before that was a thing. So the amount of written exams was minor enough that I pulled through ok

    • germanatlas@lemmy.blahaj.zone
      link
      fedilink
      arrow-up
      2
      ·
      8 months ago

      Yeah, I really liked my prof for some of the programming courses, but also damn him for making us write code on paper in the exams

  • Naich@lemmings.world
    link
    fedilink
    arrow-up
    40
    ·
    9 months ago

    Want to print out all odd numbers from 1 to 100? Easy:

    for(_=[];_<+!![]+""+[]*[]+[]*[];_++)(_%+(!![]+!![])?console.log(_):[]);

    • Naich@lemmings.world
      link
      fedilink
      arrow-up
      17
      ·
      8 months ago

      Actually, I prefer this one: for(_=[];_<+!![]+""+[]*[]+[]*[];_++%+(!![]+!![])?[]:console.log(_));

      • Naich@lemmings.world
        link
        fedilink
        arrow-up
        18
        ·
        8 months ago

        Or this one without the “undefined” when run in a browser console:

        for(_=[];_<+!![]+""+[]*[]+[]*[]-!![]-!![];_++%+(!![]+!![])?[]:console.log(_));_+!![]

          • Naich@lemmings.world
            link
            fedilink
            arrow-up
            2
            ·
            8 months ago

            _ is a variable name, [] becomes 0 when converted to an integer, !![] becomes 1. The + “” + means that the integers 1, 0, 0 get converted to a string - “100”, which gets converted back to an integer because it’s in the for loop. And there’s various other horrible conversions going on to make it all work.

  • WFH@lemm.ee
    link
    fedilink
    English
    arrow-up
    38
    ·
    edit-2
    8 months ago

    And that’s why we’re moving away from coding games where I work. Bad people try to cheat, good people can panic and shit the bed.

    When I do interviews, I’m more interested in the candidate’s relevant experience, what kind of issues they faced, how they were solved, if they think they could have done things differently, and how they think. Code itself is irrelevant unless I can review a sprint’s worth of PRs.

    When I ask more technical questions, I never ask for code but for an explanation on how they would tackle the problem. For example, I often ask about finding a simple solution to get all data relevant to a certain date in two, simple, historized tables. If you know window functions, it’s trivial. If you don’t, your solution will be slow and dirty and painful. But as most devs don’t know about window functions anyway, it lets me see how they approach the issue and if they understand what parts should have a trivial solution to make it simple.

    • Veraxus@lemmy.world
      link
      fedilink
      arrow-up
      17
      ·
      edit-2
      8 months ago

      This is why I prefer live interviews. I tell them they can use whatever tools they want, search for anything they want, there are no restrictions. All I ask is that they share their entire screen (if not in person) and try to “think out loud” as much as possible. I then time-box each step (usually 15m ea in a 1-hour interview).

      I am most interested in HOW they solve the challenges I set out for them. Whether they complete it or not is usually irrelevant.

      Edit: Lately, though - I warn against AI. I don’t ban it, but every person that has tried to use AI in an interview has gone down in flames. AI simply cannot be trusted… and if you haven’t learned that lesson, and you can’t even tell when it’s giving you bad information… yikes.

      • ErilElidor@feddit.de
        link
        fedilink
        arrow-up
        3
        ·
        8 months ago

        I use ChatGPT sometimes to give me a pointer in what directions I could go/research more for a given problem. But if I ever take the code provided by it, I need to review it line by line and half the time it doesn’t even compile anyway. At this point it’s just a helper to suggest to me what to google for and then I do the rest😅

      • 0xD@infosec.pub
        link
        fedilink
        arrow-up
        2
        ·
        8 months ago

        I approach interviews for penetration testing positions in the same way, just with hacking challenges!

  • Tartas1995@discuss.tchncs.de
    link
    fedilink
    arrow-up
    28
    arrow-down
    1
    ·
    9 months ago

    I hope these aren’t real. I, and most people here, could probably write these codes top to bottom on paper without an eraser or strikethrough parts because we have it fully solved before the interviewer finished the sentence.

    • sntx@lemm.ee
      link
      fedilink
      arrow-up
      7
      ·
      9 months ago

      I mean, it’s a hard problem to solve if you never worked with moduli before.

      • themusicman@lemmy.world
        link
        fedilink
        arrow-up
        24
        ·
        9 months ago

        Sure, programming is hard if you’ve never worked with programming language features before… Modulus isn’t some obscure esoteric operator, it’s literally CS 101

        • drphungky@lemmy.world
          link
          fedilink
          English
          arrow-up
          4
          ·
          edit-2
          8 months ago

          I fell backwards into programming and did it for years before ever needing or encountering a mod operator. It never really came up in statistical programming (SAS) and since I wasn’t a CS major I don’t think I even learned about it until taking online programming classes for fun. But I know I was a pretty damn good SAS programmer. I never had any issues solving any problems in my field programmatically, but I took a few leet code tests and was completely puzzled before taking said CS classes. The algorithms and common problems just never remotely came up. I never found fizzbuzz particularly relevant in statistics and data CRUD.

          Now maybe since SAS is procedural and not OO you’d say it doesn’t have typical “programming language features”, but I could easily see that experience being common in all kinda of business side programming like R, VBA, maybe JavaScript or Python, etc.

          …but anyway obviously I’m not saying its not a good thing for a dev shop to interview on, and if they want someone classically trained then it’s probably a perfect question. My quibble is just that you might need to widen your definition of who programs.

      • hope@lemmy.world
        link
        fedilink
        arrow-up
        9
        ·
        9 months ago

        Is it? I would expect someone to come up with either toggling a variable back and forth for even/odd, or counting by 2s, heck, treat it as a floating point, divide by two, and search the string representation for a period or something!

        • sntx@lemm.ee
          link
          fedilink
          arrow-up
          1
          ·
          8 months ago

          I feel like the floating point suggestion would backfire quickly due to imprecisions.

      • jkrtn@lemmy.ml
        link
        fedilink
        arrow-up
        8
        ·
        8 months ago

        Shouldn’t people familiar with integer arithmetic should be able to struggle to something like x == 2 * (x/2) to test if it is odd or even? Or just bitwise x & 1?

      • uis@lemm.ee
        link
        fedilink
        arrow-up
        3
        ·
        8 months ago

        Meanwhile I in school practiced Diffie-Hellman on paper with classmates

  • VantaBrandon@lemmy.world
    link
    fedilink
    arrow-up
    22
    ·
    8 months ago

    I once knew a “developer” with 20 years of “experience” who could not write a foreach loop by hand

    Some people are really good at bullshitting their way through life

    • sunbytes@lemmy.world
      link
      fedilink
      arrow-up
      15
      arrow-down
      1
      ·
      8 months ago

      I jump between languages so much I can never remember the structure.

      for item in items? Or item of items or items as item?

      Best to just have the IDE auto complete it.

      • PsychedSy@lemmy.dbzer0.com
        link
        fedilink
        arrow-up
        3
        ·
        8 months ago

        Same here. I’m blue collar so I only do it at work if someone fucks up and gives me access to an interpreter. Or I suck it up and use powershell or excel then drink vodka and cut myself when I get home.

    • JareeZy@feddit.de
      link
      fedilink
      arrow-up
      3
      ·
      8 months ago

      Knowing about and having met multiple such “senior Devs” has made me feel so much better about my work and my own set of skills, not gonna lie.

  • Sotuanduso@lemm.ee
    link
    fedilink
    English
    arrow-up
    21
    ·
    9 months ago

    “I am trying to test your programming skills, not your Google-search skills.”