Giter Site home page Giter Site logo

Comments (10)

ocombe avatar ocombe commented on May 17, 2024

You can implement an abstract class as well. How is it more flexible with an interface ?

from core.

ribizli avatar ribizli commented on May 17, 2024

In a class you can have only one superclass but more implemented
interfaces. It's a minor thing, anyway.

On Mon, Feb 29, 2016 at 11:23 AM, Olivier Combe [email protected]
wrote:

You can implement an abstract class as well. How is it more flexible with
an interface ?


Reply to this email directly or view it on GitHub
#48 (comment)
.

from core.

ocombe avatar ocombe commented on May 17, 2024

Hmm good to know, but can you write an interface that implements the abstract class and then implement this interface ?

from core.

ribizli avatar ribizli commented on May 17, 2024

I'd replace the abstract class with interface.

On Mon, Feb 29, 2016 at 11:35 AM, Olivier Combe [email protected]
wrote:

Hmm good to know, but can you write an interface that implements the
abstract class and then implement this interface ?


Reply to this email directly or view it on GitHub
#48 (comment)
.

from core.

DanielSchuech avatar DanielSchuech commented on May 17, 2024

I would agree in that case the the interface would be the better choice. I didn´t thought about this while implementing this feature.

Is your design maybe to complex? A class should only attend one responsibility to fulfill the Single Responsibility Principle. Maybe it would be better to devide your behabiour into different classes and MissingTranslationHandler inherit from just oneclass. That would be maybe better maintainable. But thats jsut an idee because I don`t know your use cases.

from core.

ribizli avatar ribizli commented on May 17, 2024

I've just stumbled into this thing when I was reading the source. For me the rule of thumb is to use interface if I don't need to deliver default functionality. Since the abstract class don't have any implemented feature, it could be cleaner to be a simple interface.

The test implementation shows also, that this abstract class is anyway used as interface only:

class Missing implements MissingTranslationHandler

from core.

DanielSchuech avatar DanielSchuech commented on May 17, 2024

@ribizli Yeah. As mentioned I agree with you.

from core.

ocombe avatar ocombe commented on May 17, 2024

Yup good points, I'll change that for the next release

from core.

ribizli avatar ribizli commented on May 17, 2024

I can prepare a PR for this and also create an NG2_TRANSLATE_PROVIDER for the default configuration. This is the proper angular2 way (like HTTP_PROVIDERS).

from core.

ocombe avatar ocombe commented on May 17, 2024

ah yes good idea, thanks

from core.

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.