Skip to content

Commit

Permalink
Updated the Index Pages and layout
Browse files Browse the repository at this point in the history
  • Loading branch information
PrathameshDhande22 committed Jan 28, 2025
1 parent 8e8e976 commit c46e925
Show file tree
Hide file tree
Showing 17 changed files with 1,237 additions and 37 deletions.
1 change: 1 addition & 0 deletions content/Decorator Pattern.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<marquee>Comming Soon</marquee>
13 changes: 9 additions & 4 deletions content/Strategy Pattern.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
It Defines a family of algorithms encapsulates each one, and makes them interchangeable. Strategy Lets the algorithms vary independently from clients that use it.

---
## Real World Analogy
## Real World Analogy - 1

Consider you are creating the Duck Application in which there are many types of Duck which may quack, fly. The Simple Approach would be just create the base class Duck and the method like fly, quack and implement it to other types of Duck.
Consider creating a Duck application with different types of ducks that can quack and fly. A simple approach would be to create a base class called `Duck` with methods like `fly` and `quack`, and then implement these methods in the specific types of ducks.

```mermaid
---
Expand All @@ -29,8 +29,9 @@ classDiagram
Duck <|-- MallardDuck
Duck <|-- RubberDuck
```

> [!Question] What is Wrong With These Approach ?
> You have just implement the Base class as Duck in which the methods are also implemented. For Example the Base Class of the Duck has the implementation of the Fly Ducks. Then for RubberDuck Class, Duck cannot quack nor fly. To modify these behavior you need to rewrite the code again for the method fly and quack which is not feasible when it comes to dozens of duck. You need some approach to tackle these type of solution. Solution is **Strategy Pattern**.
> You have implemented a base class called `Duck`, where methods like `fly` and `quack` are already defined. For example, the base class `Duck` has a default implementation of flying. However, in the case of a `RubberDuck` class, the duck cannot quack or fly. To modify this behavior, you would need to rewrite the `fly` and `quack` methods, which becomes inefficient when dealing with dozens of duck types. To address this issue, you can use the **Strategy Pattern**.
Let's see the Implementation via Strategy Pattern:
```mermaid
Expand Down Expand Up @@ -92,7 +93,7 @@ classDiagram
Duck <|-- MallardDuck
Duck <|-- RubberDuck
```
Here we Created the Interface FlyBehavior and QuackBehavior which takes the method. By implementing these interface you can create new behavior. For Abstract Base Class Duck just make use of the Interface in the constructor means you can change the behaviour or even implement the new Duck by passing the Duck Behavior or Custom Behavior.
Here, we create two interfaces: `FlyBehavior` and `QuackBehavior`, which define the methods for flying and quacking. By implementing these interfaces, you can create new behaviors. In the abstract base class `Duck`, you use these interfaces in the constructor, allowing you to change the behavior dynamically or even implement a new duck type by passing specific behaviors or custom behaviors.

---
## Code in Java
Expand Down Expand Up @@ -203,3 +204,7 @@ public class Index {
}
}
```
---
## Real World Analogy - 2

Let's take the another Example of the Logging Framework.
14 changes: 13 additions & 1 deletion content/index.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
title: Java Design Patterns
title: Design Patterns
---
### What is Design Pattern ?

Expand All @@ -10,6 +10,18 @@ title: Java Design Patterns
- **Creational patterns** provide object creation mechanisms that increase flexibility and reuse of existing code.
- **Structural patterns** explain how to assemble objects and classes into larger structures, while keeping these structures flexible and efficient.
- **Behavioral patterns** take care of effective communication and the assignment of responsibilities between objects.

> [!Important] Prerequisite
>Must have knowledge of **OOPS (Object-Oriented Programming Principles)** and **Java**. The design patterns are primarily based on OOPS concepts. The code in this tutorial is mainly written in Java and related frameworks.
>
>**OOPS Concepts:**
> - Inheritance
>- Abstraction
>- Polymorphism
>- Encapsulation
Before diving into design patterns, it’s important to understand the **SOLID Principles**, **Tightly Coupled Classes**, and **Loosely Coupled Classes**. Additionally, some tips and tricks for writing clean code.

---
## Contents:

Expand Down
8 changes: 6 additions & 2 deletions public/404.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
<!DOCTYPE html>
<html lang="en"><head><title>Not Found</title><meta charset="utf-8"/><link rel="preconnect" href="https://fonts.googleapis.com"/><link rel="preconnect" href="https://fonts.gstatic.com"/><link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=IBM Plex Mono&amp;family=Schibsted Grotesk:wght@400;700&amp;family=Source Sans Pro:ital,wght@0,400;0,600;1,400;1,600&amp;display=swap"/><link rel="preconnect" href="https://cdnjs.cloudflare.com" crossorigin="anonymous"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><meta name="og:site_name" content="🛠️ Java Design Patterns"/><meta property="og:title" content="Not Found"/><meta property="og:type" content="website"/><meta name="twitter:card" content="summary_large_image"/><meta name="twitter:title" content="Not Found"/><meta name="twitter:description" content="Not Found"/><meta property="og:description" content="Not Found"/><meta property="og:image:type" content="image/webp"/><meta property="og:image:alt" content="Not Found"/><meta property="og:image:width" content="1200"/><meta property="og:image:height" content="630"/><meta property="og:image:url" content="https://https://prathameshdhande22.github.io/Java-Tutorial//static/og-image.png"/><meta name="twitter:image" content="https://https://prathameshdhande22.github.io/Java-Tutorial//static/og-image.png"/><meta property="og:image" content="https://https://prathameshdhande22.github.io/Java-Tutorial//static/og-image.png"/><meta property="twitter:domain" content="https://prathameshdhande22.github.io/Java-Tutorial/"/><meta property="og:url" content="https://https//prathameshdhande22.github.io/Java-Tutorial/"/><meta property="twitter:url" content="https://https//prathameshdhande22.github.io/Java-Tutorial/"/><link rel="icon" href="//prathameshdhande22.github.io/Java-Tutorial/static/icon.png"/><meta name="description" content="Not Found"/><meta name="generator" content="Quartz"/><link href="//prathameshdhande22.github.io/Java-Tutorial/index.css" rel="stylesheet" type="text/css" spa-preserve/><link href="https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/katex.min.css" rel="stylesheet" type="text/css" spa-preserve/><script src="//prathameshdhande22.github.io/Java-Tutorial/prescript.js" type="application/javascript" spa-preserve></script><script type="application/javascript" spa-preserve>const fetchData = fetch("//prathameshdhande22.github.io/Java-Tutorial/static/contentIndex.json").then(data => data.json())</script></head><body data-slug="404"><div id="quartz-root" class="page"><div id="quartz-body"><div class="left sidebar"></div><div class="center"><div class="page-header"><div class="popover-hint"></div></div><article class="popover-hint"><h1>404</h1><p>Either this page is private or doesn't exist.</p><a href="//prathameshdhande22.github.io/Java-Tutorial/">Return to Homepage</a></article><hr/><div class="page-footer"></div></div><div class="right sidebar"></div><footer class><p style="text-align:center;">Created with ❤️ by Prathamesh Dhande</p><ul style="text-align:center;"><li><a href="https://prathameshdhande22.github.io/Java-Tutorial/">GitHub</a></li><li><a href="https://www.linkedin.com/in/prathamesh-dhande-3a039721a/">LinkedIn</a></li></ul><div style="text-align: center; padding: 20px; font-family: Arial, sans-serif;"><p style="color: #007acc; font-size: 16px; margin: 5px;">Written on <a href="https://obsidian.md" target="_blank" style="color: #00bfff; text-decoration: none;">Obsidian</a></p><p style="color: #ff9800; font-size: 16px; margin: 5px;">Powered by <a href="https://github.com/jackyzha0/quartz" target="_blank" style="color: #ffcc33; text-decoration: none;">Quartz</a></p><p style="color: #4caf50; font-size: 16px; margin: 5px;">Hosted on <a href="https://pages.github.com/" target="_blank" style="color: #66bb6a; text-decoration: none;">GitHub Pages</a></p></div></footer></div></div></body><script type="application/javascript">function c(){let t=this.parentElement;t.classList.toggle("is-collapsed");let l=t.classList.contains("is-collapsed")?this.scrollHeight:t.scrollHeight;t.style.maxHeight=l+"px";let o=t,e=t.parentElement;for(;e;){if(!e.classList.contains("callout"))return;let n=e.classList.contains("is-collapsed")?e.scrollHeight:e.scrollHeight+o.scrollHeight;e.style.maxHeight=n+"px",o=e,e=e.parentElement}}function i(){let t=document.getElementsByClassName("callout is-collapsible");for(let s of t){let l=s.firstElementChild;if(l){l.addEventListener("click",c),window.addCleanup(()=>l.removeEventListener("click",c));let e=s.classList.contains("is-collapsed")?l.scrollHeight:s.scrollHeight;s.style.maxHeight=e+"px"}}}document.addEventListener("nav",i);window.addEventListener("resize",i);
</script><script src="https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/contrib/copy-tex.min.js" type="application/javascript"></script><script src="//prathameshdhande22.github.io/Java-Tutorial/postscript.js" type="module"></script></html>
<html lang="en"><head><title>Not Found</title><meta charset="utf-8"/><link rel="preconnect" href="https://fonts.googleapis.com"/><link rel="preconnect" href="https://fonts.gstatic.com"/><link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=IBM Plex Mono&amp;family=Schibsted Grotesk:wght@400;700&amp;family=Source Sans Pro:ital,wght@0,400;0,600;1,400;1,600&amp;display=swap"/><link rel="preconnect" href="https://cdnjs.cloudflare.com" crossorigin="anonymous"/><meta name="viewport" content="width=device-width, initial-scale=1.0"/><meta name="og:site_name" content="🛠️ Design Patterns"/><meta property="og:title" content="Not Found"/><meta property="og:type" content="website"/><meta name="twitter:card" content="summary_large_image"/><meta name="twitter:title" content="Not Found"/><meta name="twitter:description" content="Not Found"/><meta property="og:description" content="Not Found"/><meta property="og:image:type" content="image/webp"/><meta property="og:image:alt" content="Not Found"/><meta property="og:image:width" content="1200"/><meta property="og:image:height" content="630"/><meta property="og:image:url" content="https://https://prathameshdhande22.github.io/Java-Tutorial//static/og-image.png"/><meta name="twitter:image" content="https://https://prathameshdhande22.github.io/Java-Tutorial//static/og-image.png"/><meta property="og:image" content="https://https://prathameshdhande22.github.io/Java-Tutorial//static/og-image.png"/><meta property="twitter:domain" content="https://prathameshdhande22.github.io/Java-Tutorial/"/><meta property="og:url" content="https://https//prathameshdhande22.github.io/Java-Tutorial/"/><meta property="twitter:url" content="https://https//prathameshdhande22.github.io/Java-Tutorial/"/><link rel="icon" href="//prathameshdhande22.github.io/Java-Tutorial/static/icon.png"/><meta name="description" content="Not Found"/><meta name="generator" content="Quartz"/><link href="//prathameshdhande22.github.io/Java-Tutorial/index.css" rel="stylesheet" type="text/css" spa-preserve/><link href="https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/katex.min.css" rel="stylesheet" type="text/css" spa-preserve/><script src="//prathameshdhande22.github.io/Java-Tutorial/prescript.js" type="application/javascript" spa-preserve></script><script type="application/javascript" spa-preserve>const fetchData = fetch("//prathameshdhande22.github.io/Java-Tutorial/static/contentIndex.json").then(data => data.json())</script></head><body data-slug="404"><div id="quartz-root" class="page"><div id="quartz-body"><div class="left sidebar"></div><div class="center"><div class="page-header"><div class="popover-hint"></div></div><article class="popover-hint"><h1>404</h1><p>Either this page is private or doesn't exist.</p><a href="//prathameshdhande22.github.io/Java-Tutorial/">Return to Homepage</a></article><hr/><div class="page-footer"></div></div><div class="right sidebar"></div><footer class><p style="text-align:center;">Created with ❤️ by Prathamesh Dhande</p><ul style="text-align:center;"><li><a href="https://prathameshdhande22.github.io/Java-Tutorial/">GitHub</a></li><li><a href="https://www.linkedin.com/in/prathamesh-dhande-3a039721a/">LinkedIn</a></li></ul><div style="text-align: center; padding: 20px; font-family: Arial, sans-serif;"><p style="color: #007acc; font-size: 16px; margin: 5px;">Written on <a href="https://obsidian.md" target="_blank" style="color: #00bfff; text-decoration: none;">Obsidian</a></p><p style="color: #ff9800; font-size: 16px; margin: 5px;">Powered by <a href="https://github.com/jackyzha0/quartz" target="_blank" style="color: #ffcc33; text-decoration: none;">Quartz</a></p><p style="color: #4caf50; font-size: 16px; margin: 5px;">Hosted on <a href="https://pages.github.com/" target="_blank" style="color: #66bb6a; text-decoration: none;">GitHub Pages</a></p></div></footer></div></div></body><script type="application/javascript">function c(){let t=this.parentElement;t.classList.toggle("is-collapsed");let l=t.classList.contains("is-collapsed")?this.scrollHeight:t.scrollHeight;t.style.maxHeight=l+"px";let o=t,e=t.parentElement;for(;e;){if(!e.classList.contains("callout"))return;let n=e.classList.contains("is-collapsed")?e.scrollHeight:e.scrollHeight+o.scrollHeight;e.style.maxHeight=n+"px",o=e,e=e.parentElement}}function i(){let t=document.getElementsByClassName("callout is-collapsible");for(let s of t){let l=s.firstElementChild;if(l){l.addEventListener("click",c),window.addCleanup(()=>l.removeEventListener("click",c));let e=s.classList.contains("is-collapsed")?l.scrollHeight:s.scrollHeight;s.style.maxHeight=e+"px"}}}document.addEventListener("nav",i);window.addEventListener("resize",i);
</script><script src="https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/contrib/copy-tex.min.js" type="application/javascript"></script><script type="application/javascript">
const socket = new WebSocket('ws://localhost:3001')
// reload(true) ensures resources like images and scripts are fetched again in firefox
socket.addEventListener('message', () => document.location.reload(true))
</script><script src="//prathameshdhande22.github.io/Java-Tutorial/postscript.js" type="module"></script></html>
Loading

0 comments on commit c46e925

Please sign in to comment.