Coder Social home page Coder Social logo

williamcorotan / design-patterns-typescript Goto Github PK

View Code? Open in Web Editor NEW

This project forked from refactoringguru/design-patterns-typescript

0.0 0.0 0.0 148 KB

Design Pattern Examples in TypeScript

Home Page: https://refactoring.guru/design-patterns/typescript

License: Other

TypeScript 100.00%

design-patterns-typescript's Introduction

Design Patterns in TypeScript

This repository is part of the Refactoring.Guru project.

It contains TypeScript examples for all classic GoF design patterns. Each pattern includes two examples:

  • Conceptual examples show the internal structure of patterns, including detailed comments.

  • RealWorld examples show how patterns can be used in real-world web applications.

Requirements

For simplicity reasons, the examples are console apps. In order to launch them, you have to install Node.js and NPM on your computer and then install TypeScript compiler and TypeScript Node extension like this:

npm install -g typescript
npm install -g ts-node

When you have all the required software installed, the examples can be launched via the command line as follows:

ts-node src/Path-to-example/Example.ts

For the best experience, I recommend working with examples with these IDEs:

Contributor's Guide

I appreciate any help, whether it's a simple fix of a typo or a whole new example. Just make a fork, make your change and submit a pull request.

Here's a style guide which might help you to keep your changes consistent with the rest of the project's code:

  1. All code should follow these two guidelines: Unofficial TypeScript StyleGuide and Airbnb JavaScript Style Guide.

  2. Try to hard wrap the code at 80th's character. It helps to list the code on the website without scrollbars.

  3. Example files should be located and named in the following manner:

    src/{PatternName}/{ExampleName}/index.ts
    
  4. Aim to put all code within one file. Yes, I realize that it's not how it supposed to be done in production. But it helps people to better understand examples, since all code fits into one screen.

  5. Comments may or may not have language tags in them, such as this:

    /**
     * EN: All products families have the same varieties (MacOS/Windows).
     *
     * This is a MacOS variant of a button.
     *
     * RU: Все семейства продуктов имеют одни и те же вариации (MacOS/Windows).
     *
     * Это вариант кнопки под MacOS.
     */

    This notation helps to keep the code in one place while allowing the website to generates separate versions of examples for all listed languages. Don't be scared and ignore the non-English part of such comments. If you want to change something in a comment like this, just do it. Even if you do it wrong, we'll tell you how to fix it during the Pull Request.

License

This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License.

Creative Commons License

Credits

Authors: Alexey Pyltsyn (@lex111) and Alexander Shvets (@neochief)

design-patterns-typescript's People

Contributors

lex111 avatar neochief avatar userbit avatar alfonsograziano avatar dependabot[bot] avatar pheetah 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.