
		<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
			<channel>
				<title>MikeDaDev&#39;s Blog – stories, insights &amp; ideas</title>
				<link>https://mike.tungdadev.com/blog</link>
				<description>A personal space on the cloud where I document my programming journey, sharing lessons, insights and resources for fellow developers.</description>
				<language>en</language>
				<managingEditor>bthanhtung.ite@gmail.com (MikeDaDev)</managingEditor>
				<webMaster>bthanhtung.ite@gmail.com (MikeDaDev)</webMaster>
				<lastBuildDate>Sun, 23 Feb 2025 00:00:00 GMT</lastBuildDate>
				<atom:link href="https://mike.tungdadev.com/tags/design-patterns/feed.xml" rel="self" type="application/rss+xml"/>
				
		<item>
			<guid>https://mike.tungdadev.com/blog/design-patterns-spring</guid>
			<title>Design Patterns in Spring Boot: 9 Patterns That Tame if/else Sprawl</title>
			<link>https://mike.tungdadev.com/blog/design-patterns-spring</link>
			<description>Does your service balloon every time someone adds another if/else branch? Nine patterns I use daily in Spring Boot, how dependency injection already does most of the work, and the traps to watch for in production.</description>
			<pubDate>Sun, 23 Feb 2025 00:00:00 GMT</pubDate>
			<author>bthanhtung.ite@gmail.com (MikeDaDev)</author>
			<category>design-patterns</category><category>spring-boot</category><category>clean-code</category>
		</item>
	
		<item>
			<guid>https://mike.tungdadev.com/blog/visitor-pattern</guid>
			<title>The Visitor pattern in Java: double dispatch and when to use a switch</title>
			<link>https://mike.tungdadev.com/blog/visitor-pattern</link>
			<description>Why call element.accept(visitor) just so that it can call visitor.visit(this)? The double dispatch mechanism of the Visitor Pattern through an AST engine, and when Pattern Matching with a Sealed Interface can replace it.</description>
			<pubDate>Sat, 08 Feb 2025 00:00:00 GMT</pubDate>
			<author>bthanhtung.ite@gmail.com (MikeDaDev)</author>
			<category>design-patterns</category><category>java</category><category>clean-code</category>
		</item>
	
		<item>
			<guid>https://mike.tungdadev.com/blog/iterator-pattern</guid>
			<title>The Iterator pattern in Java: modCount, Spliterator and 10 million rows</title>
			<link>https://mike.tungdadev.com/blog/iterator-pattern</link>
			<description>Removing an element inside a for-each sometimes throws ConcurrentModificationException and sometimes silently skips an item. A look at modCount, Spliterator and how to walk 10 million DB rows without an OOM.</description>
			<pubDate>Sat, 25 Jan 2025 00:00:00 GMT</pubDate>
			<author>bthanhtung.ite@gmail.com (MikeDaDev)</author>
			<category>design-patterns</category><category>java</category><category>data-structures</category><category>performance</category>
		</item>
	
		<item>
			<guid>https://mike.tungdadev.com/blog/command-pattern</guid>
			<title>Command pattern: from undo/redo to CQRS and Saga</title>
			<link>https://mike.tungdadev.com/blog/command-pattern</link>
			<description>The remote-control-and-light example makes the Command pattern look useless. Here it is used for thread-safe undo/redo, CQRS and compensating transactions in a Saga, with Java code.</description>
			<pubDate>Sun, 12 Jan 2025 00:00:00 GMT</pubDate>
			<author>bthanhtung.ite@gmail.com (MikeDaDev)</author>
			<category>design-patterns</category><category>architecture</category><category>java</category>
		</item>
	
		<item>
			<guid>https://mike.tungdadev.com/blog/strategy-pattern</guid>
			<title>Strategy Pattern with Spring Boot: Fewer Needless Classes, Beans Without State</title>
			<link>https://mike.tungdadev.com/blog/strategy-pattern</link>
			<description>A 10,000 VND coupon that takes 30,000 off the third order? The Strategy Pattern with Java lambdas and Spring Boot: how it differs from State and Template Method, and how to build a stateless promotion engine.</description>
			<pubDate>Sat, 28 Dec 2024 00:00:00 GMT</pubDate>
			<author>bthanhtung.ite@gmail.com (MikeDaDev)</author>
			<category>design-patterns</category><category>spring-boot</category><category>clean-code</category><category>java</category>
		</item>
	
		<item>
			<guid>https://mike.tungdadev.com/blog/observer-pattern</guid>
			<title>Observer pattern in Spring: events after commit, @Async, backpressure</title>
			<link>https://mike.tungdadev.com/blog/observer-pattern</link>
			<description>A listener times out sending an email and rolls back the whole order? Observer in Spring Boot: @TransactionalEventListener AFTER_COMMIT, bounded @Async, backpressure and when you need Kafka.</description>
			<pubDate>Sat, 14 Dec 2024 00:00:00 GMT</pubDate>
			<author>bthanhtung.ite@gmail.com (MikeDaDev)</author>
			<category>design-patterns</category><category>spring-boot</category><category>java</category><category>architecture</category>
		</item>
	
		<item>
			<guid>https://mike.tungdadev.com/blog/facade-pattern</guid>
			<title>Facade Pattern: from a tidy class to an Anti-Corruption Layer</title>
			<link>https://mike.tungdadev.com/blog/facade-pattern</link>
			<description>Does your controller have to call five services in exactly the right order just to open an account? A Facade puts them behind a single entry point. Here is how it differs from an Adapter and how it grows into an Anti-Corruption Layer.</description>
			<pubDate>Sat, 30 Nov 2024 00:00:00 GMT</pubDate>
			<author>bthanhtung.ite@gmail.com (MikeDaDev)</author>
			<category>design-patterns</category><category>architecture</category><category>microservices</category>
		</item>
	
		<item>
			<guid>https://mike.tungdadev.com/blog/abstract-pattern</guid>
			<title>Abstract Factory Pattern: escaping vendor lock-in in a multi-cloud setup</title>
			<link>https://mike.tungdadev.com/blog/abstract-pattern</link>
			<description>If AWS SDK calls are scattered across your code, switching clouds means a painful rewrite. Use Abstract Factory to put storage, queue and secrets behind one set of interfaces, and know the price of the lowest common denominator.</description>
			<pubDate>Sat, 23 Nov 2024 00:00:00 GMT</pubDate>
			<author>bthanhtung.ite@gmail.com (MikeDaDev)</author>
			<category>design-patterns</category><category>java</category><category>architecture</category>
		</item>
	
		<item>
			<guid>https://mike.tungdadev.com/blog/decorator-pattern</guid>
			<title>The Decorator pattern in Java: wrap it yourself or let Spring AOP do it</title>
			<link>https://mike.tungdadev.com/blog/decorator-pattern</link>
			<description>When should you write a Decorator by hand instead of relying on a Spring AOP proxy? How to avoid class explosion, deal with the self-invocation trap and wrap Redis caching safely.</description>
			<pubDate>Sat, 16 Nov 2024 00:00:00 GMT</pubDate>
			<author>bthanhtung.ite@gmail.com (MikeDaDev)</author>
			<category>design-patterns</category><category>spring-boot</category><category>java</category>
		</item>
	
		<item>
			<guid>https://mike.tungdadev.com/blog/adapter-pattern</guid>
			<title>Adapter pattern: keeping the domain clean when you connect Stripe and a legacy core banking system</title>
			<link>https://mike.tungdadev.com/blog/adapter-pattern</link>
			<description>Need to call Stripe and a socket-based core banking system without letting SDKs and byte strings leak into your domain model? Adapter, Ports &amp; Adapters and the Anti-Corruption Layer in Java.</description>
			<pubDate>Sat, 02 Nov 2024 00:00:00 GMT</pubDate>
			<author>bthanhtung.ite@gmail.com (MikeDaDev)</author>
			<category>design-patterns</category><category>architecture</category><category>java</category>
		</item>
	
		<item>
			<guid>https://mike.tungdadev.com/blog/prototype-pattern</guid>
			<title>The Prototype pattern in Java: drop Cloneable, deep copy safely</title>
			<link>https://mike.tungdadev.com/blog/prototype-pattern</link>
			<description>Why is Cloneable considered a broken design in Java? Shallow vs deep copy, and 4 safe ways to clone objects in production: Copy Constructor, Jackson, Kryo and Record Withers.</description>
			<pubDate>Sat, 19 Oct 2024 00:00:00 GMT</pubDate>
			<author>bthanhtung.ite@gmail.com (MikeDaDev)</author>
			<category>design-patterns</category><category>java</category><category>performance</category>
		</item>
	
		<item>
			<guid>https://mike.tungdadev.com/blog/builder-pattern</guid>
			<title>The Builder pattern in Java: staged builders, records and the Lombok trap</title>
			<link>https://mike.tungdadev.com/blog/builder-pattern</link>
			<description>A builder that forgets a required field compiles happily, then blows up at runtime. A Staged Builder turns that into a compile error. Plus how to copy collections defensively and the traps in Lombok @Builder.</description>
			<pubDate>Sat, 05 Oct 2024 00:00:00 GMT</pubDate>
			<author>bthanhtung.ite@gmail.com (MikeDaDev)</author>
			<category>design-patterns</category><category>java</category><category>clean-code</category>
		</item>
	
		<item>
			<guid>https://mike.tungdadev.com/blog/spring-dependency-injection</guid>
			<title>Dependency injection in Spring: @Autowired, @Qualifier and @Primary</title>
			<link>https://mike.tungdadev.com/blog/spring-dependency-injection</link>
			<description>App will not start because of NoUniqueBeanDefinitionException, or unit tests have to boot a whole Spring Context? Use @Autowired, @Qualifier, @Primary, @Value and ObjectProvider properly.</description>
			<pubDate>Sat, 14 Sep 2024 00:00:00 GMT</pubDate>
			<author>bthanhtung.ite@gmail.com (MikeDaDev)</author>
			<category>spring-boot</category><category>design-patterns</category><category>java</category>
		</item>
	
		<item>
			<guid>https://mike.tungdadev.com/blog/factory-pattern</guid>
			<title>Factory pattern in Spring Boot: drop the switch-case, keep Open/Closed</title>
			<link>https://mike.tungdadev.com/blog/factory-pattern</link>
			<description>Do you edit PaymentFactory every time you add a payment gateway? Collect beans automatically with Map injection in Spring Boot, build factories from a Supplier, and learn when you need an Abstract Factory.</description>
			<pubDate>Sat, 07 Sep 2024 00:00:00 GMT</pubDate>
			<author>bthanhtung.ite@gmail.com (MikeDaDev)</author>
			<category>design-patterns</category><category>spring-boot</category><category>clean-code</category>
		</item>
	
		<item>
			<guid>https://mike.tungdadev.com/blog/singleton-pattern</guid>
			<title>Singleton pattern: volatile in DCL, Enum and Spring beans</title>
			<link>https://mike.tungdadev.com/blog/singleton-pattern</link>
			<description>Why does Double-Checked Locking in a Singleton require volatile? JIT/CPU instruction reordering, the Bill Pugh Holder, Enum, and management through Spring IoC.</description>
			<pubDate>Sat, 24 Aug 2024 00:00:00 GMT</pubDate>
			<author>bthanhtung.ite@gmail.com (MikeDaDev)</author>
			<category>design-patterns</category><category>java</category><category>concurrency</category>
		</item>
	
		<item>
			<guid>https://mike.tungdadev.com/blog/if-else-stop</guid>
			<title>Stop piling on if-else: replace it with an Enum, Factory, Strategy or Map</title>
			<link>https://mike.tungdadev.com/blog/if-else-stop</link>
			<description>A shipping-cost method buried in if-else branches, refactored four ways: Enum, Factory, Strategy, and Stream with a Map. Which is the leanest, which scales best, and when to stop.</description>
			<pubDate>Sat, 10 Aug 2024 00:00:00 GMT</pubDate>
			<author>bthanhtung.ite@gmail.com (MikeDaDev)</author>
			<category>clean-code</category><category>design-patterns</category><category>java</category>
		</item>
	
		<item>
			<guid>https://mike.tungdadev.com/blog/solid</guid>
			<title>SOLID in Java: the 5 principles through a bank account example</title>
			<link>https://mike.tungdadev.com/blog/solid</link>
			<description>Rewording a statement and breaking the withdrawal logic? Learn the 5 SOLID principles in Java through a bank account example: split by actor, keep the contract when inheriting, invert dependencies.</description>
			<pubDate>Sat, 13 Jul 2024 00:00:00 GMT</pubDate>
			<author>bthanhtung.ite@gmail.com (MikeDaDev)</author>
			<category>clean-code</category><category>java</category><category>design-patterns</category>
		</item>
	
		<item>
			<guid>https://mike.tungdadev.com/blog/spring-di</guid>
			<title>Spring IoC and DI: the bean lifecycle, the three-level cache, and why to drop field injection</title>
			<link>https://mike.tungdadev.com/blog/spring-di</link>
			<description>Typing @Autowired every day but unsure how beans are actually created? DIP vs IoC vs DI, the bean lifecycle, the three-level cache that resolves circular dependencies, and why you should drop field injection.</description>
			<pubDate>Sat, 05 Aug 2023 00:00:00 GMT</pubDate>
			<author>bthanhtung.ite@gmail.com (MikeDaDev)</author>
			<category>spring-boot</category><category>design-patterns</category><category>clean-code</category>
		</item>
	
		<item>
			<guid>https://mike.tungdadev.com/snippets/event-emitter</guid>
			<title>Simple Event-Emitter/PubSub pattern</title>
			<link>https://mike.tungdadev.com/snippets/event-emitter</link>
			<description>A lightweight pub/sub mechanism to handle custom events without adding a full-blown library.</description>
			<pubDate>Mon, 06 Sep 2021 00:00:00 GMT</pubDate>
			<author>bthanhtung.ite@gmail.com (MikeDaDev)</author>
			<category>javascript</category><category>design-patterns</category>
		</item>
	
			</channel>
		</rss>
	