Reddit Programming – Telegram
Reddit Programming
211 subscribers
1.22K photos
125K links
I will send you newest post from subreddit /r/programming
Download Telegram
Understanding the Decorator Design Pattern in Go: A Practical Guide
https://www.reddit.com/r/programming/comments/1q951tn/understanding_the_decorator_design_pattern_in_go/

<!-- SC_OFF -->Hey folks 👋 I just published a deep-dive blog on the Decorator Design Pattern in Go — one of those patterns you probably already use without realizing it (middleware, io.Reader, logging wrappers, etc.). The post walks through the pattern from a very practical, Go-centric angle: What the Decorator pattern really is (intent, definition, and the problem it solves) A clean, idiomatic Go implementation with interfaces How stacking multiple decorators actually works at runtime Common variations and extensions (logging, caching, compression) Performance & concurrency considerations in real systems Pros, cons, and common mistakes to avoid in Go If you’ve ever wrapped an http.Handler, chained bufio + gzip, or built middleware pipelines — this pattern is already part of your toolbox. The blog just puts a solid mental model behind it. Read here: https://medium.com/design-bootcamp/understanding-the-decorator-design-pattern-in-go-a-practical-guide-493b4048f953 <!-- SC_ON --> submitted by /u/priyankchheda15 (https://www.reddit.com/user/priyankchheda15)
[link] (https://medium.com/design-bootcamp/understanding-the-decorator-design-pattern-in-go-a-practical-guide-493b4048f953) [comments] (https://www.reddit.com/r/programming/comments/1q951tn/understanding_the_decorator_design_pattern_in_go/)
flow - a keyboard first Kanban board in the terminal
https://www.reddit.com/r/programming/comments/1q9g7wp/flow_a_keyboard_first_kanban_board_in_the_terminal/

<!-- SC_OFF -->I built a small keyboard first Kanban board that runs entirely in the terminal. It focuses on fast keyboard workflows and avoiding context switching just to move work around. Runs out of the box with a demo board loaded from disk and supports local persistence. Repo: https://github.com/jsubroto/flow <!-- SC_ON --> submitted by /u/MYGRA1N (https://www.reddit.com/user/MYGRA1N)
[link] (https://github.com/jsubroto/flow) [comments] (https://www.reddit.com/r/programming/comments/1q9g7wp/flow_a_keyboard_first_kanban_board_in_the_terminal/)
chr2 - a deterministic replicated log with a durable outbox for side effects
https://www.reddit.com/r/programming/comments/1q9jc36/chr2_a_deterministic_replicated_log_with_a/

<!-- SC_OFF -->Existing consensus libraries replicate logs and elect leaders. They do not solve the part that actually breaks production systems: crash safe side effects. The moment your state machine sends an email, charges a card, or fires a webhook, you’ve stepped outside consensus. If the leader crashes after performing the side effect but before committing it, failover turns retries into duplicates unless you bolt on a second protocol. I kept re implementing that second protocol. chr2 is my attempt to make it explicit. mechanism: -deterministic apply context: application code receives block_time from the log header and a deterministic RNG seed derived from the previous hash, so replay produces identical state transitions. - crash safe WAL: entries are CRC’d, payload hashed, and hash chained. Recovery is strict, torn tails are truncated; mid-log corruption halts. - durable fencing for view changes: a manifest persists the highest view and votes using atomic tmp+fsync+rename, rejecting messages from zombie leaders after restart. - replicated outbox: side effects are stored as "pending" in replicated state. Only the leader executes them under a fencing token. Completion is recorded by committing an acknowledge event, so failover only re-executes effects that were never durably acknowledged. Trade-offs (because there always are): Side effects are intentionally at-least-once; “exactly once” requires sinks to dedupe using stable effect IDs. The system prefers halting on ambiguous disk states over guessing. Some pieces are still being tightened (e.g. persisting client request dedupe state as replicated data rather than an in memory cache). Repo: https://github.com/abokhalill/chr2 If you’ve ever had “exactly once” collapse the first time a leader died mid-flight, this problem shape will look familiar. <!-- SC_ON --> submitted by /u/AdministrativeAsk305 (https://www.reddit.com/user/AdministrativeAsk305)
[link] (https://github.com/abokhalill/chr2) [comments] (https://www.reddit.com/r/programming/comments/1q9jc36/chr2_a_deterministic_replicated_log_with_a/)
Built a real-time vessel tracker using H3 hexagonal spatial indexing for proximity detection
https://www.reddit.com/r/programming/comments/1q9jplj/built_a_realtime_vessel_tracker_using_h3/

<!-- SC_OFF -->Wrote up the full implementation here if you're interested in the technical details: https://dev-jeb.com/deliberate/portal/blog/ocean-terminal-vessel-tracker <!-- SC_ON --> submitted by /u/dev_jeb (https://www.reddit.com/user/dev_jeb)
[link] (https://dev-jeb.com/deliberate/portal/showcase/ocean-terminal-vessel-tracker) [comments] (https://www.reddit.com/r/programming/comments/1q9jplj/built_a_realtime_vessel_tracker_using_h3/)
Reading CPython bytecode with dis: stack execution walkthrough (Length: 3:43)
https://www.reddit.com/r/programming/comments/1q9wonq/reading_cpython_bytecode_with_dis_stack_execution/

<!-- SC_OFF -->Short walkthrough of how CPython executes bytecode using the stack model (push/pop), using Python’s built-in dis module. Covers LOAD_CONST, STORE_NAME/STORE_FAST, LOAD_NAME, BINARY_OP, plus PUSH_NULL, CALL, POP_TOP in a print() call flow. Useful if you’ve seen dis output and wanted a mental model. <!-- SC_ON --> submitted by /u/mdns-99 (https://www.reddit.com/user/mdns-99)
[link] (https://youtu.be/LH2Y15OkG64?si=inerlenGM8r8DfH6) [comments] (https://www.reddit.com/r/programming/comments/1q9wonq/reading_cpython_bytecode_with_dis_stack_execution/)
We default to addition
https://www.reddit.com/r/programming/comments/1qa64pk/we_default_to_addition/

<!-- SC_OFF -->Subtracting usually takes more effort and is not our default approach to solving problems; after all, how deleting something can produce value? Doesn't less mean worse? But so often, reducing complexity and streamlining process by simplifying them - taking something out, rather than adding something in - leads to true improvement, instead of adding more and more and more - tools, technologies and features. Useful perspective to have when solving the next problem - maybe the solution is to delete/simplify, instead of adding? <!-- SC_ON --> submitted by /u/BinaryIgor (https://www.reddit.com/user/BinaryIgor)
[link] (https://www.ufried.com/blog/addition_bias/) [comments] (https://www.reddit.com/r/programming/comments/1qa64pk/we_default_to_addition/)