JavaRush
AI Academy
new
Promotion
Learning
Courses
Tasks
Quizzes
Games
Help
Schedule of nudges
Internship
Community
Users
Forum
Chat
Articles
Success stories
Activities
Reviews
Subscriptions
Light theme

Lectures

  • Reviews
  • About us
  • CS50
Start
Start learning
Start learning
  • My progress
  • Courses
  • Quest map
  • Lectures
  • Encapsulation and property visibility: public / private / internal

    Kotlin SELF
    32 level,0 lecture
    We break down encapsulation in Kotlin through visibility control: why public by default is an “open door”, how private protects state and invariants, and where internal is appropriate (access within a module). Using Expense and ExpenseBook as examples, we show why you shouldn’t expose a MutableList, how to return a safe List snapshot, and how to validate data correctness via require ( ).
    Open
  • Getters and setters in Kotlin: private set, computed properties, and field

    Kotlin SELF
    32 level,1 lecture
    We break down why a property in Kotlin is a mini API: reading goes through get(), writing — through set(value). We learn how to “open” reads and “close” writes with private set, how to make computed properties (display properties) without storage, and how to work correctly with a backing field via field. Separately: validation/normalization in the setter ( require(...), trim()) and common mistakes (recursion in a setter, “expensive” computed properties, scattered validation).
    Open
  • lateinit — deferred initialization and safe class API design

    Kotlin SELF
    32 level,2 lecture
    We break down when it makes sense to use lateinit in Kotlin: how to declare non-null properties without initialization, what limitations exist ( val and primitives), what happens on early access, and how to design “two-stage readiness” via init(...) + check(...)/ require(...). We reinforce it with a practical example of a console session BudgetBuddySession.
    Open
  • by lazy — lazy evaluation and result caching

    Kotlin SELF
    32 level,3 lecture
    We break down the delegated property val x by lazy { ... }: when exactly the block is executed, what and how gets cached, how lazy differs from a computed property via get ( ) and from lateinit, and what pitfalls appear due to stale cache, side effects, and thread-safety nuances.
    Open
  • Property delegates: Delegates.observable as a reaction to assignment

    Kotlin SELF
    32 level,4 lecture
    We break down how to use a delegated property in Kotlin via by and the ready-made delegate Delegates.observable: when the handler is called (after assignment), what parameters it receives ( old/ new and property metadata), how not to break encapsulation with private set, and where this approach is especially convenient—logging, a “dirty” flag, a change counter. At the end—common mistakes: recursion in the handler, trying to validate “after the write”, and noisy logging.
    Open
Learn
  • Registration
  • Java course
  • Help with tasks
  • Pricing
Community
  • Users
  • Articles
  • Forum
  • Chat
  • Success stories
  • Activities
Company
  • About us
  • Contacts
  • Reviews
  • FAQ
  • Support
JavaRushJavaRush — is an interactive online course for learning Java programming from scratch. It contains 1200 practical tasks with one-click solution checking, the necessary minimum of theory on Java basics, and motivating features that help you complete the course: games, quizzes, interesting projects and articles on effective learning and the career of a Java developer.
Follow us
Язык интерфейса
Русский
English
Українська
"Programmers are not born" © 2026 JavaRush
MastercardVisa
"Programmers are not born" © 2026 JavaRush