Tam H. Doan
1 min readFeb 14, 2020

--

How about utility methods for a specific usage that should not belong to any class?

For example, in Java, I usually create a GLUtils / TextureUtils class to group utility methods that used for OpenGLES, or a ImageUtils to manipulate all types of images (including JPEG, PNG,…).

So I think Kotlin extension functions cannot fit these cases, it’s hard to find a suitable class to put extension functions.

Secondly, I don’t think that creating __Utils class ruins auto-complete, because:

  • By grouping utils, we can avoid showing all utils in suggestions when start typing, which causes lag IDE when PC on low resources.
  • This is only a matter of preference. We already do this in Java for years.

--

--

Tam H. Doan
Tam H. Doan

Written by Tam H. Doan

Software Engineer, also a Writer and Runner

No responses yet