SPRING / NOTES</>↗Spring01 Jul 2026
In Spring, Dependency Injection (DI) means you let the Spring container create and provide the objects your class depends on, instead of manually creating them with new. The recommended approach in modern Spring is constructor injection. 1. Define a dependency as a Spring bean import org.springframework.stereotype.Component; @Component public class EmailSender { public void send(String message) […]
SPRING / NOTES</>↗Spring01 Jul 2026
The easiest way to understand what the Spring Framework actually does is to stop thinking of it as “magic” and start thinking of it as infrastructure code that your application delegates to. At a high level: Spring creates objects, wires them together, manages their lifecycle, and adds common behavior around them so you do not […]
KOTLIN / NOTES</>↗Kotlin01 Jul 2026
When working with deeply nested nullable data in Kotlin, the goal is to keep code both safe and understandable without building long, fragile chains or overusing !!. 1. Avoid very long safe-call chains when they hide meaning This is safe: val city = user?.profile?.address?.city ?: "Unknown" For simple reads, that is perfectly fine. But if […]
KOTLIN / NOTES</>↗Kotlin01 Jul 2026
In Kotlin Flow code, scope functions are useful, but they should usually play a supporting role. The main structure of your reactive pipeline should come from Flow operators such as map, filter, flatMapLatest, combine, onEach, catch, and stateIn. A good rule of thumb: Flow operators describe the stream. Scope functions describe what you do with […]
KOTLIN / NOTES</>↗Kotlin01 Jul 2026
You can avoid “nullable everywhere” in complex data models by making missing/invalid/loading/error states explicit in the type system instead of representing them with null. In Kotlin, the usual tools are: Sealed classes/interfaces for domain states and variants. Result<T>-style wrappers for success/failure. Non-nullable data classes for valid, fully constructed domain objects. Mapping layers from nullable external […]
KOTLIN / NOTES</>↗Kotlin01 Jul 2026
In Kotlin, you can eliminate redundant null checks by letting the compiler smart cast a nullable value after you prove it is not null. Basic smart cast fun printLength(text: String?) { if (text != null) { println(text.length) } } Inside the if block, Kotlin knows text cannot be null, so it treats it as a […]