You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by Jörg Hoh <jh...@googlemail.com.INVALID> on 2023/01/12 08:31:19 UTC

Re: [Sling Models documentation] discourage the use of @Inject

Hi all,

As the PR got quite complex with its many changes and moves of content, I
merged the doc update yesterday, you can check the result at
https://sling.apache.org/documentation/bundles/models.html.

if you find any inconsistencies or plain errors, please let me know, I plan
to do another PR on top with minor improvements.

Jörg



Am Mi., 21. Dez. 2022 um 15:41 Uhr schrieb Jörg Hoh <jhoh228@googlemail.com
>:

>
> Many thanks for the feedback Stefan! I updated the PR.
>
> Can someone else help with the conversion of the @Via examples to the
> injector-specific annotations?
>
> Jörg
>
> Am Mi., 21. Dez. 2022 um 10:05 Uhr schrieb Stefan Seifert
> <St...@diva-e.com.invalid>:
>
>> thanks for the work!
>>
>> to make it easier to comment i've created a pull request with your
>> changes and added some cosmetic comments:
>> https://github.com/apache/sling-site/pull/106
>>
>> overall, looks very good to me. i think i've never used the @via
>> annotation, cannot help much here.
>>
>> the new "performance" section is also a good read, which was not
>> summarized in that why before afaik.
>>
>> stefan
>>
>>
>>
>> > Am Do., 8. Dez. 2022 um 10:45 Uhr schrieb Stefan Seifert
>> > <St...@diva-e.com.invalid>:
>> >
>> > > +1
>> > >
>> > > using @Inject is not only a performance problem, it also may lead to
>> > > unexpected results if an injector steps in you are not aware of.
>> > >
>> > > stefan
>> > >
>> > > > -----Original Message-----
>> > > > From: Jörg Hoh <jh...@googlemail.com.INVALID>
>> > > > Sent: Thursday, December 8, 2022 10:25 AM
>> > > > To: Sling Developers List <de...@sling.apache.org>
>> > > > Subject: [Sling Models documentation] discourage the use of @Inject
>> > > >
>> > > > Hi,
>> > > >
>> > > > currently the the Sling Models documentation is a bit confusing; the
>> > > > examples show only the use of the "@Inject" annotation, while more
>> > > > down (at
>> > > > [1]) in an not obvious location the use of @Inject is discouraged.
>> > > > Also, when I benchmarked the use of Sling Models with different
>> > > > annotations [2] I found that in some situations @Inject can have a
>> > > > huge performance penalty compared to the injector-specfic
>> > > > annotations, so I would also argue from this perspective, that we
>> > > > should heavily discourage the use of @Inject.
>> > > >
>> > > > But at the top we state as one of the design goals of Sling Models
>> > > > to use standard annotations (which are mostly discouraged at [1] in
>> > > > favor of custom annotations).
>> > > >
>> > > > In the context of SLING-11711 I plan to  rework the documentaiton
>> > > > and
>> > > all
>> > > > examples to use injector-specific annotations, remove the design
>> > > > goal of standard annotations, and mention the discouraged
>> > > > annotations only in a separate section as discouraged (not
>> > deprecated!).
>> > > >
>> > > > WDYT?
>> > > >
>> > > > Jörg
>> > > >
>> > > >
>> > > > [0] https://sling.apache.org/documentation/bundles/models.html
>> > > > [1]
>> > > > https://sling.apache.org/documentation/bundles/models.html#hints-1
>> > > > [2] https://cqdump.joerghoh.de/2022/11/28/sling-model-performance/
>> > > > [3] https://issues.apache.org/jira/browse/SLING-11711
>> > > > --
>> > > > Cheers,
>> > > > Jörg Hoh,
>> > > >
>> > > > https://cqdump.joerghoh.de
>> > > > Twitter: @joerghoh
>> > >
>> >
>> >
>> > --
>> > Cheers,
>> > Jörg Hoh,
>> >
>> > https://cqdump.joerghoh.de
>> > Twitter: @joerghoh
>>
>
>
> --
> Cheers,
> Jörg Hoh,
>
> https://cqdump.joerghoh.de
> Twitter: @joerghoh
>


-- 
Cheers,
Jörg Hoh,

https://cqdump.joerghoh.de
Twitter: @joerghoh