I have been asked to submit a piece of code for review for an interview, something I'm proud of writing.

What kind of code snippet would you submit? (A custom sort.. a tricky bit of data manipulation etc)

  • 4
    right now i'd probably submit either a MultisourceFile class i made. relatively simple, elegant to use, and in my opinion cool: you define ordered list of sources (local, remote, internet, wherever) for that file and when you try to access its contents, ot automatically gets the closest or most recent version of the file and updates all the sources to that version. works on desktops and android.

    or a class that converts touchscreen gestures to "action command messages" which then get consumed by player controller class and get executed as in-game actions.
  • 6
    I'd submit something that solves an actual problem you had. Unlike some tricky but useless code, the interview can then go on with your problem solving process.
  • 2
    Npm install all_dem_side_projects
  • 1
    I'd submit my ModelMapper. A utility that easily transforms/merges objects. As easy as
    mapper.transform(account, new AccountDto())
    Account updated = mapper.apply(dto, accountDao.get(dto.getId()))

    It is slower on first use only. Later on caches all the slow parts. And works well with circular refs. And with deep values.

    I am yet to opensource it [along with other nifty utils] once I figure out how to remove my secrets file from my git history 😁
  • 1
    @Fast-Nop this might be my best approach I think
  • 1
    @Fast-Nop hold on, are you telling me that my deep transformer stack that pipes into a free monad based engine which uses endomorphic category theory based transforms to output bytecode for an interpreter which JIT compiles it down to machine code for MIPS which runs via realtime binary translation on RISC-V emulated on an ARMv8 processor won't do? It can...
    ...add two integers, I'll have you know!
  • 1
    @RememberMe What - no cloud, no IoT, no AI? Still losing out. ;-)

    @torpkev I'd also make sure that the code is written for clarity rather than performance, except where benchmarking proved it was a bottleneck.

    And proper error handling should be there because that's what I'd look for in production grade code. If there's external input, sanitation / validation is also required. These are two items where you can tell pros from amateurs.
Add Comment