• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Kotlin Delegation and Delegated proprieties

 
Ranch Hand
Posts: 606
11
Android Python Open BSD VI Editor Slackware
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Are days I am trying to grasp this concept but I cannot understand how/when to bring this in practice when I write some code. Does somebody has an example  of delegated proprieties that is easy to compare with normal Java?
 
Greenhorn
Posts: 17
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Not sure if this link helps any...

http://www.jguru.com/faq/view.jsp?EID=27916
 
Giovanni Montano
Ranch Hand
Posts: 606
11
Android Python Open BSD VI Editor Slackware
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Mike Roundtree wrote:Not sure if this link helps any...

http://www.jguru.com/faq/view.jsp?EID=27916


thanks I studied this and other blogs, I understand now why composition is better than inherithance, still need to get acquainted with delegated proprieties, hopefully will write here in few days
 
Giovanni Montano
Ranch Hand
Posts: 606
11
Android Python Open BSD VI Editor Slackware
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Giovanni Montano wrote:

Mike Roundtree wrote:Not sure if this link helps any...

http://www.jguru.com/faq/view.jsp?EID=27916


thanks I studied this and other blogs, I understand now why composition is better than inherithance, still need to get acquainted with delegated proprieties, hopefully will write here in few days


getting clearer but still do not dominate it 100%
 
Marshal
Posts: 8857
637
Mac OS X VI Editor BSD Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Could you bring us to context please, so we could possibly join?
 
Giovanni Montano
Ranch Hand
Posts: 606
11
Android Python Open BSD VI Editor Slackware
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Liutauras Vilda wrote:Could you bring us to context please, so we could possibly join?


You are absolutely right, I apologize if I am abstract but do not want to mix objective lack of documentation issues with my personal lack of composition/inheritance architectural concepts.
I will come back to you in few days, formulating better what exaclty I think everyone is missing, at my advice documentation is missing some chunk
 
Giovanni Montano
Ranch Hand
Posts: 606
11
Android Python Open BSD VI Editor Slackware
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Giovanni Montano wrote:

Liutauras Vilda wrote:Could you bring us to context please, so we could possibly join?


You are absolutely right, I apologize if I am abstract but do not want to mix objective lack of documentation issues with my personal lack of composition/inheritance architectural concepts.
I will come back to you in few days, formulating better what exaclty I think everyone is missing, at my advice documentation is missing some chunk


Now I gained more solid insights. Basically the Delegation in Kotlin comes from the Delegation Design Pattern. And is made to make the coding more scalable, and implement new features without going up and down the heritage tree of classes that extend each other. Favoring composition over inheritance is a well known coding principle, and this is the reason why we find delegation in Kotlin, that has some kind of "helper methods" to facilitate real life scenarios where delegation could be used, like the lazy instantiation for instance.

A context as suggested by Liutauras would be an Adapter (a View in Android) that has different layouts( depending by the business logic behind in the presenter in a typical MVP easy scenario) ( MVP is an evolution of MVC for who does not know Android) With the delegate feature one can use in a clean and elegant why different layouts in this case
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic