Skip to content

Commit

Permalink
doc: improve documentation of the project
Browse files Browse the repository at this point in the history
  • Loading branch information
akadir committed Sep 13, 2020
1 parent e0c6cd7 commit cd23fa7
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 2 deletions.
Binary file added .documents/uml-diagram.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
74 changes: 72 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
<div align="center">
<!-- last commit-->
<a href="https://github.com/akadir/case-study/commits" title="Last Commit">
<img src="https://img.shields.io/github/last-commit/akadir/case-study?style=flat">
<img src="https://img.shields.io/github/last-commit/akadir/case-study?style=flat"
alt="Last commit">
</a>

<!-- Code Quality -->
Expand Down Expand Up @@ -40,6 +41,18 @@
<a href="https://github.com/akadir/case-study/actions">
<img src="https://github.com/akadir/case-study/workflows/push%20docker%20image/badge.svg"
alt="Code Quality Check" />
</a>

<!-- Docker image size -->
<a href="https://hub.docker.com/r/akarakoc/case-study/tags">
<img src="https://img.shields.io/docker/image-size/akarakoc/case-study"
alt="Code Quality Check" />
</a>

<!-- Docker image version -->
<a href="https://hub.docker.com/r/akarakoc/case-study/tags">
<img src="https://img.shields.io/docker/v/akarakoc/case-study?label=image%20version"
alt="Code Quality Check" />
</a>

<!-- Quality Gate Status -->
Expand Down Expand Up @@ -67,8 +80,65 @@
</a>
</div>

## Built with the Help of
# Content

* [Run](#run)
* [Using Maven](#using-maven)
* [Using Docker](#using-docker)
* [UML class diagram](#uml-class-diagram)
* [Applied Design Patterns](#applied-design-patterns)
* [Pipeline Definitions](#pipeline-definitions)
* [Used Tools, Frameworks, Libraries etc.](#developed-with-the-help-of)

## Run

### Using Maven

Make sure you have maven installed on your system.

```sh
git clone https://github.com/akadir/case-study.git
cd case-study
mvn package -DskipTests
java -jar target/case-study.jar
```

### Using Docker

Pull the latest image from [docker-hub](https://hub.docker.com/) and then run it.

```
docker pull akarakoc/case-study:1.0
docker run akarakoc/case-study:1.0
```

## UML class diagram

[![uml-diagram](.documents/uml-diagram.png)](.documents/uml-diagram.png)

## Applied Design Patterns

- [Chain of Responsibility](https://refactoring.guru/design-patterns/chain-of-responsibility): To validate products added into cart.
This pattern, makes it easy to extend and re-configure validation phase. [CartEventValidator](./src/main/java/io/github/akadir/casestudy/shopping/validator/CartEventValidator.java)
- [Strategy Pattern](https://refactoring.guru/design-patterns/strategy): Delivery cost calculation algorithms can changed in time frequently.
Using this pattern makes it easy to adapt this algorithm changes. [DeliveryStrategy](./src/main/java/io/github/akadir/casestudy/delivery/strategy/DeliveryStrategy.java)
- [Null Object Pattern](https://en.wikipedia.org/wiki/Null_object_pattern): In the initial phase of the [ShoppingCart](./src/main/java/io/github/akadir/casestudy/shopping/model/ShoppingCart.java#L18) DeliveryStrategy is not set yet.
This may lead to a NullPointerException. To prevent this from occurring, [None](./src/main/java/io/github/akadir/casestudy/delivery/strategy/None.java) DeliveryStrategy is implemented.

## Pipeline Definitions

All action logs can be seen from [this link](https://github.com/akadir/case-study/actions)
and action definitions are in [this folder](./.github)

- Every push that contains change in specific folders and/or files triggers two actions, build, and code quality.
- Build Action builds source code on 3 different Operating Systems[Ubuntu, MacOS, Windows] using 3 different java versions[8, 11, 14].

- Every tagged push event triggers the [docker](https://github.com/akadir/case-study/actions?query=workflow%3A%22push+docker+image%22)
workflow and this workflow builds artifacts then push the docker image to the [docker hub](https://hub.docker.com/r/akarakoc/case-study/tags)

## Developed with the Help of

* [IntelliJ IDEA](https://www.jetbrains.com/idea/) - Development environment
* [maven](https://maven.apache.org/) - Build automation and dependency management tool.
* [logback](http://logback.qos.ch/) - Logging library that implements SLF4J API
* [mockito](https://site.mockito.org/) - Testing framework to mock objects.
Expand Down

0 comments on commit cd23fa7

Please sign in to comment.