The Singleton pattern is a way to guarantee that a class has only one instance throughout your entire application Factory Method pattern creates objects without specifying exact class. Abstract Factory Create families of related objects. Builder Construct complex objects step-by-step. Prototype Clone objects without depending on their class. Adapter Make incompatible interfaces work together. Decorator … Continue reading Common Design Patterns
Uncategorized
SOLID Principle
S — Single Responsibility Principle (SRP) A class should have one job and only one reason to change. Below codes separate printer, saver to different classes class Report: def __init__(self, data): self.data = data class ReportPrinter: def print(self, report: Report): print(report.data) class ReportSaver: def save(self, report: Report, filename): with open(filename, 'w') as f: f.write(report.data) O … Continue reading SOLID Principle
Applying U(1) Symmetry to Noether’s Theorem Leading to Conservative Charge
Starting from Noether's theorem, the U(1) symmetry is associated with a conserved quantity, thereby necessitating its representation in an alternative formulation. Then we need to consider the complex field rather than scalar field, hence Then there is a leap on interpreting Q as charger operator or Number (of charges) operator.
If Time Is Independent, There Is No Causality
Newton and Galileo never questioned that time is independent, but it is! Just need to think like Einstein! Setup Two identical light bulbs, A and B, are placed at equal distances on either side of a person standing still at the center on a train platform. The bulbs are programmed to flash at the same … Continue reading If Time Is Independent, There Is No Causality
System Design Concepts
One need to understand these basic concepts for system designing DNS: domain name system APIs has Restful and GraphQL two types CAP Theorem Websocket Webhook Monolithic Architecture versus Microservices Message Queues Elastic Search: stores data in JSON documents (kind of like a flexible NoSQL database); It builds a structure called an inverted index — think … Continue reading System Design Concepts
System Designing Examples
Very good lectures from "hello interview", sketching out the designing in below forms, Uber:
Learn and Use Redis
Redis (REmote DIctionary Server) is an in-memory data structure store, used as: A database; A cache; A message broker. It is known for ultra-low latency and high performance, often measured in microseconds. Let's build a tiny Redis clone in Python to understand the core mechanics of Redis. import socket import threading # In-memory key-value store … Continue reading Learn and Use Redis
What Defines a Human Being
In Einstein's autobiography, he said what defines a human being is not what he does or suffers but what he think and how he thinks!
From Waves to Vectors: How Schrödinger’s Equation Led to Hilbert Space
When Erwin Schrödinger developed his famous equation in 1925-1926, he formulated it as a wave equation for matter waves (inspired by de Broglie). He was thinking in terms of differential equations and their solutions (wavefunctions, ψ) in configuration space. His primary goal was to find an equation that yielded the correct quantized energy levels for … Continue reading From Waves to Vectors: How Schrödinger’s Equation Led to Hilbert Space
Gauge Symmetry Should be Phase Symmetry
Walk into any discussion about fundamental physics, especially particle physics and the Standard Model, and you'll inevitably hear the term "gauge symmetry." It's lauded as a cornerstone principle, the very foundation upon which our understanding of forces (like electromagnetism, the weak force, and the strong force) is built. It’s powerful, elegant, and... somewhat misleadingly named. … Continue reading Gauge Symmetry Should be Phase Symmetry