Giter Club home page Giter Club logo

bm-kotlin-react-tifa's Introduction

ReactJS/TypeScript and Kotlin assignment

This repo is used for home assignment as part of the hiring process at Bettermarks.

We hope that you would be able to finish this assignment within two hours.

If there are any questions/problems while you are working on it, please ask them via mail or create an issue in the repo.

Objective: Create a small equation validator web application using Kotlin, ReactJS and TypeScript.

Requirements

  • OpenJDK 18
  • Kotlin SDK
  • NodeJS v16

Step 0 - Run the code

  • The app folder contains the ReactJS and TypeScript code base

  • The equation-validator folder contains the Kotlin code base

  • In the app folder, make sure the react app is running correctly:

node -v
# > v16
npm i && npm start

Your app should run on localhost:8080 app

  • In the equation-validator folder
    • build the kotlin app:

      java --version
      # > openjdk 18 ....
      ./gradlew build
    • run the kotlin app using the native CLI executable:

      ./build/bin/native/debugExecutable/equation-validator.kexe
      # > Enter an equation (like a + b = c):
      # > 1 + 2 = 3
      # > FIXME

Step 1 - Kotlin: implement the equation validator

  • Objective: Given a text input representing a simple equation, return if the equation is valid or not.

Only equations of type a + b = c are accepted.

Examples:

Input: "1 + 2 = 3"
Response: "valid"

Input: "1 + 2 = 5"
Response: "invalid"

Input: "not an equation"
Response: "syntax error"

Input: "1 + 2 + 3 = 6"
Response: "syntax error"

Input: "1 - 2 = 3"
Response: "syntax error" 

You can code your validator inside equation-validator/src/commonMain/kotlin/Validator.kt

Step 2 - React: Integrate the validator JavaScript library

  • Objective: Use the equation validator from the ReactJS/TypeScript app.

The gradle configuration is already configured to build the equation-validator as JavaScript bundle in equation-validator/build/js/packages/equation-validator

  • You can include the equation-validator module like:
# from app/
npm i --save ../equation-validator/build/js/packages/equation-validator
  • and import {validateEquation} from 'equation-validator'; to import the equation-validator (compiled from the fun validate() { ... } in kotlin)

  • You do not need any specific style, just add the return of the validateEquation function inside a <span></span> html tag after the ?

Step 3 - Submit your results

  1. Commit and push all your changes to a new branch
  2. Create a pull request on main with your results from GitHub In case you ar not familiar with creating pull requests, please follow the official instructions provided by GitHub.
  3. Add your contact person as a reviewer.

bm-kotlin-react-tifa's People

Contributors

brachetti avatar tiagofassoni avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.