- Notifications
You must be signed in to change notification settings - Fork0
Design Pattern Examples in Java
License
Java-Learning-Land/design-patterns-java
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
This repository is part of theRefactoring.Guru project.
It contains Java examples for all classic GoF design patterns.
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.
- Add detailed comments all classes.
- Add structure-only examples.
We appreciate any help, whether it's a simple fix of a typo or a whole new example. Justmake a fork, do your change and submit apull request.
Here's a style guide which might help you to keep your changes consistent with our code:
All code should meet theGoogle Java Style Guide
Try to hard wrap the code at 80th's character. It helps to list the code on the website without scrollbars.
Examples should match following package convention: refactoring_guru.{pattern}.{example_name}. Example:
packagerefactoring_guru.factory_method.ui_example.buttons;classButton {...
Places classes into separate files.
Group classes into sub-packages. It helps people to understand dependencies of a class by glancing over its imports. Example:
packagerefactoring_guru.factory_method.example.buttons;classButton {...
packagerefactoring_guru.factory_method.example.factories;importButton;classFactory {...
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.
This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License.
Authors: Bohdan Herashchenko (@b1ger) and Alexander Shvets (@neochief)
About
Design Pattern Examples in Java
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Releases
Packages0
Languages
- Java100.0%