Читать книгу Programming Kotlin Applications - Бретт Мак-Лахлин, Brett McLaughlin - Страница 74

Try to Avoid Overusing Names

Оглавление

This code is still pretty confusing, though. You have properties named the same as inputs to your constructor, which is legal, but a pain to understand and follow. One easy solution, and a common one in the Kotlin community, is to use an underscore for non–property value names passed into constructors. Listing 2.6 shows this change; it's purely cosmetic but really cleans up the readability of the class.

Programming Kotlin Applications

Подняться наверх