Open in app

Sign In

Write

Sign In

Vincent Tsen
Vincent Tsen

147 Followers

Home

About

1 day ago

DRY, KISS, and YAGNI to avoid Over-engineering Trap

Refactor and architect your code based on DRY, KISS, and YAGNI principles, beware of over-engineering trap that leads to unnecessary complexity — Throughout my career, I have seen many smart software engineers/developers fall into the trap of over-engineering without even realizing it. Let’s see why software developers tend to over-engineering and what the symptoms are. Factors that Contribute to Over-engineering

Overengineering

6 min read

DRY, KISS, and YAGNI to avoid Over-engineering Trap
DRY, KISS, and YAGNI to avoid Over-engineering Trap
Overengineering

6 min read


Jan 20

Convert Flow to SharedFlow and StateFlow

Explore different ways of converting Flow to SharedFlow and StateFlow using SharedFlow.emit(), StateFlow.value, Flow.ShareIn() and Flow.StateIn() — This is part of the asynchronous flow series: Part 1 — Exploring Android LiveData Usages and Behaviors Part 2 — Introduction to Kotlin Flows and Channels Part 3 — Exploring Different Ways to Collect Kotlin Flow Part 4 — Convert Flow to SharedFlow and StateFlow

Android App Development

6 min read

Convert Flow to SharedFlow and StateFlow
Convert Flow to SharedFlow and StateFlow
Android App Development

6 min read


Jan 13

Exploring Different Ways to Collect Kotlin Flow

Simple app to demonstrate Kotlin flow(), emit(), collectAsState(), collect(), viewModelScope.launch(), launchWhenStarted() and repeatOnLifecycle() — This is part of the asynchronous flow series: Part 1 — Exploring Android LiveData Usages and Behaviors Part 2 — Introduction to Kotlin Flows and Channels Part 3 — Exploring Different Ways to Collect Kotlin Flow Part 4 — Convert Flow to SharedFlow and StateFlow

Android Dev

4 min read

Exploring Different Ways to Collect Kotlin Flow
Exploring Different Ways to Collect Kotlin Flow
Android Dev

4 min read


Jan 6

How to add Version Catalog to your Android App?

Step-by-step guide to implement Version Catalog (a dependency management tool developed by Gradle team) into your Android app — Version Catalog is a dependency management tool developed by the Gradle team. The benefit of using it is you don’t need to hard code the version in multiple places, especially if you have a multi-modules project. This article provides a step-by-step guide to integrating Version Catalog into your Android app…

Android App Development

3 min read

How to add Version Catalog to your Android App?
How to add Version Catalog to your Android App?
Android App Development

3 min read


Dec 30, 2022

How to Convert Android Gradle Groovy to KTS?

Step-by-step guide to convert or migrate your Android project’s Gradle script from Groovy script to Kotlin script (KTS) — Introduction Gradle is the build automation tool. Android Studio uses Gradle to build the apps. Gradle can be written in these 2 domain-specify languages (DSL): Groovy Script Kotlin Script (KTS) What is Groovy? Groovy is a dynamically typed language, which means the variable types are known at run time. This is usually an interpreter…

Android Dev

5 min read

How to Convert Android Gradle Groovy to KTS?
How to Convert Android Gradle Groovy to KTS?
Android Dev

5 min read


Dec 23, 2022

launchWhenCreated() vs launchWhenStarted() vs launchWhenResumed() vs repeatOnLifeCycle()

Investigating and experimenting various LifecycleCoroutineScope launchWhenX() and repeatOnLifeCycle() function — In the previous article, we learned about LifeCycleCoroutineScope.launch(). However, there are a few additional functions in LifeCycleCoroutineScope: launchWhenCreated() launchWhenStarted() launchWhenResumed() launchWhenX() The code usage looks like this: @Composable fun DemoScreen() { val lifeCycleScope = LocalLifecycleOwner.current.lifecycleScope Button(onClick = { lifeCycleScope.launchWhenStarted { /*...*/ } }) }

Android Dev

3 min read

launchWhenCreated() vs launchWhenStarted() vs launchWhenResumed() vs repeatOnLifeCycle()
launchWhenCreated() vs launchWhenStarted() vs launchWhenResumed() vs repeatOnLifeCycle()
Android Dev

3 min read


Dec 16, 2022

GlobalScope vs viewModelScope vs lifecycleScope vs rememberCoroutineScope

Simple app to demonstrate Android Pre-defined Coroutine Scopes Comparisons — when will these Coroutine Scopes be cancelled? — The whole point of having these Android pre-defined coroutine scopes is it automatically cancels all the coroutines that are launched in this scope, so you don’t need to explicitly cancel them. The exception is GlobalScope survives until process death. GlobalScope GlobalScope never gets canceled, even when the activity is destroyed/finished. If…

Android Dev

4 min read

GlobalScope vs viewModelScope vs lifecycleScope vs rememberCoroutineScope
GlobalScope vs viewModelScope vs lifecycleScope vs rememberCoroutineScope
Android Dev

4 min read


Dec 9, 2022

Understand “by” Delegated Properties in Kotlin

Simple way to understand “by” operator (used for delegated properties) in Kotlin and the reasons to use it. — When I first learned Kotlin, the by operator is an alien to me. What the hell is that? In this article, I'm going to provide a simple example to show the reasons why we want to use this by operator. Custom Property get() and set() Let’s say I want to create a custom property get()…

Kotlin

4 min read

Understand “by” Delegated Properties in Kotlin
Understand “by” Delegated Properties in Kotlin
Kotlin

4 min read


Dec 2, 2022

Implement Kotlin Interfaces with SAM conversions

Different ways of implementing Kotlin interfaces — using subclass conventional method, object keyword and functional (SAM) interfaces — While experimenting LiveData observer, I encountered the following code and I had no idea how it works. val observer = Observer<T> { state.value = it } So I looked at the Observer source code in Java. It looks like this. public interface Observer<T> { void onChanged(T t); }

Kotlin

2 min read

Implement Kotlin Interfaces with SAM conversions
Implement Kotlin Interfaces with SAM conversions
Kotlin

2 min read


Nov 25, 2022

How to Take Screenshot from Android Emulator?

You can take screenshot either from the Android Emulator controls menu or Android Studio Logcat menu — I was so stupid, I have been taking screenshot manually (using the Windows Snipping Tool) from Android emulator without knowing there is already “Screen Capture” feature in Android Studio. These are 2 ways to take screenshot from your Android Emulator: Android Emulator Controls Menu Click on the camera icon

Android Dev

2 min read

How to Take Screenshot from Android Emulator?
How to Take Screenshot from Android Emulator?
Android Dev

2 min read

Vincent Tsen

Vincent Tsen

147 Followers

Self-taught Hobbyist Native Android Kotlin Developer | https://vtsen.hashnode.dev/

Help

Status

Writers

Blog

Careers

Privacy

Terms

About

Text to speech