Giter VIP home page Giter VIP logo

Comments (3)

konmik avatar konmik commented on August 21, 2024

You will need to have a field in activity so activity can easily access presenter, and that field should also be accessible from the code that controls the presenter's lifecycle. This is encapsulation break. Otherwise you will need to implement NucleusAcitivtyManager, and access presenter from that manager, so instead of getPresenter() you will have to write Nucleus.getPresenter(this) every time. All of this looks like overcomplication to me. Inheritance just works.

There are also uniformity considerations. Right now you can be sure that all presenters and views in Nucleus work the same way, so it is easy to understand the whole picture. (There are also NucleusLayout and NuleusFragment classes).

If you will create an implementation for such manager, I would like to see it anyway, probably you will find an elegant solution :)

from nucleus.

JoanZapata avatar JoanZapata commented on August 21, 2024

Inheritance just works.

Until another lib decides to do the same.

You will need to have a field in activity so activity can easily access presenter, and that field should also be accessible from the code that controls the presenter's lifecycle. This is encapsulation break. Otherwise you will need to implement NucleusAcitivtyManager, and access presenter from that manager, so instead of getPresenter() you will have to write Nucleus.getPresenter(this) every time. All of this looks like overcomplication to me.

The proper way would probably be to inject the presenter in a @Presenter or @Inject annotated field during the Nucleus.bind(this) call.

There are also uniformity considerations. Right now you can be sure that all presenters and views in Nucleus work the same way, so it is easy to understand the whole picture. (There are also NucleusLayout and NuleusFragment classes).

Good point.

If you will create an implementation for Manager, I would like to see it anyway, probably you will find an elegant solution :)

I'd really like to get my hands on Flow/Mortar for my next project, but yeah, I'll keep you posted if I do. :)

from nucleus.

konmik avatar konmik commented on August 21, 2024

| Until another lib decides to do the same.

I am aware of such possibility, this is why Nucleus is not tied to any specific view class - you can just copy/paste code that controls Presenter.

from nucleus.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.