Code Monkey home page Code Monkey logo

irregular-verb-trainer-mvc-'s Introduction

๐Ÿ“– English irregular verb trainer

Description:

Web application for better memorization of irregular English verbs. The program prompts the user to enter the correct version of one of the forms of the verb. It then validates the entered data and displays the result. It is possible to expand the list of verbs by editing the json file.

Demo:

How to run the application:

  • clone the repository and run index.html in the root folder

How to edit the list of verbs:

Warning: It is not recommended to change the structure of the json file with the list of verbs, since the program code is adapted for it.

  • you can edit list of verbs in /data/data.json
  • you can also store a list of verbs on a remote server. And get it using Rest Api by sending a Get request. The URL for the request can be specified in /js/script.js in the controller call line like:

/js/script.js

const runApp = new Controller(new Model('data/data.json'), new View());

the implementation of the GET request is defined in the model method in /js/script.js:

/js/script.js

loadVerbs() {
    return fetch(this.verbsUrl)
        .then(res => res.json())
        .then(verbs => {
            this.verbs = verbs;
            this.statistics.loaded = verbs.length;
            return verbs;
        })
        .catch(error => { throw new Error(error) });/* { (===) or return Promise.reject(error) } */
}

Purposes:

  • When I started learning English irregular verbs, I had paper and a pen. I also wanted to practice writing programs with the MVC pattern, and automate the process of learning verbs already without paper and pen -). This is how this small but very useful program arose.

  • Learning the basics of the MVC design patterns:

    • Model - manages the data of an application
    • View - a visual representation of the model
    • Controller - links the user and the system
  • Practical application of the topics such as:

    • Java Script:
      • regular expressions
        • creating a RegExp object: literal notation and using a constructor
        • regexp.test(str) method
      • promises
        • promise API: Promise.all
        • async/await
      • working with API using Fetch
        • simple GET request
      • loss of this value
        • using the Function.prototype.bind method
      • creating objects with java script classes
      • form validation
      • work with DOM
    • Layout:
      • responsive/adaptive UI design
      • desktop-first media queries
      • CSS Flexbox/Grid
      • naming classes according to BEM methodology

Languages:

  • JavaScript
  • HTML
  • CSS

Design pattern:

  • MVC

Features:

  • responsive/adaptive UI design
  • storing verbs in json file
  • statistics on answers and loaded verbs
  • user input validation

Thanks:

Author:

Yaroslav Bondar

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.