├── python
├── app
│ └── __init__.py
├── db
│ ├── __init__.py
│ └── db_factory.py
├── db2
│ ├── __init__.py
│ └── db.py
├── tests
│ ├── __init__.py
│ └── test_db.py
├── requirements.txt
└── .gitignore
├── csharp
├── .vscode
│ └── settings.json
├── Bookshelf
│ ├── Bookshelf.cs
│ ├── Bookshelf.csproj
│ ├── Db2
│ │ └── Db.cs
│ └── Db
│ │ └── DbFactory.cs
├── Bookshelf.Tests
│ ├── Bookshelf.Tests.csproj
│ └── DbTest.cs
├── csharp.sln
└── .gitignore
├── java
├── src
│ ├── main
│ │ └── java
│ │ │ ├── db
│ │ │ ├── DONT_CHANGE_THIS
│ │ │ ├── DbFactory.java
│ │ │ └── Db.java
│ │ │ └── db2
│ │ │ ├── DONT_CHANGE_THIS
│ │ │ └── Db.java
│ └── test
│ │ └── java
│ │ └── Hello_World_Test.java
├── .gitignore
└── pom.xml
├── javascript
├── src
│ ├── db
│ │ ├── DONT_CHANGE_THIS
│ │ └── db.js
│ └── db2
│ │ ├── DONT_CHANGE_THIS
│ │ └── db.js
├── .babelrc
├── test-setup.js
├── package.json
├── test
│ └── db.test.js
└── .gitignore
├── typescript
├── src
│ ├── db
│ │ ├── DONT_CHANGE_THIS
│ │ └── db.ts
│ └── db2
│ │ ├── DONT_CHANGE_THIS
│ │ └── db.ts
├── test
│ ├── test.ts
│ └── db.test.ts
├── package.json
├── tsconfig.json
└── .gitignore
├── .gitignore
├── ideas.md
├── LICENSE
└── README.md
/python/app/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/python/db/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/python/db2/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/python/tests/__init__.py:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/csharp/.vscode/settings.json:
--------------------------------------------------------------------------------
1 | {
2 | }
--------------------------------------------------------------------------------
/java/src/main/java/db/DONT_CHANGE_THIS:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/javascript/src/db/DONT_CHANGE_THIS:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/javascript/src/db2/DONT_CHANGE_THIS:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/typescript/src/db/DONT_CHANGE_THIS:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/typescript/src/db2/DONT_CHANGE_THIS:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/java/src/main/java/db2/DONT_CHANGE_THIS:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/javascript/.babelrc:
--------------------------------------------------------------------------------
1 | {
2 | "presets": [
3 | "es2015"
4 | ]
5 | }
--------------------------------------------------------------------------------
/python/requirements.txt:
--------------------------------------------------------------------------------
1 | pytest
2 | pytest-cov
3 | pytest-mock==3.3.1
4 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | bin
2 | obj
3 | *.sln.DotSettings.user
4 | .vs
5 | vendor
6 | .idea
7 | *.iml
8 |
--------------------------------------------------------------------------------
/csharp/Bookshelf/Bookshelf.cs:
--------------------------------------------------------------------------------
1 | namespace Bookshelf
2 | {
3 | public class Bookshelf
4 | {
5 |
6 | }
7 | }
--------------------------------------------------------------------------------
/typescript/test/test.ts:
--------------------------------------------------------------------------------
1 | import {expect} from 'chai'
2 | import 'mocha'
3 |
4 | describe('World', () => {
5 | it('is Red', () => {
6 | expect('foo').to.equal('bar')
7 | })
8 | })
9 |
--------------------------------------------------------------------------------
/java/.gitignore:
--------------------------------------------------------------------------------
1 | # Idea
2 | .idea
3 | *.iml
4 |
5 | # Maven
6 | target
7 |
8 | # Gradle
9 | .gradle
10 | build
11 |
12 | # Eclipse
13 | .project
14 | .classpath
15 | .settings
16 | .pmd
17 |
--------------------------------------------------------------------------------
/csharp/Bookshelf/Bookshelf.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net6.0
5 | enable
6 | enable
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/java/src/main/java/db/DbFactory.java:
--------------------------------------------------------------------------------
1 | package db;
2 |
3 | /**
4 | * This is an external library you don't own.
5 | * You are not allowed to change it.
6 | */
7 | public class DbFactory {
8 |
9 | private static final DbFactory instance = new DbFactory();
10 |
11 | public static DbFactory getInstance() {
12 | return instance;
13 | }
14 |
15 | public Db startDb(Class clazz) {
16 | return new Db();
17 | }
18 |
19 | }
20 |
--------------------------------------------------------------------------------
/ideas.md:
--------------------------------------------------------------------------------
1 | Bring in an ISBN, and a feature to find books by ISBN.
2 | Db2 could add such a findById feature, and then the question is were did you put the filtering logic?
3 | Inside the Repository implementation? Then it should be easy to migrate and unse the new findById feature.
4 | However, if you did put the filtering in your business logic, it will be a little harder as you have to change the contract
5 |
6 | Would bring new possible Constraints:
7 | - No Nulls
8 | - Selfvalidating Objects
9 |
--------------------------------------------------------------------------------
/java/src/test/java/Hello_World_Test.java:
--------------------------------------------------------------------------------
1 | import org.junit.jupiter.api.DisplayNameGeneration;
2 | import org.junit.jupiter.api.DisplayNameGenerator;
3 | import org.junit.jupiter.api.Test;
4 |
5 | import static org.assertj.core.api.Assertions.assertThat;
6 |
7 | @DisplayNameGeneration(DisplayNameGenerator.ReplaceUnderscores.class)
8 | public class Hello_World_Test {
9 |
10 | @Test
11 | void hello_world() {
12 | assertThat("foo").isEqualTo("hello world");
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/python/db2/db.py:
--------------------------------------------------------------------------------
1 | import time
2 |
3 |
4 | class Db:
5 |
6 | __objects = []
7 |
8 | def __init__(self):
9 | time.sleep(2)
10 |
11 | def save(self, thing):
12 | time.sleep(0.5)
13 | self.__objects.append(thing)
14 |
15 | def find_all(self):
16 | time.sleep(0.5)
17 | return self.__objects
18 |
19 | def count(self):
20 | time.sleep(0.5)
21 | return len(self.__objects)
22 |
23 | def clear(self):
24 | self.__objects.clear()
--------------------------------------------------------------------------------
/javascript/test-setup.js:
--------------------------------------------------------------------------------
1 | // needed for regenerator-runtime
2 | import 'babel-polyfill';
3 |
4 | import chai, { expect } from 'chai';
5 | import sinon from 'sinon';
6 | import sinonChai from 'sinon-chai';
7 |
8 | chai.use(sinonChai);
9 |
10 | /*
11 | ** Disable truncate for expected and actual values in assertions.
12 | ** Remove this line to reset to the default of 40 if the objects
13 | ** printed are too big.
14 | */
15 | chai.config.truncateThreshold = 0;
16 |
17 | global.expect = expect;
18 | global.sinon = sinon;
--------------------------------------------------------------------------------
/javascript/src/db2/db.js:
--------------------------------------------------------------------------------
1 | "use strict"
2 |
3 | export default class Db {
4 | constructor() {
5 | this.objects = [];
6 | }
7 |
8 | async save(object) {
9 | await sleep(500);
10 | this.objects.push(object);
11 | }
12 |
13 | async findAll() {
14 | await sleep(500);
15 | return this.objects;
16 | }
17 |
18 | async count() {
19 | await sleep(500);
20 | return this.objects.length;
21 | }
22 |
23 | clear() {
24 | this.objects = [];
25 | }
26 | }
27 |
28 | function sleep(milliseconds) {
29 | return new Promise(resolve => setTimeout(resolve, milliseconds));
30 | }
31 |
--------------------------------------------------------------------------------
/typescript/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "typescript",
3 | "version": "1.0.0",
4 | "description": "",
5 | "main": "index.js",
6 | "scripts": {
7 | "test": "mocha -r ts-node/register \"test/**/*.ts\"",
8 | "test:watch": "mocha -r ts-node/register -R min -w --watch-files . \"test/**/*.ts\""
9 | },
10 | "keywords": [],
11 | "author": "",
12 | "license": "ISC",
13 | "dependencies": {
14 | "@types/chai": "^4.3.0",
15 | "@types/mocha": "^9.1.0",
16 | "@types/node": "^17.0.15",
17 | "chai": "^4.3.6",
18 | "mocha": "^9.2.0",
19 | "nyc": "^15.1.0",
20 | "ts-node": "^10.4.0",
21 | "typescript": "^4.5.5"
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/typescript/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compileOnSave": true,
3 | "compilerOptions": {
4 | // see https://www.typescriptlang.org/docs/handbook/compiler-options.html
5 | "target": "es5",
6 | "lib": [
7 | "esnext"
8 | ],
9 | "module": "commonjs",
10 | "sourceMap": true,
11 | "outDir": "./dist/",
12 | "noEmitOnError": true,
13 | "strict": true,
14 | "noImplicitReturns": true,
15 | "forceConsistentCasingInFileNames": false,
16 | "downlevelIteration": true,
17 | "experimentalDecorators": true,
18 | },
19 | "include": [
20 | "src/**/*",
21 | "test/**/*.ts",
22 | ],
23 | "exclude": [
24 | "node_modules",
25 | "dist",
26 | ]
27 | }
--------------------------------------------------------------------------------
/javascript/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "javascript",
3 | "version": "1.0.0",
4 | "description": "",
5 | "main": "index.js",
6 | "scripts": {
7 | "test": "mocha --require babel-core/register --require test-setup.js --require babel-polyfill",
8 | "test:watch": "npm run test -- --watch -R min"
9 | },
10 | "keywords": [],
11 | "author": "",
12 | "license": "ISC",
13 | "devDependencies": {
14 | "babel-core": "6.26.3",
15 | "babel-plugin-rewire": "1.2.0",
16 | "babel-polyfill": "6.26.0",
17 | "babel-preset-es2015": "6.24.1",
18 | "babel-preset-stage-0": "6.24.1",
19 | "chai": "4.2.0",
20 | "mocha": "6.2.2",
21 | "sinon": "7.5.0",
22 | "sinon-chai": "3.3.0"
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/typescript/src/db2/db.ts:
--------------------------------------------------------------------------------
1 | export default class Db {
2 |
3 | private objects: any[]
4 |
5 | constructor() {
6 | this.objects = [];
7 | }
8 |
9 | async save(object: any) {
10 | await sleep(500);
11 | this.objects.push(object);
12 | }
13 |
14 | async findAll(): Promise {
15 | await sleep(500);
16 | return this.objects;
17 | }
18 |
19 | async count(): Promise {
20 | await sleep(500);
21 | return this.objects.length;
22 | }
23 |
24 | clear() {
25 | this.objects = [];
26 | }
27 | }
28 |
29 | function sleep(milliseconds: number) {
30 | return new Promise(resolve => setTimeout(resolve, milliseconds));
31 | }
32 |
--------------------------------------------------------------------------------
/javascript/src/db/db.js:
--------------------------------------------------------------------------------
1 | "use strict"
2 |
3 | export default class DbFactory {
4 | constructor() {
5 | if (DbFactory._instance) {
6 | return DbFactory._instance
7 | }
8 | DbFactory._instance = this;
9 | }
10 |
11 | async startDb() {
12 | await sleep(7000);
13 | return new Db();
14 | }
15 | }
16 |
17 | class Db {
18 | constructor() {
19 | this.objects = [];
20 | }
21 |
22 | async persist(object) {
23 | await sleep(3000);
24 | this.objects.push(object);
25 | }
26 |
27 | async findAll() {
28 | await sleep(3000);
29 | return this.objects;
30 | }
31 |
32 | clear() {
33 | this.objects = [];
34 | }
35 | }
36 |
37 | function sleep(milliseconds) {
38 | return new Promise(resolve => setTimeout(resolve, milliseconds));
39 | }
40 |
--------------------------------------------------------------------------------
/csharp/Bookshelf/Db2/Db.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.Threading;
3 |
4 | namespace Bookshelf.Db2
5 | {
6 |
7 | public class Db
8 | {
9 |
10 | private readonly List _objects = new();
11 |
12 | public Db()
13 | {
14 | Thread.Sleep(2000);
15 | }
16 |
17 | public void Save(T persistable)
18 | {
19 | Thread.Sleep(500);
20 | _objects.Add(persistable);
21 | }
22 |
23 | public List FindAll()
24 | {
25 | Thread.Sleep(500);
26 | return _objects;
27 | }
28 |
29 | public int Count()
30 | {
31 | Thread.Sleep(500);
32 | return _objects.Count;
33 | }
34 |
35 | public void Clear()
36 | {
37 | _objects.Clear();
38 | }
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/java/src/main/java/db/Db.java:
--------------------------------------------------------------------------------
1 | package db;
2 |
3 | import java.util.ArrayList;
4 | import java.util.List;
5 |
6 | /**
7 | * This is an external library you don't own.
8 | * You are not allowed to change it.
9 | */
10 | public class Db {
11 | private final List objects = new ArrayList<>();
12 |
13 | Db() {
14 | sleepSilently(7000);
15 | }
16 |
17 | public void persist(T object) {
18 | sleepSilently(3000);
19 | objects.add(object);
20 | }
21 |
22 | public List findAll() {
23 | sleepSilently(3000);
24 | return objects;
25 | }
26 |
27 | public void clear() {
28 | objects.clear();
29 | }
30 |
31 | private static void sleepSilently(int millis) {
32 | try {
33 | Thread.sleep(millis);
34 | } catch (InterruptedException ignored) {
35 | }
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/python/db/db_factory.py:
--------------------------------------------------------------------------------
1 | import time
2 |
3 |
4 | class DbFactory:
5 | __instance = None
6 |
7 | @classmethod
8 | def get_instance(cls):
9 | if cls.__instance is None:
10 | cls.__instance = DbFactory()
11 | return cls.__instance
12 |
13 | def start_db(self):
14 | tmp = DbFactory.Db.__init__
15 | DbFactory.Db.__init__ = lambda *args, **kwargs: None
16 | ret = DbFactory.Db()
17 | DbFactory.Db.__init__ = tmp
18 | time.sleep(3)
19 | return ret
20 |
21 | class Db:
22 | __objects = []
23 |
24 | def __init__(self):
25 | raise TypeError("Use DbFactory!")
26 |
27 | def persist(self, thing):
28 | time.sleep(3)
29 | self.__objects.append(thing)
30 |
31 | def find_all(self):
32 | time.sleep(3)
33 | return self.__objects
34 |
35 | def clear(self):
36 | self.__objects.clear()
37 |
--------------------------------------------------------------------------------
/typescript/src/db/db.ts:
--------------------------------------------------------------------------------
1 | export default class DbFactory {
2 |
3 | private static _instance: DbFactory;
4 |
5 | constructor() {
6 | if (DbFactory._instance) {
7 | return DbFactory._instance
8 | }
9 | DbFactory._instance = this;
10 | }
11 |
12 | async startDb(): Promise {
13 | await sleep(7000);
14 | return new Db();
15 | }
16 | }
17 |
18 | class Db {
19 |
20 | private objects: any[]
21 |
22 | constructor() {
23 | this.objects = [];
24 | }
25 |
26 | async persist(object: any) {
27 | await sleep(3000);
28 | this.objects.push(object);
29 | }
30 |
31 | async findAll(): Promise {
32 | await sleep(3000);
33 | return this.objects;
34 | }
35 |
36 | clear() {
37 | this.objects = [];
38 | }
39 | }
40 |
41 | function sleep(milliseconds: number) {
42 | return new Promise(resolve => setTimeout(resolve, milliseconds));
43 | }
44 |
--------------------------------------------------------------------------------
/java/src/main/java/db2/Db.java:
--------------------------------------------------------------------------------
1 | package db2;
2 |
3 | import java.util.ArrayList;
4 | import java.util.List;
5 |
6 | /**
7 | * This is an external library you don't own.
8 | * You are not allowed to change it.
9 | */
10 | public class Db {
11 | private final List objects = new ArrayList<>();
12 |
13 | public Db() {
14 | sleepSilently(2000);
15 | }
16 |
17 | public void save(T object) {
18 | sleepSilently(500);
19 | objects.add(object);
20 | }
21 |
22 | public List findAll() {
23 | sleepSilently(500);
24 | return objects;
25 | }
26 |
27 | public int count() {
28 | sleepSilently(500);
29 | return objects.size();
30 | }
31 |
32 | public void clear() {
33 | objects.clear();
34 | }
35 |
36 | private static void sleepSilently(int millis) {
37 | try {
38 | Thread.sleep(millis);
39 | } catch (InterruptedException ignored) {
40 | }
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/python/tests/test_db.py:
--------------------------------------------------------------------------------
1 | import pytest
2 |
3 | from db.db_factory import DbFactory
4 | from db2.db import Db
5 |
6 |
7 | @pytest.mark.skip(reason="dont bother the kata solver")
8 | def test_db1():
9 | db_factory = DbFactory.get_instance()
10 | db = db_factory.start_db()
11 | assert db.find_all() == []
12 |
13 | db.persist("thing")
14 | assert db.find_all() == ["thing"]
15 |
16 | db.persist("another thing")
17 | assert db.find_all() == ["thing", "another thing"]
18 |
19 | db.clear()
20 | assert db.find_all() == []
21 |
22 |
23 | @pytest.mark.skip(reason="dont bother the kata solver")
24 | def test_db2():
25 | db = Db()
26 | assert db.find_all() == []
27 | assert db.count() == 0
28 |
29 | db.save("thing")
30 | assert db.find_all() == ["thing"]
31 | assert db.count() == 1
32 |
33 | db.save("another thing")
34 | assert db.find_all() == ["thing", "another thing"]
35 | assert db.count() == 2
36 |
37 | db.clear()
38 | assert db.find_all() == []
39 | assert db.count() == 0
40 |
--------------------------------------------------------------------------------
/javascript/test/db.test.js:
--------------------------------------------------------------------------------
1 | import DbFactory from "../src/db/db";
2 | import Db from "../src/db2/db"
3 |
4 | xdescribe('Db', function() {
5 | it('v1', async function () {
6 | this.timeout(20000); // mocha default timeout is 2000 ms
7 | let db = await new DbFactory().startDb();
8 | expect(await db.findAll()).to.be.empty;
9 |
10 | await db.persist("hello");
11 | expect(await db.findAll()).to.contain("hello");
12 |
13 | db.clear();
14 | expect(await db.findAll()).to.be.empty;
15 | })
16 |
17 | it('v2', async function () {
18 | this.timeout(20000); // mocha default timeout is 2000 ms
19 | let db = new Db();
20 | expect(await db.findAll()).to.be.empty;
21 | expect(await db.count()).to.equal(0);
22 |
23 | await db.save("hello");
24 | expect(await db.findAll()).to.contain("hello");
25 | expect(await db.count()).to.equal(1);
26 |
27 | db.clear();
28 | expect(await db.findAll()).to.be.empty;
29 | expect(await db.count()).to.equal(0);
30 | })
31 | });
32 |
--------------------------------------------------------------------------------
/typescript/test/db.test.ts:
--------------------------------------------------------------------------------
1 | import {expect} from 'chai'
2 | import DbFactory from "../src/db/db";
3 | import Db from "../src/db2/db"
4 |
5 | xdescribe('Db', function() {
6 | it('v1', async function () {
7 | this.timeout(20000); // mocha default timeout is 2000 ms
8 | let db = await new DbFactory().startDb();
9 | expect(await db.findAll()).to.be.empty;
10 |
11 | await db.persist("hello");
12 | expect(await db.findAll()).to.contain("hello");
13 |
14 | db.clear();
15 | expect(await db.findAll()).to.be.empty;
16 | })
17 |
18 | it('v2', async function () {
19 | this.timeout(20000); // mocha default timeout is 2000 ms
20 | let db = new Db();
21 | expect(await db.findAll()).to.be.empty;
22 | expect(await db.count()).to.equal(0);
23 |
24 | await db.save("hello");
25 | expect(await db.findAll()).to.contain("hello");
26 | expect(await db.count()).to.equal(1);
27 |
28 | db.clear();
29 | expect(await db.findAll()).to.be.empty;
30 | expect(await db.count()).to.equal(0);
31 | })
32 | });
33 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2021 Gregor Riegler
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/csharp/Bookshelf.Tests/Bookshelf.Tests.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net6.0
5 | enable
6 |
7 | false
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 | runtime; build; native; contentfiles; analyzers; buildtransitive
17 | all
18 |
19 |
20 | runtime; build; native; contentfiles; analyzers; buildtransitive
21 | all
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
--------------------------------------------------------------------------------
/csharp/Bookshelf/Db/DbFactory.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.Threading;
3 |
4 | namespace Bookshelf.Db
5 | {
6 | public class DbFactory
7 | {
8 | private static readonly DbFactory Instance = new();
9 |
10 | public static DbFactory GetInstance()
11 | {
12 | return Instance;
13 | }
14 |
15 | private DbFactory()
16 | {
17 | }
18 |
19 | public Db startDb() {
20 | return new();
21 | }
22 |
23 | public class Db
24 | {
25 | private readonly List _objects = new();
26 |
27 | protected internal Db()
28 | {
29 | Thread.Sleep(7000);
30 | }
31 |
32 | public void Persist(T persistable)
33 | {
34 | Thread.Sleep(3000);
35 | _objects.Add(persistable);
36 | }
37 |
38 | public List FindAll()
39 | {
40 | Thread.Sleep(3000);
41 | return _objects;
42 | }
43 |
44 | public void Clear()
45 | {
46 | _objects.Clear();
47 | }
48 | }
49 | }
50 | }
--------------------------------------------------------------------------------
/csharp/Bookshelf.Tests/DbTest.cs:
--------------------------------------------------------------------------------
1 | using FluentAssertions;
2 | using Xunit;
3 | using Bookshelf.Db;
4 | using Bookshelf.Db2;
5 |
6 | namespace Bookshelf.Tests
7 | {
8 |
9 | public class DbTest
10 | {
11 | [Fact (Skip="dont bother the kata solver")]
12 | public void DbWorks()
13 | {
14 | var dbFactory = DbFactory.GetInstance();
15 | var db = dbFactory.startDb();
16 | db.FindAll().Should().BeEmpty();
17 |
18 | db.Persist("test");
19 | db.FindAll().Should().Equal("test");
20 |
21 | db.Persist("another");
22 | db.FindAll().Should().Equal("test", "another");
23 |
24 | db.Clear();
25 | db.FindAll().Should().BeEmpty();
26 | }
27 |
28 | [Fact (Skip="dont bother the kata solver")]
29 | public void Db2Works()
30 | {
31 | var db = new Db();
32 | db.FindAll().Should().BeEmpty();
33 |
34 | db.Save("test");
35 | db.FindAll().Should().Equal("test");
36 |
37 | db.Save("another");
38 | db.FindAll().Should().Equal("test", "another");
39 |
40 | db.Clear();
41 | db.FindAll().Should().BeEmpty();
42 | }
43 | }
44 | }
--------------------------------------------------------------------------------
/csharp/csharp.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio Version 16
4 | VisualStudioVersion = 16.0.30114.105
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Bookshelf", "Bookshelf\Bookshelf.csproj", "{509700DF-2753-4877-A171-4B974DB0B50C}"
7 | EndProject
8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Bookshelf.Tests", "Bookshelf.Tests\Bookshelf.Tests.csproj", "{F182010F-6723-45BD-8AB0-7AF98D013252}"
9 | EndProject
10 | Global
11 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
12 | Debug|Any CPU = Debug|Any CPU
13 | Release|Any CPU = Release|Any CPU
14 | EndGlobalSection
15 | GlobalSection(SolutionProperties) = preSolution
16 | HideSolutionNode = FALSE
17 | EndGlobalSection
18 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
19 | {509700DF-2753-4877-A171-4B974DB0B50C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
20 | {509700DF-2753-4877-A171-4B974DB0B50C}.Debug|Any CPU.Build.0 = Debug|Any CPU
21 | {509700DF-2753-4877-A171-4B974DB0B50C}.Release|Any CPU.ActiveCfg = Release|Any CPU
22 | {509700DF-2753-4877-A171-4B974DB0B50C}.Release|Any CPU.Build.0 = Release|Any CPU
23 | {F182010F-6723-45BD-8AB0-7AF98D013252}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
24 | {F182010F-6723-45BD-8AB0-7AF98D013252}.Debug|Any CPU.Build.0 = Debug|Any CPU
25 | {F182010F-6723-45BD-8AB0-7AF98D013252}.Release|Any CPU.ActiveCfg = Release|Any CPU
26 | {F182010F-6723-45BD-8AB0-7AF98D013252}.Release|Any CPU.Build.0 = Release|Any CPU
27 | EndGlobalSection
28 | EndGlobal
29 |
--------------------------------------------------------------------------------
/java/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 | 4.0.0
5 |
6 | com.gregorriegler
7 | book-shelve-kata
8 | 1.0-SNAPSHOT
9 | jar
10 |
11 |
12 | UTF-8
13 | 11
14 | ${java.version}
15 | ${java.version}
16 | 5.6.2
17 |
18 |
19 |
20 |
21 | org.junit.jupiter
22 | junit-jupiter-api
23 | ${junit}
24 | test
25 |
26 |
27 | org.junit.jupiter
28 | junit-jupiter-engine
29 | ${junit}
30 | test
31 |
32 |
33 | org.junit.jupiter
34 | junit-jupiter-params
35 | ${junit}
36 | test
37 |
38 |
39 | org.assertj
40 | assertj-core
41 | 3.19.0
42 |
43 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Bookshelf Kata
2 |
3 | ## Introduction
4 | The purpose of this kata is to practice dealing with expensive and hard-to-test infrastructure at the outgoing side of an application (in this example, a database).
5 |
6 | ## Challenges
7 | - How could we develop this using mostly fast unit tests?
8 | - Do we have to use mocks in this case? What are the alternatives?
9 | - Can we make sure that we can easily and safely replace the database in the future?
10 | - How do we properly abstract and separate the code that is hard to test from the code that is easy to test?
11 | - And how do we design our tests, so that they assist future refactorings?
12 |
13 | ---
14 |
15 | Follow the steps one by one and do not read ahead.
16 |
17 | ### Step 1
18 | Program a Bookshelf that can **store books** and use the given database for it.
19 | For now, books should only have a title.
20 |
21 | There is a database library in the `db` package called `Db` and you don't own it, so you are not allowed to change it either.
22 | It is annoyingly slow!
23 | It is not necessary to create a UI, CLI, or any other complicated user facing interface for this.
24 |
25 | ### Step 2
26 | We would like to be able to skim the books we have added so far.
27 | Add a feature that allows us to retrieve all books that were stored on the Bookshelf.
28 |
29 | ### Step 3
30 | Let's add more spice to the Bookshelf.
31 | Mark every 10th book you add as an anniversary book.
32 |
33 | ### Step 4
34 | We really love our Bookshelf so far. We added so many books, we would like to celebrate that.
35 | Therefore, every 25th book we add should be marked as a golden anniversary book.
36 | Note that a book can be either an anniversary or a golden anniversary book, but not both.
37 |
38 | ### Step 5
39 | A new version of `Db` came out. It's much faster, but they renamed the persist function.
40 | And it has a new feature where you can get the count of stored objects.
41 | This should help with the anniversary features.
42 | Migrate to the new version, it's located in the `db2` package.
43 |
44 |
45 | ## Links for further inspiration (Theory, Patterns, Principles)
46 |
47 | - [Repository Pattern](https://martinfowler.com/eaaCatalog/repository.html)
48 | - [Fake](https://martinfowler.com/bliki/TestDouble.html)
49 | - [Logic Sandwich](http://www.jamesshore.com/v2/blog/2018/testing-without-mocks#logic-sandwich)
50 | - [Dependency Inversion Principle](https://en.wikipedia.org/wiki/Dependency_inversion_principle)
51 | - [Abstract Contract Test](https://blog.thecodewhisperer.com/permalink/writing-contract-tests-in-java-differently)
52 | - [Abstract Test Cases, 20 Years later](https://blog.thecodewhisperer.com/permalink/abstract-test-cases-20-years-later)
53 | - [Hexagonal Architecture](https://alistair.cockburn.us/hexagonal-architecture/)
54 | - [DomainService vs ApplicationService in DDD](https://enterprisecraftsmanship.com/posts/domain-vs-application-services/)
55 |
--------------------------------------------------------------------------------
/python/.gitignore:
--------------------------------------------------------------------------------
1 | # Byte-compiled / optimized / DLL files
2 | __pycache__/
3 | *.py[cod]
4 | *$py.class
5 |
6 | # C extensions
7 | *.so
8 |
9 | # Distribution / packaging
10 | .Python
11 | build/
12 | develop-eggs/
13 | dist/
14 | downloads/
15 | eggs/
16 | .eggs/
17 | lib/
18 | lib64/
19 | parts/
20 | sdist/
21 | var/
22 | wheels/
23 | share/python-wheels/
24 | *.egg-info/
25 | .installed.cfg
26 | *.egg
27 | MANIFEST
28 |
29 | # PyInstaller
30 | # Usually these files are written by a python script from a template
31 | # before PyInstaller builds the exe, so as to inject date/other infos into it.
32 | *.manifest
33 | *.spec
34 |
35 | # Installer logs
36 | pip-log.txt
37 | pip-delete-this-directory.txt
38 |
39 | # Unit test / coverage reports
40 | htmlcov/
41 | .tox/
42 | .nox/
43 | .coverage
44 | .coverage.*
45 | .cache
46 | nosetests.xml
47 | coverage.xml
48 | *.cover
49 | *.py,cover
50 | .hypothesis/
51 | .pytest_cache/
52 | cover/
53 |
54 | # Translations
55 | *.mo
56 | *.pot
57 |
58 | # Django stuff:
59 | *.log
60 | local_settings.py
61 | db.sqlite3
62 | db.sqlite3-journal
63 |
64 | # Flask stuff:
65 | instance/
66 | .webassets-cache
67 |
68 | # Scrapy stuff:
69 | .scrapy
70 |
71 | # Sphinx documentation
72 | docs/_build/
73 |
74 | # PyBuilder
75 | .pybuilder/
76 | target/
77 |
78 | # Jupyter Notebook
79 | .ipynb_checkpoints
80 |
81 | # IPython
82 | profile_default/
83 | ipython_config.py
84 |
85 | # pyenv
86 | # For a library or package, you might want to ignore these files since the code is
87 | # intended to run in multiple environments; otherwise, check them in:
88 | # .python-version
89 |
90 | # pipenv
91 | # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
92 | # However, in case of collaboration, if having platform-specific dependencies or dependencies
93 | # having no cross-platform support, pipenv may install dependencies that don't work, or not
94 | # install all needed dependencies.
95 | #Pipfile.lock
96 |
97 | # poetry
98 | # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
99 | # This is especially recommended for binary packages to ensure reproducibility, and is more
100 | # commonly ignored for libraries.
101 | # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
102 | #poetry.lock
103 |
104 | # PEP 582; used by e.g. github.com/David-OConnor/pyflow
105 | __pypackages__/
106 |
107 | # Celery stuff
108 | celerybeat-schedule
109 | celerybeat.pid
110 |
111 | # SageMath parsed files
112 | *.sage.py
113 |
114 | # Environments
115 | .env
116 | .venv
117 | env/
118 | venv/
119 | ENV/
120 | env.bak/
121 | venv.bak/
122 |
123 | # Spyder project settings
124 | .spyderproject
125 | .spyproject
126 |
127 | # Rope project settings
128 | .ropeproject
129 |
130 | # mkdocs documentation
131 | /site
132 |
133 | # mypy
134 | .mypy_cache/
135 | .dmypy.json
136 | dmypy.json
137 |
138 | # Pyre type checker
139 | .pyre/
140 |
141 | # pytype static type analyzer
142 | .pytype/
143 |
144 | # Cython debug symbols
145 | cython_debug/
146 |
147 | # PyCharm
148 | # JetBrains specific template is maintainted in a separate JetBrains.gitignore that can
149 | # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
150 | # and can be added to the global gitignore or merged into this file. For a more nuclear
151 | # option (not recommended) you can uncomment the following to ignore the entire idea folder.
152 | .idea/
--------------------------------------------------------------------------------
/javascript/.gitignore:
--------------------------------------------------------------------------------
1 |
2 | # Created by https://www.toptal.com/developers/gitignore/api/node,intellij+all,eclipse,visualstudiocode,windows,linux,macos
3 | # Edit at https://www.toptal.com/developers/gitignore?templates=node,intellij+all,eclipse,visualstudiocode,windows,linux,macos
4 |
5 | ### Eclipse ###
6 | .metadata
7 | bin/
8 | tmp/
9 | *.tmp
10 | *.bak
11 | *.swp
12 | *~.nib
13 | local.properties
14 | .settings/
15 | .loadpath
16 | .recommenders
17 |
18 | # External tool builders
19 | .externalToolBuilders/
20 |
21 | # Locally stored "Eclipse launch configurations"
22 | *.launch
23 |
24 | # PyDev specific (Python IDE for Eclipse)
25 | *.pydevproject
26 |
27 | # CDT-specific (C/C++ Development Tooling)
28 | .cproject
29 |
30 | # CDT- autotools
31 | .autotools
32 |
33 | # Java annotation processor (APT)
34 | .factorypath
35 |
36 | # PDT-specific (PHP Development Tools)
37 | .buildpath
38 |
39 | # sbteclipse plugin
40 | .target
41 |
42 | # Tern plugin
43 | .tern-project
44 |
45 | # TeXlipse plugin
46 | .texlipse
47 |
48 | # STS (Spring Tool Suite)
49 | .springBeans
50 |
51 | # Code Recommenders
52 | .recommenders/
53 |
54 | # Annotation Processing
55 | .apt_generated/
56 | .apt_generated_test/
57 |
58 | # Scala IDE specific (Scala & Java development for Eclipse)
59 | .cache-main
60 | .scala_dependencies
61 | .worksheet
62 |
63 | # Uncomment this line if you wish to ignore the project description file.
64 | # Typically, this file would be tracked if it contains build/dependency configurations:
65 | #.project
66 |
67 | ### Eclipse Patch ###
68 | # Spring Boot Tooling
69 | .sts4-cache/
70 |
71 | ### Intellij+all ###
72 | # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
73 | # Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
74 |
75 | # User-specific stuff
76 | .idea/**/workspace.xml
77 | .idea/**/tasks.xml
78 | .idea/**/usage.statistics.xml
79 | .idea/**/dictionaries
80 | .idea/**/shelf
81 |
82 | # AWS User-specific
83 | .idea/**/aws.xml
84 |
85 | # Generated files
86 | .idea/**/contentModel.xml
87 |
88 | # Sensitive or high-churn files
89 | .idea/**/dataSources/
90 | .idea/**/dataSources.ids
91 | .idea/**/dataSources.local.xml
92 | .idea/**/sqlDataSources.xml
93 | .idea/**/dynamic.xml
94 | .idea/**/uiDesigner.xml
95 | .idea/**/dbnavigator.xml
96 |
97 | # Gradle
98 | .idea/**/gradle.xml
99 | .idea/**/libraries
100 |
101 | # Gradle and Maven with auto-import
102 | # When using Gradle or Maven with auto-import, you should exclude module files,
103 | # since they will be recreated, and may cause churn. Uncomment if using
104 | # auto-import.
105 | # .idea/artifacts
106 | # .idea/compiler.xml
107 | # .idea/jarRepositories.xml
108 | # .idea/modules.xml
109 | # .idea/*.iml
110 | # .idea/modules
111 | # *.iml
112 | # *.ipr
113 |
114 | # CMake
115 | cmake-build-*/
116 |
117 | # Mongo Explorer plugin
118 | .idea/**/mongoSettings.xml
119 |
120 | # File-based project format
121 | *.iws
122 |
123 | # IntelliJ
124 | out/
125 |
126 | # mpeltonen/sbt-idea plugin
127 | .idea_modules/
128 |
129 | # JIRA plugin
130 | atlassian-ide-plugin.xml
131 |
132 | # Cursive Clojure plugin
133 | .idea/replstate.xml
134 |
135 | # SonarLint plugin
136 | .idea/sonarlint/
137 |
138 | # Crashlytics plugin (for Android Studio and IntelliJ)
139 | com_crashlytics_export_strings.xml
140 | crashlytics.properties
141 | crashlytics-build.properties
142 | fabric.properties
143 |
144 | # Editor-based Rest Client
145 | .idea/httpRequests
146 |
147 | # Android studio 3.1+ serialized cache file
148 | .idea/caches/build_file_checksums.ser
149 |
150 | ### Intellij+all Patch ###
151 | # Ignores the whole .idea folder and all .iml files
152 | # See https://github.com/joeblau/gitignore.io/issues/186 and https://github.com/joeblau/gitignore.io/issues/360
153 |
154 | .idea/*
155 |
156 | # Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-249601023
157 |
158 | *.iml
159 | modules.xml
160 | .idea/misc.xml
161 | *.ipr
162 |
163 | # Sonarlint plugin
164 | .idea/sonarlint
165 |
166 | ### Linux ###
167 | *~
168 |
169 | # temporary files which can be created if a process still has a handle open of a deleted file
170 | .fuse_hidden*
171 |
172 | # KDE directory preferences
173 | .directory
174 |
175 | # Linux trash folder which might appear on any partition or disk
176 | .Trash-*
177 |
178 | # .nfs files are created when an open file is removed but is still being accessed
179 | .nfs*
180 |
181 | ### macOS ###
182 | # General
183 | .DS_Store
184 | .AppleDouble
185 | .LSOverride
186 |
187 | # Icon must end with two \r
188 | Icon
189 |
190 | # Thumbnails
191 | ._*
192 |
193 | # Files that might appear in the root of a volume
194 | .DocumentRevisions-V100
195 | .fseventsd
196 | .Spotlight-V100
197 | .TemporaryItems
198 | .Trashes
199 | .VolumeIcon.icns
200 | .com.apple.timemachine.donotpresent
201 |
202 | # Directories potentially created on remote AFP share
203 | .AppleDB
204 | .AppleDesktop
205 | Network Trash Folder
206 | Temporary Items
207 | .apdisk
208 |
209 | ### Node ###
210 | # Logs
211 | logs
212 | *.log
213 | npm-debug.log*
214 | yarn-debug.log*
215 | yarn-error.log*
216 | lerna-debug.log*
217 | .pnpm-debug.log*
218 |
219 | # Diagnostic reports (https://nodejs.org/api/report.html)
220 | report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
221 |
222 | # Runtime data
223 | pids
224 | *.pid
225 | *.seed
226 | *.pid.lock
227 |
228 | # Directory for instrumented libs generated by jscoverage/JSCover
229 | lib-cov
230 |
231 | # Coverage directory used by tools like istanbul
232 | coverage
233 | *.lcov
234 |
235 | # nyc test coverage
236 | .nyc_output
237 |
238 | # Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
239 | .grunt
240 |
241 | # Bower dependency directory (https://bower.io/)
242 | bower_components
243 |
244 | # node-waf configuration
245 | .lock-wscript
246 |
247 | # Compiled binary addons (https://nodejs.org/api/addons.html)
248 | build/Release
249 |
250 | # Dependency directories
251 | node_modules/
252 | jspm_packages/
253 |
254 | # Snowpack dependency directory (https://snowpack.dev/)
255 | web_modules/
256 |
257 | # TypeScript cache
258 | *.tsbuildinfo
259 |
260 | # Optional npm cache directory
261 | .npm
262 |
263 | # Optional eslint cache
264 | .eslintcache
265 |
266 | # Optional stylelint cache
267 | .stylelintcache
268 |
269 | # Microbundle cache
270 | .rpt2_cache/
271 | .rts2_cache_cjs/
272 | .rts2_cache_es/
273 | .rts2_cache_umd/
274 |
275 | # Optional REPL history
276 | .node_repl_history
277 |
278 | # Output of 'npm pack'
279 | *.tgz
280 |
281 | # Yarn Integrity file
282 | .yarn-integrity
283 |
284 | # dotenv environment variable files
285 | .env
286 | .env.development.local
287 | .env.test.local
288 | .env.production.local
289 | .env.local
290 |
291 | # parcel-bundler cache (https://parceljs.org/)
292 | .cache
293 | .parcel-cache
294 |
295 | # Next.js build output
296 | .next
297 | out
298 |
299 | # Nuxt.js build / generate output
300 | .nuxt
301 | dist
302 |
303 | # Gatsby files
304 | .cache/
305 | # Comment in the public line in if your project uses Gatsby and not Next.js
306 | # https://nextjs.org/blog/next-9-1#public-directory-support
307 | # public
308 |
309 | # vuepress build output
310 | .vuepress/dist
311 |
312 | # vuepress v2.x temp and cache directory
313 | .temp
314 |
315 | # Docusaurus cache and generated files
316 | .docusaurus
317 |
318 | # Serverless directories
319 | .serverless/
320 |
321 | # FuseBox cache
322 | .fusebox/
323 |
324 | # DynamoDB Local files
325 | .dynamodb/
326 |
327 | # TernJS port file
328 | .tern-port
329 |
330 | # Stores VSCode versions used for testing VSCode extensions
331 | .vscode-test
332 |
333 | # yarn v2
334 | .yarn/cache
335 | .yarn/unplugged
336 | .yarn/build-state.yml
337 | .yarn/install-state.gz
338 | .pnp.*
339 |
340 | ### Node Patch ###
341 | # Serverless Webpack directories
342 | .webpack/
343 |
344 | # Optional stylelint cache
345 |
346 | # SvelteKit build / generate output
347 | .svelte-kit
348 |
349 | ### VisualStudioCode ###
350 | .vscode/*
351 | !.vscode/settings.json
352 | !.vscode/tasks.json
353 | !.vscode/launch.json
354 | !.vscode/extensions.json
355 | !.vscode/*.code-snippets
356 |
357 | # Local History for Visual Studio Code
358 | .history/
359 |
360 | # Built Visual Studio Code Extensions
361 | *.vsix
362 |
363 | ### VisualStudioCode Patch ###
364 | # Ignore all local history of files
365 | .history
366 | .ionide
367 |
368 | # Support for Project snippet scope
369 |
370 | ### Windows ###
371 | # Windows thumbnail cache files
372 | Thumbs.db
373 | Thumbs.db:encryptable
374 | ehthumbs.db
375 | ehthumbs_vista.db
376 |
377 | # Dump file
378 | *.stackdump
379 |
380 | # Folder config file
381 | [Dd]esktop.ini
382 |
383 | # Recycle Bin used on file shares
384 | $RECYCLE.BIN/
385 |
386 | # Windows Installer files
387 | *.cab
388 | *.msi
389 | *.msix
390 | *.msm
391 | *.msp
392 |
393 | # Windows shortcuts
394 | *.lnk
395 |
396 | # End of https://www.toptal.com/developers/gitignore/api/node,intellij+all,eclipse,visualstudiocode,windows,linux,macos
397 |
--------------------------------------------------------------------------------
/typescript/.gitignore:
--------------------------------------------------------------------------------
1 |
2 | # Created by https://www.toptal.com/developers/gitignore/api/node,intellij+all,eclipse,visualstudiocode,windows,linux,macos
3 | # Edit at https://www.toptal.com/developers/gitignore?templates=node,intellij+all,eclipse,visualstudiocode,windows,linux,macos
4 |
5 | ### Eclipse ###
6 | .metadata
7 | bin/
8 | tmp/
9 | *.tmp
10 | *.bak
11 | *.swp
12 | *~.nib
13 | local.properties
14 | .settings/
15 | .loadpath
16 | .recommenders
17 |
18 | # External tool builders
19 | .externalToolBuilders/
20 |
21 | # Locally stored "Eclipse launch configurations"
22 | *.launch
23 |
24 | # PyDev specific (Python IDE for Eclipse)
25 | *.pydevproject
26 |
27 | # CDT-specific (C/C++ Development Tooling)
28 | .cproject
29 |
30 | # CDT- autotools
31 | .autotools
32 |
33 | # Java annotation processor (APT)
34 | .factorypath
35 |
36 | # PDT-specific (PHP Development Tools)
37 | .buildpath
38 |
39 | # sbteclipse plugin
40 | .target
41 |
42 | # Tern plugin
43 | .tern-project
44 |
45 | # TeXlipse plugin
46 | .texlipse
47 |
48 | # STS (Spring Tool Suite)
49 | .springBeans
50 |
51 | # Code Recommenders
52 | .recommenders/
53 |
54 | # Annotation Processing
55 | .apt_generated/
56 | .apt_generated_test/
57 |
58 | # Scala IDE specific (Scala & Java development for Eclipse)
59 | .cache-main
60 | .scala_dependencies
61 | .worksheet
62 |
63 | # Uncomment this line if you wish to ignore the project description file.
64 | # Typically, this file would be tracked if it contains build/dependency configurations:
65 | #.project
66 |
67 | ### Eclipse Patch ###
68 | # Spring Boot Tooling
69 | .sts4-cache/
70 |
71 | ### Intellij+all ###
72 | # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
73 | # Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
74 |
75 | # User-specific stuff
76 | .idea/**/workspace.xml
77 | .idea/**/tasks.xml
78 | .idea/**/usage.statistics.xml
79 | .idea/**/dictionaries
80 | .idea/**/shelf
81 |
82 | # AWS User-specific
83 | .idea/**/aws.xml
84 |
85 | # Generated files
86 | .idea/**/contentModel.xml
87 |
88 | # Sensitive or high-churn files
89 | .idea/**/dataSources/
90 | .idea/**/dataSources.ids
91 | .idea/**/dataSources.local.xml
92 | .idea/**/sqlDataSources.xml
93 | .idea/**/dynamic.xml
94 | .idea/**/uiDesigner.xml
95 | .idea/**/dbnavigator.xml
96 |
97 | # Gradle
98 | .idea/**/gradle.xml
99 | .idea/**/libraries
100 |
101 | # Gradle and Maven with auto-import
102 | # When using Gradle or Maven with auto-import, you should exclude module files,
103 | # since they will be recreated, and may cause churn. Uncomment if using
104 | # auto-import.
105 | # .idea/artifacts
106 | # .idea/compiler.xml
107 | # .idea/jarRepositories.xml
108 | # .idea/modules.xml
109 | # .idea/*.iml
110 | # .idea/modules
111 | # *.iml
112 | # *.ipr
113 |
114 | # CMake
115 | cmake-build-*/
116 |
117 | # Mongo Explorer plugin
118 | .idea/**/mongoSettings.xml
119 |
120 | # File-based project format
121 | *.iws
122 |
123 | # IntelliJ
124 | out/
125 |
126 | # mpeltonen/sbt-idea plugin
127 | .idea_modules/
128 |
129 | # JIRA plugin
130 | atlassian-ide-plugin.xml
131 |
132 | # Cursive Clojure plugin
133 | .idea/replstate.xml
134 |
135 | # SonarLint plugin
136 | .idea/sonarlint/
137 |
138 | # Crashlytics plugin (for Android Studio and IntelliJ)
139 | com_crashlytics_export_strings.xml
140 | crashlytics.properties
141 | crashlytics-build.properties
142 | fabric.properties
143 |
144 | # Editor-based Rest Client
145 | .idea/httpRequests
146 |
147 | # Android studio 3.1+ serialized cache file
148 | .idea/caches/build_file_checksums.ser
149 |
150 | ### Intellij+all Patch ###
151 | # Ignores the whole .idea folder and all .iml files
152 | # See https://github.com/joeblau/gitignore.io/issues/186 and https://github.com/joeblau/gitignore.io/issues/360
153 |
154 | .idea/*
155 |
156 | # Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-249601023
157 |
158 | *.iml
159 | modules.xml
160 | .idea/misc.xml
161 | *.ipr
162 |
163 | # Sonarlint plugin
164 | .idea/sonarlint
165 |
166 | ### Linux ###
167 | *~
168 |
169 | # temporary files which can be created if a process still has a handle open of a deleted file
170 | .fuse_hidden*
171 |
172 | # KDE directory preferences
173 | .directory
174 |
175 | # Linux trash folder which might appear on any partition or disk
176 | .Trash-*
177 |
178 | # .nfs files are created when an open file is removed but is still being accessed
179 | .nfs*
180 |
181 | ### macOS ###
182 | # General
183 | .DS_Store
184 | .AppleDouble
185 | .LSOverride
186 |
187 | # Icon must end with two \r
188 | Icon
189 |
190 | # Thumbnails
191 | ._*
192 |
193 | # Files that might appear in the root of a volume
194 | .DocumentRevisions-V100
195 | .fseventsd
196 | .Spotlight-V100
197 | .TemporaryItems
198 | .Trashes
199 | .VolumeIcon.icns
200 | .com.apple.timemachine.donotpresent
201 |
202 | # Directories potentially created on remote AFP share
203 | .AppleDB
204 | .AppleDesktop
205 | Network Trash Folder
206 | Temporary Items
207 | .apdisk
208 |
209 | ### Node ###
210 | # Logs
211 | logs
212 | *.log
213 | npm-debug.log*
214 | yarn-debug.log*
215 | yarn-error.log*
216 | lerna-debug.log*
217 | .pnpm-debug.log*
218 |
219 | # Diagnostic reports (https://nodejs.org/api/report.html)
220 | report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
221 |
222 | # Runtime data
223 | pids
224 | *.pid
225 | *.seed
226 | *.pid.lock
227 |
228 | # Directory for instrumented libs generated by jscoverage/JSCover
229 | lib-cov
230 |
231 | # Coverage directory used by tools like istanbul
232 | coverage
233 | *.lcov
234 |
235 | # nyc test coverage
236 | .nyc_output
237 |
238 | # Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
239 | .grunt
240 |
241 | # Bower dependency directory (https://bower.io/)
242 | bower_components
243 |
244 | # node-waf configuration
245 | .lock-wscript
246 |
247 | # Compiled binary addons (https://nodejs.org/api/addons.html)
248 | build/Release
249 |
250 | # Dependency directories
251 | node_modules/
252 | jspm_packages/
253 |
254 | # Snowpack dependency directory (https://snowpack.dev/)
255 | web_modules/
256 |
257 | # TypeScript cache
258 | *.tsbuildinfo
259 |
260 | # Optional npm cache directory
261 | .npm
262 |
263 | # Optional eslint cache
264 | .eslintcache
265 |
266 | # Optional stylelint cache
267 | .stylelintcache
268 |
269 | # Microbundle cache
270 | .rpt2_cache/
271 | .rts2_cache_cjs/
272 | .rts2_cache_es/
273 | .rts2_cache_umd/
274 |
275 | # Optional REPL history
276 | .node_repl_history
277 |
278 | # Output of 'npm pack'
279 | *.tgz
280 |
281 | # Yarn Integrity file
282 | .yarn-integrity
283 |
284 | # dotenv environment variable files
285 | .env
286 | .env.development.local
287 | .env.test.local
288 | .env.production.local
289 | .env.local
290 |
291 | # parcel-bundler cache (https://parceljs.org/)
292 | .cache
293 | .parcel-cache
294 |
295 | # Next.js build output
296 | .next
297 | out
298 |
299 | # Nuxt.js build / generate output
300 | .nuxt
301 | dist
302 |
303 | # Gatsby files
304 | .cache/
305 | # Comment in the public line in if your project uses Gatsby and not Next.js
306 | # https://nextjs.org/blog/next-9-1#public-directory-support
307 | # public
308 |
309 | # vuepress build output
310 | .vuepress/dist
311 |
312 | # vuepress v2.x temp and cache directory
313 | .temp
314 |
315 | # Docusaurus cache and generated files
316 | .docusaurus
317 |
318 | # Serverless directories
319 | .serverless/
320 |
321 | # FuseBox cache
322 | .fusebox/
323 |
324 | # DynamoDB Local files
325 | .dynamodb/
326 |
327 | # TernJS port file
328 | .tern-port
329 |
330 | # Stores VSCode versions used for testing VSCode extensions
331 | .vscode-test
332 |
333 | # yarn v2
334 | .yarn/cache
335 | .yarn/unplugged
336 | .yarn/build-state.yml
337 | .yarn/install-state.gz
338 | .pnp.*
339 |
340 | ### Node Patch ###
341 | # Serverless Webpack directories
342 | .webpack/
343 |
344 | # Optional stylelint cache
345 |
346 | # SvelteKit build / generate output
347 | .svelte-kit
348 |
349 | ### VisualStudioCode ###
350 | .vscode/*
351 | !.vscode/settings.json
352 | !.vscode/tasks.json
353 | !.vscode/launch.json
354 | !.vscode/extensions.json
355 | !.vscode/*.code-snippets
356 |
357 | # Local History for Visual Studio Code
358 | .history/
359 |
360 | # Built Visual Studio Code Extensions
361 | *.vsix
362 |
363 | ### VisualStudioCode Patch ###
364 | # Ignore all local history of files
365 | .history
366 | .ionide
367 |
368 | # Support for Project snippet scope
369 |
370 | ### Windows ###
371 | # Windows thumbnail cache files
372 | Thumbs.db
373 | Thumbs.db:encryptable
374 | ehthumbs.db
375 | ehthumbs_vista.db
376 |
377 | # Dump file
378 | *.stackdump
379 |
380 | # Folder config file
381 | [Dd]esktop.ini
382 |
383 | # Recycle Bin used on file shares
384 | $RECYCLE.BIN/
385 |
386 | # Windows Installer files
387 | *.cab
388 | *.msi
389 | *.msix
390 | *.msm
391 | *.msp
392 |
393 | # Windows shortcuts
394 | *.lnk
395 |
396 | # End of https://www.toptal.com/developers/gitignore/api/node,intellij+all,eclipse,visualstudiocode,windows,linux,macos
397 |
--------------------------------------------------------------------------------
/csharp/.gitignore:
--------------------------------------------------------------------------------
1 | ## Ignore Visual Studio temporary files, build results, and
2 | ## files generated by popular Visual Studio add-ons.
3 | ##
4 | ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
5 |
6 | # User-specific files
7 | *.rsuser
8 | *.suo
9 | *.user
10 | *.userosscache
11 | *.sln.docstates
12 |
13 | # User-specific files (MonoDevelop/Xamarin Studio)
14 | *.userprefs
15 |
16 | # Mono auto generated files
17 | mono_crash.*
18 |
19 | # Build results
20 | [Dd]ebug/
21 | [Dd]ebugPublic/
22 | [Rr]elease/
23 | [Rr]eleases/
24 | x64/
25 | x86/
26 | [Aa][Rr][Mm]/
27 | [Aa][Rr][Mm]64/
28 | bld/
29 | [Bb]in/
30 | [Oo]bj/
31 | [Ll]og/
32 | [Ll]ogs/
33 |
34 | # Visual Studio 2015/2017 cache/options directory
35 | .vs/
36 | # Uncomment if you have tasks that create the project's static files in wwwroot
37 | #wwwroot/
38 |
39 | # Visual Studio 2017 auto generated files
40 | Generated\ Files/
41 |
42 | # MSTest test Results
43 | [Tt]est[Rr]esult*/
44 | [Bb]uild[Ll]og.*
45 |
46 | # NUnit
47 | *.VisualState.xml
48 | TestResult.xml
49 | nunit-*.xml
50 |
51 | # Build Results of an ATL Project
52 | [Dd]ebugPS/
53 | [Rr]eleasePS/
54 | dlldata.c
55 |
56 | # Benchmark Results
57 | BenchmarkDotNet.Artifacts/
58 |
59 | # .NET Core
60 | project.lock.json
61 | project.fragment.lock.json
62 | artifacts/
63 |
64 | # StyleCop
65 | StyleCopReport.xml
66 |
67 | # Files built by Visual Studio
68 | *_i.c
69 | *_p.c
70 | *_h.h
71 | *.ilk
72 | *.meta
73 | *.obj
74 | *.iobj
75 | *.pch
76 | *.pdb
77 | *.ipdb
78 | *.pgc
79 | *.pgd
80 | *.rsp
81 | *.sbr
82 | *.tlb
83 | *.tli
84 | *.tlh
85 | *.tmp
86 | *.tmp_proj
87 | *_wpftmp.csproj
88 | *.log
89 | *.vspscc
90 | *.vssscc
91 | .builds
92 | *.pidb
93 | *.svclog
94 | *.scc
95 |
96 | # Chutzpah Test files
97 | _Chutzpah*
98 |
99 | # Visual C++ cache files
100 | ipch/
101 | *.aps
102 | *.ncb
103 | *.opendb
104 | *.opensdf
105 | *.sdf
106 | *.cachefile
107 | *.VC.db
108 | *.VC.VC.opendb
109 |
110 | # Visual Studio profiler
111 | *.psess
112 | *.vsp
113 | *.vspx
114 | *.sap
115 |
116 | # Visual Studio Trace Files
117 | *.e2e
118 |
119 | # TFS 2012 Local Workspace
120 | $tf/
121 |
122 | # Guidance Automation Toolkit
123 | *.gpState
124 |
125 | # ReSharper is a .NET coding add-in
126 | _ReSharper*/
127 | *.[Rr]e[Ss]harper
128 | *.DotSettings.user
129 |
130 | # TeamCity is a build add-in
131 | _TeamCity*
132 |
133 | # DotCover is a Code Coverage Tool
134 | *.dotCover
135 |
136 | # AxoCover is a Code Coverage Tool
137 | .axoCover/*
138 | !.axoCover/settings.json
139 |
140 | # Coverlet is a free, cross platform Code Coverage Tool
141 | coverage*[.json, .xml, .info]
142 |
143 | # Visual Studio code coverage results
144 | *.coverage
145 | *.coveragexml
146 |
147 | # NCrunch
148 | _NCrunch_*
149 | .*crunch*.local.xml
150 | nCrunchTemp_*
151 |
152 | # MightyMoose
153 | *.mm.*
154 | AutoTest.Net/
155 |
156 | # Web workbench (sass)
157 | .sass-cache/
158 |
159 | # Installshield output folder
160 | [Ee]xpress/
161 |
162 | # DocProject is a documentation generator add-in
163 | DocProject/buildhelp/
164 | DocProject/Help/*.HxT
165 | DocProject/Help/*.HxC
166 | DocProject/Help/*.hhc
167 | DocProject/Help/*.hhk
168 | DocProject/Help/*.hhp
169 | DocProject/Help/Html2
170 | DocProject/Help/html
171 |
172 | # Click-Once directory
173 | publish/
174 |
175 | # Publish Web Output
176 | *.[Pp]ublish.xml
177 | *.azurePubxml
178 | # Note: Comment the next line if you want to checkin your web deploy settings,
179 | # but database connection strings (with potential passwords) will be unencrypted
180 | *.pubxml
181 | *.publishproj
182 |
183 | # Microsoft Azure Web App publish settings. Comment the next line if you want to
184 | # checkin your Azure Web App publish settings, but sensitive information contained
185 | # in these scripts will be unencrypted
186 | PublishScripts/
187 |
188 | # NuGet Packages
189 | *.nupkg
190 | # NuGet Symbol Packages
191 | *.snupkg
192 | # The packages folder can be ignored because of Package Restore
193 | **/[Pp]ackages/*
194 | # except build/, which is used as an MSBuild target.
195 | !**/[Pp]ackages/build/
196 | # Uncomment if necessary however generally it will be regenerated when needed
197 | #!**/[Pp]ackages/repositories.config
198 | # NuGet v3's project.json files produces more ignorable files
199 | *.nuget.props
200 | *.nuget.targets
201 |
202 | # Microsoft Azure Build Output
203 | csx/
204 | *.build.csdef
205 |
206 | # Microsoft Azure Emulator
207 | ecf/
208 | rcf/
209 |
210 | # Windows Store app package directories and files
211 | AppPackages/
212 | BundleArtifacts/
213 | Package.StoreAssociation.xml
214 | _pkginfo.txt
215 | *.appx
216 | *.appxbundle
217 | *.appxupload
218 |
219 | # Visual Studio cache files
220 | # files ending in .cache can be ignored
221 | *.[Cc]ache
222 | # but keep track of directories ending in .cache
223 | !?*.[Cc]ache/
224 |
225 | # Others
226 | ClientBin/
227 | ~$*
228 | *~
229 | *.dbmdl
230 | *.dbproj.schemaview
231 | *.jfm
232 | *.pfx
233 | *.publishsettings
234 | orleans.codegen.cs
235 |
236 | # Including strong name files can present a security risk
237 | # (https://github.com/github/gitignore/pull/2483#issue-259490424)
238 | #*.snk
239 |
240 | # Since there are multiple workflows, uncomment next line to ignore bower_components
241 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
242 | #bower_components/
243 |
244 | # RIA/Silverlight projects
245 | Generated_Code/
246 |
247 | # Backup & report files from converting an old project file
248 | # to a newer Visual Studio version. Backup files are not needed,
249 | # because we have git ;-)
250 | _UpgradeReport_Files/
251 | Backup*/
252 | UpgradeLog*.XML
253 | UpgradeLog*.htm
254 | ServiceFabricBackup/
255 | *.rptproj.bak
256 |
257 | # SQL Server files
258 | *.mdf
259 | *.ldf
260 | *.ndf
261 |
262 | # Business Intelligence projects
263 | *.rdl.data
264 | *.bim.layout
265 | *.bim_*.settings
266 | *.rptproj.rsuser
267 | *- [Bb]ackup.rdl
268 | *- [Bb]ackup ([0-9]).rdl
269 | *- [Bb]ackup ([0-9][0-9]).rdl
270 |
271 | # Microsoft Fakes
272 | FakesAssemblies/
273 |
274 | # GhostDoc plugin setting file
275 | *.GhostDoc.xml
276 |
277 | # Node.js Tools for Visual Studio
278 | .ntvs_analysis.dat
279 | node_modules/
280 |
281 | # Visual Studio 6 build log
282 | *.plg
283 |
284 | # Visual Studio 6 workspace options file
285 | *.opt
286 |
287 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
288 | *.vbw
289 |
290 | # Visual Studio LightSwitch build output
291 | **/*.HTMLClient/GeneratedArtifacts
292 | **/*.DesktopClient/GeneratedArtifacts
293 | **/*.DesktopClient/ModelManifest.xml
294 | **/*.Server/GeneratedArtifacts
295 | **/*.Server/ModelManifest.xml
296 | _Pvt_Extensions
297 |
298 | # Paket dependency manager
299 | .paket/paket.exe
300 | paket-files/
301 |
302 | # FAKE - F# Make
303 | .fake/
304 |
305 | # CodeRush personal settings
306 | .cr/personal
307 |
308 | # Python Tools for Visual Studio (PTVS)
309 | __pycache__/
310 | *.pyc
311 |
312 | # Cake - Uncomment if you are using it
313 | # tools/**
314 | # !tools/packages.config
315 |
316 | # Tabs Studio
317 | *.tss
318 |
319 | # Telerik's JustMock configuration file
320 | *.jmconfig
321 |
322 | # BizTalk build output
323 | *.btp.cs
324 | *.btm.cs
325 | *.odx.cs
326 | *.xsd.cs
327 |
328 | # OpenCover UI analysis results
329 | OpenCover/
330 |
331 | # Azure Stream Analytics local run output
332 | ASALocalRun/
333 |
334 | # MSBuild Binary and Structured Log
335 | *.binlog
336 |
337 | # NVidia Nsight GPU debugger configuration file
338 | *.nvuser
339 |
340 | # MFractors (Xamarin productivity tool) working folder
341 | .mfractor/
342 |
343 | # Local History for Visual Studio
344 | .localhistory/
345 |
346 | # BeatPulse healthcheck temp database
347 | healthchecksdb
348 |
349 | # Backup folder for Package Reference Convert tool in Visual Studio 2017
350 | MigrationBackup/
351 |
352 | # Ionide (cross platform F# VS Code tools) working folder
353 | .ionide/
354 |
355 | ##
356 | ## Visual studio for Mac
357 | ##
358 |
359 |
360 | # globs
361 | Makefile.in
362 | *.userprefs
363 | *.usertasks
364 | config.make
365 | config.status
366 | aclocal.m4
367 | install-sh
368 | autom4te.cache/
369 | *.tar.gz
370 | tarballs/
371 | test-results/
372 |
373 | # Mac bundle stuff
374 | *.dmg
375 | *.app
376 |
377 | # content below from: https://github.com/github/gitignore/blob/master/Global/macOS.gitignore
378 | # General
379 | .DS_Store
380 | .AppleDouble
381 | .LSOverride
382 |
383 | # Icon must end with two \r
384 | Icon
385 |
386 |
387 | # Thumbnails
388 | ._*
389 |
390 | # Files that might appear in the root of a volume
391 | .DocumentRevisions-V100
392 | .fseventsd
393 | .Spotlight-V100
394 | .TemporaryItems
395 | .Trashes
396 | .VolumeIcon.icns
397 | .com.apple.timemachine.donotpresent
398 |
399 | # Directories potentially created on remote AFP share
400 | .AppleDB
401 | .AppleDesktop
402 | Network Trash Folder
403 | Temporary Items
404 | .apdisk
405 |
406 | # content below from: https://github.com/github/gitignore/blob/master/Global/Windows.gitignore
407 | # Windows thumbnail cache files
408 | Thumbs.db
409 | ehthumbs.db
410 | ehthumbs_vista.db
411 |
412 | # Dump file
413 | *.stackdump
414 |
415 | # Folder config file
416 | [Dd]esktop.ini
417 |
418 | # Recycle Bin used on file shares
419 | $RECYCLE.BIN/
420 |
421 | # Windows Installer files
422 | *.cab
423 | *.msi
424 | *.msix
425 | *.msm
426 | *.msp
427 |
428 | # Windows shortcuts
429 | *.lnk
430 |
431 | # JetBrains Rider
432 | .idea/
433 | *.sln.iml
434 |
435 | ##
436 | ## Visual Studio Code
437 | ##
438 | .vscode/*
439 | !.vscode/settings.json
440 | !.vscode/tasks.json
441 | !.vscode/launch.json
442 | !.vscode/extensions.json
443 |
--------------------------------------------------------------------------------