Giter VIP home page Giter VIP logo

tic-tac-toe's Introduction

Tic-Tac-Toe

Tic-Tac-Toe Project taken from The Odin Project. See Demo Here

Factory Functions

"JavaScript provides a much richer set of code reuse patterns. It can ape the classical pattern, but it also supports other patterns that are more expressive. The set of possible inheritance patterns in JavaScript is vast."

Something that i copy and pasted from Douglas Crockford's JavaScript The Good Parts that does a little introduction to the topic referenced in the title because the factory pattern is just another way for creating objects in JavaScript. They're just functions that return objects when they're called. The factory pattern takes advantages of closures in order to simulate privacy, wich cannot be achieved with differential inheritance.

So inside a function we can create variables and other functions and then return and object whose properties and methods will be the variables and functions defined in the body of the first function that we want to export, so the variables and functions that were not returned will be private data and the returned will be accesible from outside the function, thus creating objects with private and public properties.

In this project i used cloning for creating the players, knowing this after reading Eric Elliott's article.

Modular JavaScript

The best part of this project was to learn and apply the essential concepts of modular javascript. Scope and closures, private and public scope, modules and dependencies, structure design, Immediately Invoked Function Expressions, the revealing module pattern and the PubSub Module. A source that really helped was LearnCode.academy Modular Javascript series.

PubSub Pattern

Also seen in the LearnCode.academy Modular Javascript series, in the project this module helps update the game counter element and to display the winner of the match or if there was a draw. For a better understanding of this pattern Addy Osmani's Learning JavaScript Dessign Patterns and Stoyan Stefanov's JavaScript Pattern were very good resources. In Pages 171 to 172 of JavaScript Patterns are explained the 4 componentes of the pattern: The subcribers array and the subscribe, unsubscribe and publish methods.

tic-tac-toe's People

Contributors

newcastile avatar

Stargazers

 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.