Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Open ended interview question - How to tackle

Options
  • 17-01-2019 10:37am
    #1
    Registered Users Posts: 13


    I was given this question as an assignment for Junior/Mid Level Full Stack Developer role.

    (The interview process is long over but I want to try and gain as much as I can from the assignment)
    Step 1: Shopping cart
    • You are building a checkout system for shop which only sells apples and oranges.
    • Apples cost 60p and oranges 25p.
    • Build a checkout system which takes list of items scanned at the till and outputs the total cost.
    • For example: [ Apple, Orange, Apple ] => £2.05
    • Make reasonable assumptions about the inputs to your solution; for example, many candidates take a list of strings as input

    Step 2: Simple offers
    • The shop decides to introduce two new offers
      • buy one, get one free on Apples
      • 3 for the price of 2 on Oranges
    • Update your checkout functions accordingly

    The only request was to use Git throughout the process to show your work.

    It can probably be created as a Java program in about 15 minutes, but that wouldn't show off any abilities with frameworks, databases, REST etc.

    After a bit of thought, my approach would be
    • Create a spring boot application that generates a webpage
    • Use javascript buttons on the webpage to mimic the scan of an apple/orange (and automatically update totals inc. discounts)
    • Save the details of each sale/transaction to a Google FireBase database

    This alone would take me a few days to figure out as I am not very experienced with this type of project.

    I would like to know what approach people would take to answering this and what would a company be specifically looking out for knowing that the applicants are Junior/Mid Level.


Comments

  • Moderators, Computer Games Moderators Posts: 4,281 Mod ✭✭✭✭deconduo


    My approach would be to start small and build up. Tag each stage as a release when happy that it's working.

    1. Use TDD - start with a few unit tests.
    2. Create an MVP - a function that takes an array of strings and gives the total
    3. Update the MVP to work with offers
    4. Turn the function into a web API, probably REST
    5. If creating a frontend, consume the API rather than having everything coupled

    Ensure best practices around code quality, tests, etc. is followed throughout.


  • Registered Users Posts: 1,735 ✭✭✭pinksoir


    If the focus was full stack you could get something like this up and running very quickly with React in the front end and GraphQL (Prisma) in the backend. You could use something like Firebase or even a simple dummy API if you didn't want to actually 'process' your orders ( creating order items etc.).

    I'd start by setting up the data model and schema in the backend, and this is where your values of the individual items would live. So a type for Item (name - apple and orange, price), Items (array of Item types), and an OrderItem type (Item and it's count), and Order type (array of OrderItems).

    The front end would then take care of querying the Items array and creating a 'shop' listing for each Item. You create add to cart buttons for each item, and a cart, and then send orders from the cart to the backend as an order mutation. Your cart could take care of all the offers for the second part pretty easily. So all your cart functionality would happen in the front-end (you could use local storage to persist data etc.), and your backend would just take care of the available items and generating orders.

    But yeah, start small and build. Just break it down into its smallest parts and do them sequentially.


  • Registered Users Posts: 13 k2788


    deconduo wrote: »
    My approach would be to start small and build up. Tag each stage as a release when happy that it's working.

    1. Use TDD - start with a few unit tests.
    2. Create an MVP - a function that takes an array of strings and gives the total
    3. Update the MVP to work with offers
    4. Turn the function into a web API, probably REST
    5. If creating a frontend, consume the API rather than having everything coupled


    Ensure best practices around code quality, tests, etc. is followed throughout.

    Thanks for the advice. From reading the above, what I think what I am looking for more than anything is help creating a Project Plan.
    Once I know what I should be doing, I can start actually doing it but thats where the knowledge gap is.

    I will create my own more detailed plan that the one you have set out but part 4 and 5 are where I will get stuck as it will be about process as opposed to actually solving a problem. I have no idea how I would turn a function into a Web API or what it means to consume an API. (perhaps you know a decent course or tutorial?)

    Also a couple of other short questions,
    Should i be using Maven from the beginning, is this a case for a Maven Project ?
    Should i try and use something like Jira to keep track of issues, bugs and my testing cases ?


  • Registered Users Posts: 6,150 ✭✭✭Talisman


    The best way to learn about REST is to build your own API - it doesn't have to be anything fancy. Along the way you may discover some of the best practises for yourself. What you're looking for is those little Eureka moments where you solve a little problem and your brain releases endorphins. Those moments are what will help you close the knowledge gap.

    Work your way through this:
    REST API Tutorial - How to design a REST API

    It has guides on virtually everything related to REST and by the end you should know how to apply the REST principles to a project.


Advertisement