Giter Club home page Giter Club logo

highly-uncertain-test-task's Introduction

Running locally

docker-compose up

Testing

You can import postman collection from root folder. It contains two requests - basic ruleset and custom ruleset. Change path param to apply first or second ruleset to data provided in body

The theory

Task fits well into finite state machine, as has input alphabet (rule type and A, B, C), output alphabet (the formulas) and set of internal states [M, P, T].

FSM approach isn't chosen, because:

  1. It's long for develop in terms of test task (with high level of uncertainty ;).
  2. It's hard to change and maintain, and such task need flexibility

Instead, approach with decorators around base rules are used. Nevertheless FSM naming is present (CommandToState and StateToExpression), because it's just easier to operate on some domain field.

A,B,C and are named "command", because this signals are used for state calculation. Commands are represented as binary string because it is easier to read and understand (still all system could be implemented using bitmasks for memory optimization, but we all know about evil of premature optimization ;) )

M,P,T are named "state" and ar represented as strings.

Different calculation logic are named as "rules" and based on route name. Rules incapsulate input->state and state->formula mapping.

Formulas are named "expressions" as in the doc

Known issues

No tests as my time is limited and test task is relatively small.

Better error handling/wrapping (with error mechanism from newest golang release)

Different HTTP codes for different types of errors using gin middleware (e.g. not 500 for every error)

Better validation on HTTP layer and int overflow checks in formulas

Bump versions of alpine and golang in dockerfile

Goimports

Git tree with more than one commit ;)

highly-uncertain-test-task's People

Contributors

oleksiireshetnik avatar

Watchers

James Cloos avatar  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.