Skip to content

01. How to contribute

Ilkka Seppälä edited this page Nov 13, 2021 · 61 revisions

First, check our issue tracker to find something interesting to do. Issues with label help wanted are the ones where we need assistance. Of course, you may have detected something we don't know yet, so feel free to raise your own issue. If you are a first-time contributor, it's probably best to start with something easy - so look for issues with label good first issue.

New Pattern

To work on a new pattern you need to do the following steps:

  1. If there is no issue with the new pattern yet, raise a new issue. Comment on the issue that you are working on so that others don't start working on the same thing. You are encouraged to present your implementation idea so others can participate in the design phase and help. Read through the pages in this Wiki to better understand what is required from the implementation. Ensure that the code conforms with the technology selections. Familiarize yourself with some of the existing pattern implementations to deepen your understanding.
  2. Fork the repository.
  3. Create a new folder for the pattern. The rough structure of the new folder would be as follows:
    • etc (every resource related to the pattern, like diagrams)
    • src (the source code of the pattern)
    • README.md (the description of the pattern)
    • pom.xml (the Maven project file)
  4. Implement the code changes in your fork. Remember to add sufficient comments documenting the implementation. Reference the issue id e.g. #52 in your commit messages.
  5. Format the code according to project Checkstyle configuration. The build fails if the code is not properly formatted. See coding conventions.
  6. Add a description of the pattern in pattern's README.md. All internal links must be relative to the pattern subdirectory or otherwise, the links don't link properly on the website. All code samples need to be annotated with correct language for the syntax highlighting to work e.g. ```java xxx ```
  7. The parent pom.xml is configured with urm-maven-plugin that automatically creates a class diagram for your pattern in the etc subfolder. To create a png out of this you can use locally installed PlantUML (see https://plantuml.com/running) or the online version http://plantuml.com/plantuml.
  8. Create a pull request. We use a checklist for reviewing new patterns. Check out the guidelines here..

Structure of the pattern's README.md file

--- # this is so-called 'YAML front matter', read up on it here: http://jekyllrb.com/docs/frontmatter/
layout: pattern # layout must always be `pattern`
title: Best Pattern Ever # the properly formatted title
folder: best-pattern-ever # the folder name in which this pattern lies
permalink: /patterns/best-pattern-ever/ # the permalink to the pattern, to keep this uniform please stick to /patterns/FOLDER/
categories: 
 - creational # usable categories and tags are listed here: https://github.com/iluwatar/java-design-patterns/wiki/07.-Categories-and-Tags
language: en # Provide the language in which the pattern is done. Mostly it is in English, so we would put *en* over here.
tags:
 - awesome # usable categories and tags are listed here: https://github.com/iluwatar/java-design-patterns/wiki/07.-Categories-and-Tags
---

## Name / classification

## Also known as

## Intent

## Explanation

## Class diagram

## Applicability

## Tutorials

## Known uses

## Consequences

## Related patterns

## Credits

What do the different sections mean is described on page Pattern template

How to add a new category or tag is described on page Categories and Tags

Non-pattern Issue

To work on one of the non-pattern issues you need to do the following steps:

  1. Check that the issue has help wanted label
  2. Comment on the issue that you are working on it so that other's don't work on the same thing
  3. Fork the repository.
  4. Implement the code changes in your fork. Remember to add sufficient comments documenting the implementation. Reference the issue id e.g. #52 in your commit messages.
  5. Create a pull request.