Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Mastering High Performance with Kotlin

You're reading from   Mastering High Performance with Kotlin Overcome performance difficulties in Kotlin with a range of exciting techniques and solutions

Arrow left icon
Product type Paperback
Published in Jun 2018
Publisher Packt
ISBN-13 9781788996648
Length 316 pages
Edition 1st Edition
Languages
Arrow right icon
Author (1):
Arrow left icon
Igor Kucherenko Igor Kucherenko
Author Profile Icon Igor Kucherenko
Igor Kucherenko
Arrow right icon
View More author details
Toc

Preventing Unnecessary Overhead Using Delegates

Delegation is an extremely powerful pattern in which a delegating object assigns authority to a delegate object. The delegating object keeps a reference to the delegate object and dispatches messages to it.

Dispatch, or message passing, is a concept in object-oriented programming by means of which one object invokes the method of another.

The delegating object uses the delegate object to provide an interface that's similar to an interface of the delegate. In some cases, the delegating object can send a message to the delegate object to just update its own state or that of another object. This is shown in the following diagram:

In other cases, the delegating object assigns responsibility for performing some behavior to the delegate object, as follows:

In this chapter, we'll cover the following topics:

  • Types of delegation...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image