Giter Club home page Giter Club logo

design-patterns-java's Introduction

Design Patterns in Java

This repository is part of the Refactoring.Guru project.

It contains Java examples for all classic GoF design patterns.

Requirements

The examples were written in Java 8, but also tested in Java 9.

For the best experience, we recommend working with examples in IntelliJ IDEA. The Community Edition of IDE is available for free (https://www.jetbrains.com/idea/download/).

After downloading or cloning this repository to your computer, import its root directory into a New project:

  • Either through start dialog: Select "Import Project" option and skip through the rest of the steps.

  • Or via the main menu: File > New > Project from Existing Sources...

After importing the project, you will be able to run examples by right-clicking "Demo" files inside every example and selecting the "Run" command from the context menu.

Roadmap

  • Add detailed comments all classes.
  • Add structure-only examples.

Contributor's Guide

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

Here's a style guide which might help you to keep your changes consistent with our code:

  1. All code should meet the Google Java 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. Examples should match following package convention: refactoring_guru.{pattern}.{example_name}. Example:

    package refactoring_guru.factory_method.ui_example.buttons;
    
    class Button {
    ...
  4. Places classes into separate files.

  5. Group classes into sub-packages. It helps people to understand dependencies of a class by glancing over its imports. Example:

    package refactoring_guru.factory_method.example.buttons;
    
    class Button {
    ...
    package refactoring_guru.factory_method.example.factories;
    
    import Button;
    
    class Factory {
    ...
  6. 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.
     */

    Don't be scared and ignore the non-English part of such comments. If you want to change something in a comment like this, then 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: Bohdan Herashchenko (@b1ger) and Alexander Shvets (@neochief)

design-patterns-java's People

Contributors

neochief avatar oleh-liskovych avatar evinracher avatar lex111 avatar

Watchers

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