Skip to content

Commit 12de582

Browse files
committed
add docs folder
1 parent 2df79b2 commit 12de582

File tree

273 files changed

+10163
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

273 files changed

+10163
-0
lines changed

docs/INSTRUCTIONS.md

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
## 🚀 D-1: Getting ready for your journey.
2+
3+
The Advent of Craft 2023 starts tomorrow.
4+
5+
A long journey awaits you.
6+
7+
In order to prepare your ship for this journey, here is a task
8+
list of the things you need to know / install before setting sail.
9+
10+
### 🔨Install your tools
11+
12+
- Install an IDE. Intellij Community or VS Code should do.
13+
- Create an account on github to get the latest changes and fork the repository.
14+
- Install Git to get the repository. With a git bash or git client.
15+
- Install and create an account on Discord to share with the community.
16+
17+
### ✅ The process
18+
19+
Each day, an exercise is going to be posted at around 1PM Europe time (GMT+1)
20+
in the public repository here:
21+
https://github.com/advent-of-craft/advent-of-craft.git
22+
23+
At the same time, a solution for the exercise of the previous day
24+
is going to be posted.
25+
26+
The repository will have an _exercise/_ folder containing a subfolder for each day
27+
as well as a _solution/_ folder with step-by-step instructions.
28+
29+
### 👨‍💻Posting your solution
30+
31+
Each day, a dedicated channel in the Discord is going to be created for posting solutions.
32+
33+
We advise you to post your solution in order to benefit the whole community.
34+
You can use the following methods to do so:
35+
36+
1) Post a screenshot of your solution in the Discord channel (via Codesnap or other tools).
37+
2) Post your code in a markdown format.
38+
- You can wrap your code within this markdown
39+
```java
40+
paste your code like this
41+
```
42+
3) From your github account you can create your own solution.
43+
- you can fork the following repository: https://github.com/advent-of-craft/advent-of-craft.git
44+
- post a link to your repository and solution in the Discord channel (can be with branches per day)
45+
46+
We encourage everyone to start healthy discussions on the Discord that are related
47+
to the exercise of the day and any advice you want to share with the community.
48+
49+
### ❓Help on your journey
50+
51+
A help channel is available at any time on the Discord server.
52+
53+
If you get stuck with IDE configuration, git commands or anything that prevents you
54+
from coding, please let us know, your hosts and the community will make everything
55+
possible to help you.
56+
57+
### 🎙️Last word from your hosts
58+
59+
Remember that this initiative is completely free, and you can reuse these exercises
60+
for your own crafting journey with the step-by-step solutions as well.
61+
62+
> We humbly ask you in return to approach the journey with an open mind,
63+
a good will and that you respect the other passengers. The Discord is a safe
64+
space where all conversations are open so let's all remember to be civilized.
65+
66+
We are all here to learn.
67+
68+
🎅 May this epic crafting journey begin! 🧑‍🎄

docs/exercise/day01/challenge.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
## Day 1: code that is easy to understand.
2+
3+
Welcome to the Advent of Craft 2023.
4+
5+
We begin this journey by going over the basics.
6+
We all do this everyday:
7+
8+
_Reading a simple code._
9+
10+
If you understand a piece of code quickly,
11+
it does not mean the code is readable much less well-crafted.
12+
It also does not mean the code should not be refactored.
13+
14+
A readable code is not always the fewest line or the one
15+
that uses the latest framework technique.
16+
17+
Think about the real value your code should bring.
18+
19+
>**Challenge of day 1: Make your production code easier to understand.**
20+
21+
May the crafting journey begin!
22+
23+
- <u>💡HINT:</u> Your IDE is your best friend in this journey!
24+
25+
![snippet of the day](snippet.png)
26+
27+
### Proposed Solution
28+
[![Proposed Solution Guide](../../img/proposed-solution.png)](solution/step-by-step.md)

docs/exercise/day01/snippet.png

627 KB
Loading
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
## Day 1: Make your production code easier to understand.
2+
3+
### Encapsulate Conditionals
4+
5+
If conditionals are too complex, it might hamper readability.
6+
7+
1) Start by simplifying the code
8+
2) Extract method for each part of the condition
9+
3) Think deeply on the business to find names that represent it
10+
11+
Your code should look more readable and as a result more maintainable.
12+
13+
>**Tip of the day: the best documentation is the code itself.**
14+
15+
### Share your experience
16+
17+
How does your code look like? Anything you'd like to add?
18+
19+
Please let everyone know in the discord.
122 KB
Loading
175 KB
Loading
846 KB
Loading
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
## Day 1: Make your production code easier to understand.
2+
### Encapsulate Conditionals
3+
If conditionals are too complex, it might hamper readability.
4+
5+
- Start by simplifying the code
6+
7+
![Simplify if else](img/simplify-if-else.png)
8+
9+
- Then `Extract Method` for each part of the condition
10+
11+
![Extract Method](img/extract-method.png)
12+
13+
- Think deeply on the business to find names that represent it
14+
15+
```java
16+
public record Food(LocalDate expirationDate,
17+
Boolean approvedForConsumption,
18+
UUID inspectorId) {
19+
public boolean isEdible(Supplier<LocalDate> now) {
20+
return isFresh(now) &&
21+
canBeConsumed() &&
22+
hasBeenInspected();
23+
}
24+
25+
private boolean isFresh(Supplier<LocalDate> now) {
26+
return this.expirationDate.isAfter(now.get());
27+
}
28+
29+
private boolean hasBeenInspected() {
30+
return this.inspectorId != null;
31+
}
32+
33+
private Boolean canBeConsumed() {
34+
return this.approvedForConsumption;
35+
}
36+
}
37+
```
38+
39+
- <u>⚠️ WARNING:</u> Make sure your tests are still passing throughout your refactoring!

docs/exercise/day02/challenge.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
## Day 2: Fight indentation.
2+
3+
On the second day of your crafting journey, you are to meet your first fizzbuzz code.
4+
You probably know this piece of code and yet there is so much in it to unpack.
5+
6+
Today though your task is but a simple one: reducing the complexity of the code
7+
by removing as much indentation as you can.
8+
9+
_Remember that a developer never forgets his craft. He just adds to it._
10+
11+
>**Challenge of day 2: Your code can only have one level of indentation.**
12+
13+
May your journey continue!
14+
15+
- <u>💡HINT:</u> Apply what you learned on day 1
16+
17+
![snippet of the day](snippet.png)
18+
19+
### Proposed Solution
20+
[![Proposed Solution Guide](../../img/proposed-solution.png)](solution/step-by-step.md)

docs/exercise/day02/snippet.png

834 KB
Loading

0 commit comments

Comments
 (0)