Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [hono-dev] Definition of Hono's public API

Sorry for being late in the discussion. I think some part of it reflects what OSGi captures as "API providers" and "API consumers" [1]:

major — Packages with versions that have different major parts are not compatible both for providers as well as consumers. For example, 1.2 and 2.3 are completely incompatible.
  • > minor — API consumers are compatible with exporters that have the same major number and an equal or higher minor version. API providers are compatible with exporters that have the same major and minor version number. For example, 1.2 is backward compatible with 1.1 for consumers but for providers it is incompatible. Consumers should therefore import [1.2,2)and providers should import [1.2,1.3).
  • > micro — A difference in the micro part does not signal any backward compatibility issues. The micro number is used to fix bugs that do not affect either consumers or providers of the API.

  • To my knowledge, other languages (like Rust, Go, …) now follow a similar policy. At least they try.

    In the Eclipse ecosystem (using OSGi) is is customary to mark packages, which are considered "internal" to a project, to be named "internal" [2]. So while those packages still might be exported from an OSGi bundle, so that other bundles of the same project may use it, it still is clear that the functionality is considered "internal".

    So for Hono I think we can follow the same idea of (major, minor, micro) in the context of API consumers and providers. Renaming packages to "internal" doesn't sound very appealing to me in the "1.x" tree. But maybe we could put a "package" info, stating a comment that this package is considered "private".

    And maybe technically enforce APIs in 2.x.

    [1] https://www.osgi.org/developer/white-papers/semantic-versioning/semantic-versions/
    [2] https://github.com/eclipse/eclipse.platform.ui/tree/master/bundles/org.eclipse.ui.workbench/Eclipse%20UI/org/eclipse/ui/internal

    On Wed, Jan 15, 2020 at 3:55 PM Dejan Bosanac <dejanb@xxxxxxxxxxxx> wrote:
     
    No, that's a misunderstanding. I was only trying to set the scope at the
    class level. I hope we can agree that we only want to include public
    classes in the public API. Private members and methods should not be
    affected, of course. However, protected members and protected non-final
    methods of public classes can be overridden by subclasses and therefore
    have to be considered part of the public API, right?

    Yeah, sorry missed that in your original email. It's clear now.

    I would go for the first option, i.e.
    > The default would then be
    > that protected members/methods are not public API unless marked as such
    >  explicitly

    So would I. I think protected methods are more likely to be overridden by the Hono project itself, rather then 3rd party solutions. That's at least how I would like to see them. And of course, exceptions are possible.
     
    On Wed, Jan 15, 2020 at 3:43 PM Julian Feinauer <j.feinauer@xxxxxxxxxxxxxxxxx> wrote:
    Hi,

    I would go for the first option, i.e.
    > The default would then be
    > that protected members/methods are not public API unless marked as such
    >  explicitly

    But just a gut feeling.

    Julian

    Am 15.01.20, 15:23 schrieb "hono-dev-bounces@xxxxxxxxxxx im Auftrag von Hudalla Kai (INST/ECS4)" <hono-dev-bounces@xxxxxxxxxxx im Auftrag von Kai.Hudalla@xxxxxxxx>:

        On 15.01.20 15:12, Hudalla Kai (INST/ECS4) wrote:
        > On 15.01.20 15:01, Dejan Bosanac wrote:
        >> This somehow went off the list ...
        >>
        >> But that would mean that even changes in the implementation of the
        >> classes and changes to protected/private methods would trigger version
        >> increment?
        >
        > No, that's a misunderstanding. I was only trying to set the scope at the
        > class level. I hope we can agree that we only want to include public
        > classes in the public API. Private members and methods should not be
        > affected, of course. However, protected members and protected non-final
        > methods of public classes can be overridden by subclasses and therefore
        > have to be considered part of the public API, right?
        >

        However, we can also decide on a case by case basis for the protected
        members/methods and mark those protected members/methods that we
        consider part of public API accordingly, e.g. by means of JavaDoc or
        annotations as proposed by Julian already. The default would then be
        that protected members/methods are not public API unless marked as such
        explicitly. Or we could do it the other way around, i.e. by default all
        is public API unless marked as private explicitly. WDYT?



        > I'm not sure going into such strict requirements would
        >> bring us too much benefits.
        >>
        >> On Wed, Jan 15, 2020 at 2:14 PM Hudalla Kai (INST/ECS4)
        >> <Kai.Hudalla@xxxxxxxx <mailto:Kai.Hudalla@xxxxxxxx>> wrote:
        >>
        >>     On 15.01.20 12:56, Dejan Bosanac wrote:
        >>     > Hi Kai,
        >>     >
        >>     > this seems reasonable to me. Just one thing, when you say "all
        >>     classes",
        >>     > do you mean public methods signatures by that or something else?
        >>     >
        >>
        >>     Good point. I would say that this affects all public classes in the
        >>     "public" packages which are currently
        >>
        >>     core: all packages
        >>
        >>     client: all packages
        >>
        >>     service-base: all packages
        >>
        >>     Does that make sense?
        >>
        >>     > On Tue, Jan 14, 2020 at 8:52 AM Hudalla Kai (INST/ECS4)
        >>     > <Kai.Hudalla@xxxxxxxx <mailto:Kai.Hudalla@xxxxxxxx>
        >>     <mailto:Kai.Hudalla@xxxxxxxx <mailto:Kai.Hudalla@xxxxxxxx>>> wrote:
        >>     >
        >>     >     Hi list,
        >>     >
        >>     >     with Hono 1.0.0 having been released last year, we now need to
        >>     follow
        >>     >     semantic versioning for its public API. So far so good. During
        >>     the past
        >>     >     weeks while implementing new features, we already ran in to
        >>     situations
        >>     >     where some refactoring would have been beneficial but where we
        >>     had to
        >>     >     think twice about whether we can simply change a method's
        >>     signature or
        >>     >     remove some obsolete class(es). I think we can all agree that this
        >>     >     depends on whether the affected artifacts are to be considered
        >>     part of
        >>     >     Hono's public API or not.
        >>     >
        >>     >     However, we haven't yet defined which parts of Hono actually
        >>     constitute
        >>     >     its public API. Thus, I would like to propose a draft of what
        >>     I would
        >>     >     consider (or like to see as) part of Hono's public API:
        >>     >
        >>     >     1) All remote APIs documented under [1]
        >>     >     2) All classes in the core module
        >>     >     3) All classes in the client module
        >>     >     4) All classes in the service-base module
        >>     >
        >>     >     IMHO the rest would then automatically not be public API and
        >>     would thus
        >>     >     not be subject to semantic versioning.
        >>     >
        >>     >     WDYT?
        >>     >
        >>     >     [1] https://www.eclipse.org/hono/docs/api/
        >>     >
        >>     >     --
        >>     >     Mit freundlichen Grüßen / Best regards
        >>     >
        >>     >     Kai Hudalla
        >>     >
        >>     >     Software Developer - Bosch IoT Hub
        >>     >
        >>     >     Bosch.IO GmbH
        >>     >     Ullsteinstr. 128
        >>     >     12109 Berlin
        >>     >     GERMANY
        >>     >     www.bosch.io <http://www.bosch.io> <http://www.bosch.io>
        >>     >
        >>     >     Registered Office: Berlin, Registration Court: Amtsgericht
        >>     >     Charlottenburg; HRB 148411 B
        >>     >     Chairman of the Supervisory Board: Dr.-Ing. Thorsten Lücke;
        >>     >     Managing Directors: Dr. Stefan Ferber, Dr. Aleksandar
        >>     Mitrovic, Yvonne
        >>     >     Reckling
        >>     >     _______________________________________________
        >>     >     hono-dev mailing list
        >>     >     hono-dev@xxxxxxxxxxx <mailto:hono-dev@xxxxxxxxxxx>
        >>     <mailto:hono-dev@xxxxxxxxxxx <mailto:hono-dev@xxxxxxxxxxx>>
        >>     >     To change your delivery options, retrieve your password, or
        >>     >     unsubscribe from this list, visit
        >>     >     https://www.eclipse.org/mailman/listinfo/hono-dev
        >>     >
        >>     >
        >>     >
        >>     > --
        >>     > Regards
        >>     > --
        >>     > Dejan Bosanac
        >>     > http://sensatic.net/about
        >>     >
        >>     > _______________________________________________
        >>     > hono-dev mailing list
        >>     > hono-dev@xxxxxxxxxxx <mailto:hono-dev@xxxxxxxxxxx>
        >>     > To change your delivery options, retrieve your password, or
        >>     unsubscribe from this list, visit
        >>     > https://www.eclipse.org/mailman/listinfo/hono-dev
        >>     >
        >>
        >>     --
        >>     Mit freundlichen Grüßen / Best regards
        >>
        >>     Kai Hudalla
        >>
        >>     Software Developer - Bosch IoT Hub
        >>
        >>     Bosch.IO GmbH
        >>     Ullsteinstr. 128
        >>     12109 Berlin
        >>     GERMANY
        >>     www.bosch.io <http://www.bosch.io>
        >>
        >>     Registered Office: Berlin, Registration Court: Amtsgericht
        >>     Charlottenburg; HRB 148411 B
        >>     Chairman of the Supervisory Board: Dr.-Ing. Thorsten Lücke;
        >>     Managing Directors: Dr. Stefan Ferber, Dr. Aleksandar Mitrovic, Yvonne
        >>     Reckling
        >>
        >>
        >>
        >> --
        >> Regards
        >> --
        >> Dejan Bosanac
        >> http://sensatic.net/about
        >>
        >> _______________________________________________
        >> hono-dev mailing list
        >> hono-dev@xxxxxxxxxxx
        >> To change your delivery options, retrieve your password, or unsubscribe from this list, visit
        >> https://www.eclipse.org/mailman/listinfo/hono-dev
        >>
        >

        --
        Mit freundlichen Grüßen / Best regards

        Kai Hudalla

        Software Developer - Bosch IoT Hub

        Bosch.IO GmbH
        Ullsteinstr. 128
        12109 Berlin
        GERMANY
        www.bosch.io

        Registered Office: Berlin, Registration Court: Amtsgericht
        Charlottenburg; HRB 148411 B
        Chairman of the Supervisory Board: Dr.-Ing. Thorsten Lücke;
        Managing Directors: Dr. Stefan Ferber, Dr. Aleksandar Mitrovic, Yvonne
        Reckling
        _______________________________________________
        hono-dev mailing list
        hono-dev@xxxxxxxxxxx
        To change your delivery options, retrieve your password, or unsubscribe from this list, visit
        https://www.eclipse.org/mailman/listinfo/hono-dev


    _______________________________________________
    hono-dev mailing list
    hono-dev@xxxxxxxxxxx
    To change your delivery options, retrieve your password, or unsubscribe from this list, visit
    https://www.eclipse.org/mailman/listinfo/hono-dev


    --
    Regards
    --
    Dejan Bosanac
    http://sensatic.net/about
    _______________________________________________
    hono-dev mailing list
    hono-dev@xxxxxxxxxxx
    To change your delivery options, retrieve your password, or unsubscribe from this list, visit
    https://www.eclipse.org/mailman/listinfo/hono-dev


    --
    Jens Reimann
    Principal Software Engineer / EMEA ENG Middleware
    Werner-von-Siemens-Ring 14
    85630 Grasbrunn
    Germany
    phone: +49 89 2050 71286
    _____________________________________________________________________________

    Red Hat GmbH, www.de.redhat.com,
    Registered seat: Grasbrunn, Commercial register: Amtsgericht Muenchen, HRB 153243,
    Managing Directors: Charles Cachera, Laurie Krebs, Michael O'Neill, Thomas Savage

    Back to the top