Search

Lessons (40)

  • Arrays & Strings

    … a brand-new string ⚠️ Building a string with += inside a big loop may copy the string again and …

  • TypeScript Essentials

    … string number Date) { if (typeof value === "string") return value.toUpperCase(); // value: string here if (typeof value === "number") return …

  • Hexagonal Architecture (Ports & Adapters)

    … ts export class Loan { constructor(readonly bookId: string, readonly memberId: string, readonly dueDate: Date) {} isOverdue(today: Date) { return …

  • I — Interface Segregation Principle

    … it uses function Avatar({ src, name }: { src: string; name: string }) { return <img src={src} alt={name} / ; } <Avatar src …

  • Clean Architecture in Depth

    … view model (formatted strings, dates, currency) In many web apps, returning a response DTO from the use case …

  • REST vs GraphQL vs gRPC

    … string order id = 1; } message Order { string id = 1; string customer id = 2; double total = 3; repeated string …

  • Microkernel (Plugin) Architecture

    … MarkdownPlugin { name: string; version: string; / Transform raw markdown before parsing (optional hook) / beforeParse?(markdown: string): string; / Transform the …

  • Domain-Driven Design: Tactical Patterns

    … No more re-validating strings all over the code. Aggregates: the consistency boundary ⭐ An aggregate is a group …

  • Topics, Partitions & Offsets

    … JSON.stringify({ type: "OrderPlaced" }) }, { key: "order-42", value: JSON.stringify({ type: "OrderPaid" }) }, // same partition, after Placed { key: "order …

  • MVC, MVP & MVVM

    … string): void; goToDashboard(): void; } class LoginPresenter { constructor(private view: LoginView, private auth: AuthService) {} async onLoginClicked(email: string, password …

  • Domain-Driven Design: Strategic Design

    … us this… type ErpCustomerRecord = { CUST NO: string; NM1: string; NM2: string; STAT CD: "A" "I" "B" }; // …our Billing …

  • Dynamic Programming

    … a 2D table, longest common subsequence Longest sequence of characters appearing in the same order in both strings …

  • Backend Languages: Node.js, Go, Python & Rust

    … go results := make(chan string) for , url := range urls { go func(u string) { results <- fetch(u) }(url) // all …

  • Serverless Architecture

    … JSON.stringify({ id: order.id }) }; }; ts // Triggered by an S3 upload: create a thumbnail export const handler = async …

  • Event-Driven Architecture

    … E) = Promise<void ; class EventBus { private handlers = new Map<string, Handler<any [] (); on<E extends { type: string } (type …

  • Vertical Slice Architecture & the Modular Monolith

    … s public API export type ProductSnapshot = { id: string; name: string; priceCents: number }; export { getProductSnapshot } from "./application/getProductSnapshot"; // modules …

  • Caching & Redis

    … Its data types solve many real problems: Type Commands Use case --- --- --- String SET , GET , INCR , EXPIRE Cache, counters …

  • Comments & Formatting

    … the source currency. @param {string} from - ISO code, for example "USD". @param {string} to - ISO code, for example …

  • Small Functions That Do One Thing

    … isValidEmail = (email) = typeof email === "string" && email.includes("@"); const isStrongPassword = (password) = typeof password === "string" && password.length = 8; async function …

  • Two Pointers & Sliding Window

    Two techniques that turn many O(n²) array and string problems into O(n). Learn them with animated …

  • Layered (N-Tier) Architecture

    … OrderService { constructor(private repo: OrderRepository) {} async placeOrder(customerId: string, items: OrderItem[]) { if (items.length === 0) throw new ValidationError …

  • Next.js Rendering: CSR, SSR, SSG, ISR & Server Components

    … from "react"; export default function AddToCartButton({ productId }: { productId: string }) { const [added, setAdded] = useState(false); return <button onClick={() = setAdded …

  • Structural Patterns: How to Connect Objects

    … 100 }; // JavaScript has Proxy built in const guardedUser = new Proxy(user, { get(target, prop) { console.log( read ${String …

  • DRY: Don't Repeat Yourself

    … z.string().email(), age: z.number().int().min(18), }); export type User = z.infer<typeof userSchema ; ⚠️ The trap …

  • Clean Error Handling

    … Use specific error types Generic Error("something failed") forces callers to parse strings. Custom error classes let them …

  • L — Liskov Substitution Principle

    … either, same promises / } If redisStorage.get returned a string "null" where memoryStorage.get returned undefined , callers would break …

  • Hash Maps & Sets

    … has(2); // true seen.size; // 3 // Plain object: string/symbol keys only; fine for simple records const counts …

  • Code Smells & Refactoring

    … 6 Primitive obsession Money as number , email as string everywhere Replace Primitive with Object 7 Switch statements Same …

  • What Is Apache Kafka?

    … JSON.stringify({ orderId: "ord 42", totalCents: 8997 }) }], }); // Consumer: read events as part of a group const consumer = kafka …

  • Kafka vs RabbitMQ & the Kafka Ecosystem

    … builder.stream("shop.orders.placed", Consumed.with(Serdes.String(), orderSerde)) .groupByKey() .windowedBy(TimeWindows.ofSizeWithNoGrace(Duration.ofMinutes(1))) .count …

  • Message Queues & RabbitMQ

    … true }); // survives broker restart channel.sendToQueue( "emails", Buffer.from(JSON.stringify({ to: "ana@mail.com", template: "welcome" })), { persistent …

  • ConfigMaps, Secrets & Storage

    … Opaque stringData: plain text here; stored base64-encoded DATABASE URL: "postgres://shop:s3cr3t@postgres:5432/shop" STRIPE API …

  • DSA Interview Patterns Cheat Sheet

    … study plan Week Focus --- --- 1 Big-O, arrays, strings, hash maps 2 Two pointers, sliding window, prefix sums …

  • Kafka Producers

    … JSON.stringify({ orderId: order.id, customerId: order.customerId, totalCents: order.totalCents }), headers: { eventType: "OrderPlaced", eventId: crypto.randomUUID(), schemaVersion …

  • REST API Design

    … name: id, in: path, required: true, schema: { type: string } } responses: "200": { description: The user, content: { application/json: { schema …

  • Authentication, Authorization & API Security

    … 1=1 -- returns every row Parameterised queries , never string-concatenate input Excessive data exposure API returns passwordHash because …

  • Sorting Algorithms

    … often partly sorted. js // ⚠️ Default sort compares as STRINGS [10, 9, 1, 100].sort(); // [1, 10, 100, 9 …

  • Resilience Patterns

    … JSON.stringify(payment), signal: AbortSignal.timeout(2000), // give up after 2 s }); 💡 Base timeouts on the dependency's …

  • Normalization & Denormalization

    … A query cannot safely join, constrain, index, or update one item inside that string. Good 1NF shape: one …

  • React Hooks in Practice

    … return initialValue; } }); useEffect(() = { try { localStorage.setItem(key, JSON.stringify(value)); } catch {} }, [key, value]); return [value, setValue]; } // Use it …