Skip to content

Commit d4362bd

Browse files
Fixes #11: Incorrect Create Date and Filename on each Code Block
1 parent 9bf7938 commit d4362bd

File tree

5 files changed

+29
-31
lines changed

5 files changed

+29
-31
lines changed

Diff for: content/Decorator Pattern.md

+10-15
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
title: Decorator Pattern
33
tags:
44
- structural
5+
created: 2025-02-22
56
---
67
## Definition
78

@@ -80,16 +81,14 @@ _Design of the Coffee Shop_
8081
---
8182
## Coding Decorator Pattern
8283

83-
```java title:Coffee.java
84-
// Coffee.java
84+
```java title="Coffee.java"
8585
interface Coffee {
8686
public String getDescription();
8787
public int getCost();
8888
}
8989
```
9090
The `Coffee` interface acts as an **abstraction layer** between the **variety of coffee types**. By implementing this interface, you can create **as many coffee varieties** as needed.
91-
```java title:PlainCoffee.java
92-
// PlainCoffee.java
91+
```java title="PlainCoffee.java"
9392
class PlainCoffee implements Coffee {
9493

9594
@Override
@@ -104,8 +103,7 @@ class PlainCoffee implements Coffee {
104103
}
105104
```
106105

107-
```java title:CappuccinoCoffee.java
108-
// CappuccinoCoffee
106+
```java title="CappuccinoCoffee.java"
109107
class CappuccinoCoffee implements Coffee {
110108
@Override
111109
public String getDescription() {
@@ -119,8 +117,7 @@ class CappuccinoCoffee implements Coffee {
119117
}
120118
```
121119
In the code example above, the `Coffee` interface is implemented by both the **PlainCoffee** and **CappuccinoCoffee** concrete classes. For each coffee type, we override the methods and assign the **specific cost** for each coffee.
122-
```java title:CoffeeDecorator.java
123-
// CoffeeDecorator.java
120+
```java title="CoffeeDecorator.java"
124121
abstract class CoffeeDecorator implements Coffee {
125122
protected Coffee _coffee;
126123

@@ -140,8 +137,7 @@ abstract class CoffeeDecorator implements Coffee {
140137
}
141138
```
142139
The `CoffeeDecorator` class is the **decorator class** that implements the `Coffee` interface to **decorate different varieties of coffee**. In our case, the **CoffeeDecorator** acts as an **add-on** (e.g., milk, sugar) that can be added to the customer's coffee if requested.
143-
```java title:MilkDecorator.java
144-
// MilkDecorator.java
140+
```java title="MilkDecorator.java"
145141
class MilkDecorator extends CoffeeDecorator {
146142
public MilkDecorator(Coffee decoratedcoffee) {
147143
super(decoratedcoffee);
@@ -159,8 +155,7 @@ class MilkDecorator extends CoffeeDecorator {
159155
}
160156
```
161157

162-
```java title:SugarDecorator.java
163-
// SugarDecorator.java
158+
```java title="SugarDecorator.java"
164159
class SugarDecorator extends CoffeeDecorator {
165160
public SugarDecorator(Coffee decoratedCoffee) {
166161
super(decoratedCoffee);
@@ -178,7 +173,7 @@ class SugarDecorator extends CoffeeDecorator {
178173
}
179174
```
180175
When creating coffee objects, you can **layer decorators** as needed. For example, a **Cappuccino** with **milk and sugar** is created by **wrapping the decorators** around the base coffee object.
181-
```java title:DecoratorPattern.java
176+
```java title="DecoratorPattern.java"
182177
public class DecoratorPattern {
183178
public static void main(String[] args) {
184179
Coffee plaincoffee = new PlainCoffee();
@@ -199,7 +194,7 @@ Cappuccino + Milk + Sugar Cost=35
199194
```
200195
---
201196
## Complete Code In Java
202-
```java title:Decorator.java
197+
```java title="Decorator.java"
203198
package decorator;
204199

205200
// Coffee.java
@@ -307,7 +302,7 @@ public class DecoratorPattern {
307302

308303
The Java I/O library is a textbook example of the Decorator Pattern. The base classes such as `InputStream` and `OutputStream` are extended by concrete classes (like `FileInputStream`) and then wrapped by decorator classes that add additional functionality at runtime.
309304

310-
```java title:StreamInput.java
305+
```java title="StreamInput.java"
311306
// Base stream reading from a file
312307
InputStream fileStream = new FileInputStream("data.txt");
313308

Diff for: content/Observer Pattern.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
title: Observer Pattern
33
tags:
44
- behavioral
5+
created: 2025-02-18
56
---
67
## Definition
78

@@ -86,7 +87,7 @@ The Design will look like the Above.
8687

8788
---
8889
### Code in Java
89-
```java title:Observerpattern.java
90+
```java title="Observerpattern.java"
9091
// These is the Subject
9192
interface Subject {
9293
public void registerObserver(Observer o);
@@ -229,7 +230,7 @@ The **Observer Pattern** is commonly used in many libraries and frameworks. For
229230
This class allows you to **add or remove observers** easily. You can also create multiple listeners by implementing the `ActionListener` interface.
230231

231232
Below is an example demonstrating this.
232-
```java title:SwingApp.java
233+
```java title="SwingApp.java"
233234
package observer;
234235

235236
import java.awt.Rectangle;

Diff for: content/Strategy Pattern.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
title: Strategy Pattern
33
tags:
44
- behavioral
5+
created: 2025-02-11
56
---
6-
77
## Definition
88

99
It defines a family of algorithms, encapsulates each one, and makes them interchangeable. The **Strategy Pattern** allows algorithms to vary independently from the clients that use them.
@@ -284,7 +284,7 @@ classDiagram
284284

285285
The `Comparator` interface acts as the Strategy Pattern. By inheriting this interface, you can create your custom comparator, which allows you to sort collections.
286286

287-
```java title:Person.java
287+
```java title="Person.java"
288288
class NameComparator implements Comparator<Person> {
289289
public int compare(Person p1, Person p2) {
290290
return p1.name.compareTo(p2.name);

Diff for: content/index.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
---
22
title: Design Patterns
3+
created: 2025-02-07
34
---
45
### What is Design Pattern ?
56

@@ -30,7 +31,7 @@ In software design, **coupling** refers to the degree of dependency between tw
3031

3132
**Example :**
3233
Consider a `MessageService` class that sends messages via Email, SMS, or other techniques. The implementation might look like the following code:
33-
```java title:MessageService.java
34+
```java title="MessageService.java"
3435
class MessageService {
3536

3637
public static void sendMessage(string message){
@@ -48,7 +49,7 @@ These Approach Follows **Dependency Inversion Principle** which is again the par
4849

4950
**Example:**
5051
In the earlier example, the `MessageService` class was heavily dependent on `EmailClient`. In such cases, if you need to create another service, it becomes inefficient. We can avoid this dependency by passing the `ProviderClient` interface as a parameter to the `sendMessage` method. Then, we implement the `ProviderClient` interface for various provider services.
51-
```java title:MessageService.java
52+
```java title="MessageService.java"
5253

5354
// Interface to be implemented by various provider services
5455
interface ProviderClient {

Diff for: quartz.layout.ts

+11-10
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,17 @@ export const sharedPageComponents: SharedLayout = {
2121
})
2222
],
2323
head: Component.Head(),
24-
header: [Component.MobileOnly(
25-
Component.Drawer({
26-
links: {
27-
Blogs: "./blogs",
28-
Github: "https://github.com/PrathameshDhande22/Java-Tutorial",
29-
"About Me": "https://github.com/PrathameshDhande22"
30-
}
31-
})
32-
)],
24+
header: [
25+
Component.MobileOnly(
26+
Component.Drawer({
27+
links: {
28+
Blogs: "./blogs",
29+
Github: "https://github.com/PrathameshDhande22/Java-Tutorial",
30+
"About Me": "https://github.com/PrathameshDhande22"
31+
}
32+
})
33+
)
34+
],
3335
afterBody: [
3436
Component.RecentNotes({
3537
limit: 5,
@@ -66,7 +68,6 @@ export const defaultContentPageLayout: PageLayout = {
6668
right: [
6769
Component.TableOfContents(),
6870
Component.Backlinks(),
69-
7071
]
7172
}
7273

0 commit comments

Comments
 (0)