Giter Site home page Giter Site logo

geometry-challenge's Introduction

Triangle-Challenge

Project

Problem

Write a program that will determine the type of a triangle. It should take the lengths of the triangle's three sides as input, and return whether the triangle is equilateral, isosceles or scalene.

We are looking for simple but good solutions that properly solve the problem. Pay special attention to tests, readability of code and error cases.

Approach

Besides solving the explicit problem above, the project should demonstrate decision-making skills while demonstrating Fullstack Engineering knowledge and abilities.

  1. Conceptual understanding

My geometry was a bit rusty, so the first step was to visit Google. After refreshing some basic concepts from Euclidean geometry, I had a conceptual understanding of the problem and a possible solution.

given a,b,c
check if a,b,c forms a valid triangle,
    then determine triangle type
  1. Technology stack

A lot of engineering lies in choosing the right tools for the job. I decided to use tools that emphasize speed and flexibility (Python or JavaScript). Since the problem didn't require high numerical precision and I also wanted to demonstrate some Frontend abilities, I choose JavaScript. This isomorphic stack would allow me to easily extend a Node.js app with a web interface, using React.

  1. Workflow

I choose to frame the assignment, more as a real-world problem โ€“ a moving target, with changing priorities and multiple solutions. From my experience, the best process is iterative with frequent deliveries. With this agile approach, here are the first milestones:

  • simple command-line app taking 3 inputs (length of sides: a,b,c) and returning whether the triangle is an equilateral, isosceles or scalene

  • simple web-interface with 3 inputs controls and text display for return triangle type

  • make web-interface more interactive with a visual display of triangle

  • move visualizations to canvas, to easily extend shapes

  • add TypeScript / Flow and do more rigoures testing of React components

Usage

Installation

  1. Make sure you've a recent version of Node and NPM installed on your computer
  2. cd into the project directory and npm install to download required modules

Run Dev

After installation, start the dev server by running npm start. You can now access the web-interface from http://localhost:3000/ in your browser

Run Tests

After installation, run the tests by running npm test. This will use the local jest installation to run the test environment.

Disclaimer / Troubleshooting

  • I've only tested the web-interface in newer versions of Chrome

geometry-challenge's People

Contributors

markdyousef avatar

Watchers

 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.