HI,

Those NS collections where essentials in the first java WO mainly because at 
that time Java did not had real collections classes (they appeared in Java 
1.8), and the name was probably kept to help porting. I did not switch to java 
WO at that time and maintained some objective-C apps for a long time!

I mostly use the NS versions because I'm still on EOF and uses ERXKey for sort 
orderings, qualifier building and aggregate computation to have type checking:

- EOQualifier qualifier = 
Evenement.DATE.greaterThanOrEqualTo(dateDebut()).and(Evenement.DATE.lessThanOrEqualTo(dateFin()));
- ERXKey.sum(ContratRetenue.NB_HEURES).valueInObject(retenues);
- NSArray<Etudiant> etudiants = 
Groupe.ETUDIANTS_ACTIFS.atFlatten().arrayValueInObject(evenement.groupes());
-               sortOrderings = Evenement.DATE.asc()
                                .then(Evenement.ORDRE_AFF_MOIS_SALLE.asc())
                                
.then(Evenement.GROUPE_PRINCIPAL.dot(Groupe.SEMESTRE_DEBUT.dot(Semestre.DATE_DEBUT)).desc()
                                .then(Evenement.HEURE_DEBUT.asc()));

I still think those are more readable than creating lambda, probably mostly 
explained because I'm use to the syntax.

Is there something like ERXKey when using Cayenne ?

Regards,

Samuel


> Le 2 févr. 2025 à 07:21, Amedeo Mantica via Webobjects-dev 
> <webobjects-dev@lists.apple.com> a écrit :
> 
> Iirc the NS collections were there due to simplifying porting of apps from 
> objc to Java. I don’t think there is any big difference in performance 
> 
> Sent from my iPhone
> 
>> On 2 Feb 2025, at 12:18, Jérémy DE ROYER via Webobjects-dev 
>> <webobjects-dev@lists.apple.com> wrote:
>> 
>>  Hi all,
>> 
>> Even if I still use EOF (due to inheritance limitations of Cayenne), I 
>> followed Hugi’s precepts :
>> - «  use 100% java native whenever possible »
>> 
>> One other advantage when working in a team… is that 100% java is widely 
>> documented and exampled... and it's more attractive to newbees.
>> 
>> Sorry if I don’t « really » answer the question 😄
>> 
>> Jérémy
>> 
>>> Le 2 févr. 2025 à 11:13, Hugi Thordarson via Webobjects-dev 
>>> <webobjects-dev@lists.apple.com> a écrit :
>>> 
>>> When I made the switch to Java collections I did do some benchmarking. 
>>> Haven’t got the code anymore (this was a decade ago) but at that time, the 
>>> Java collection classes were faster, but the operations were really so fast 
>>> in both cases that the differences were negligible — at that time.
>>> 
>>> Since then, a decade of improvements has happened in the Java collections 
>>> so I think we can guess where you’ll find performance improvements — and 
>>> will keep getting performance improvements. On one hand you have old 
>>> classes written in an old version of Java, on the other hand you have 
>>> actively maintained open source classes used by millions of programmers and 
>>> maintained by the performance-obsessed authors of Java and the JDK itself.
>>> 
>>> And now for the opinion piece:
>>> Unless you’re writing extremely performance-sensitive code — even if the 
>>> foundation collections were faster I think it makes sense to use Java 
>>> collections and write to the standard Java collection APIs where you don’t 
>>> *need* foundation collections, because If you’re using foundation specific 
>>> APIs, your code is really already obsolete at the time of writing. I never 
>>> regretted the switch and have hardly seen an NS* collection class in my 
>>> code in years, except where explicitly required as a parameter for passing 
>>> into WO APIs. (that story may be a little different if you’re using EOF 
>>> which uses the NS collections everywhere, so this may not apply in that 
>>> case).
>>> 
>>> The Java collection classes do have their warts, the most obvious one to us 
>>> coming from the NS* world being the non-API-differentiation between mutable 
>>> and immutable collections (weird design oversight) but that hasn't plagued 
>>> me, really. It’s just something you’re aware of and don’t really hit often.
>>> 
>>> Another one for us WO users is that you can’t use KVC operators on Java 
>>> collections (someArray.@sortAsc, .@sum etc). When I made the switch I 
>>> always thought I’d miss these hugely and planned to write operator support 
>>> into ERXComponent’s valueForKeyPath(), but never got around to it since I 
>>> really didn’t miss the operators, preferring to keep my logic in Java 
>>> rather than templates (compile time errors and refactoring support are 
>>> awesome things).
>>> 
>>> Probably just saying things you know — but I thought it might have some 
>>> value hearing from someone that moved to Java collections and doesn’t 
>>> regret it.
>>> 
>>> Cheers,
>>> - hugi
>>> 
>>> 
>>>> On 2 Feb 2025, at 00:29, ocs--- via Webobjects-dev 
>>>> <webobjects-dev@lists.apple.com <mailto:webobjects-dev@lists.apple.com>> 
>>>> wrote:
>>>> 
>>>> Hi there,
>>>> 
>>>> did ever anybody tried some benchmarks to find whether it is better to use 
>>>> WO collections (NSArray, NSDictionary...) as widely as possible (ie 
>>>> essentially anywhere, unless one really needs to store nulls or can't do 
>>>> without ConcurrentHashMap or so), or whether it's better to use standard 
>>>> collections (List, HashMap...) wherever they happen to work properly 
>>>> (which is surprisingly often, but not anywhere)?
>>>> 
>>>> Are they roughly comparable, or are one or the others considerably better?
>>>> 
>>>> Thanks!
>>>> OC
>>>> 
>>>> _______________________________________________
>>>> Do not post admin requests to the list. They will be ignored.
>>>> Webobjects-dev mailing list      (Webobjects-dev@lists.apple.com)
>>>> Help/Unsubscribe/Update your Subscription:
>>>> https://lists.apple.com/mailman/options/webobjects-dev/hugi%40karlmenn.is
>>>> 
>>>> This email sent to h...@karlmenn.is <mailto:h...@karlmenn.is>
>>> 
>>> _______________________________________________
>>> Do not post admin requests to the list. They will be ignored.
>>> Webobjects-dev mailing list      (Webobjects-dev@lists.apple.com 
>>> <mailto:Webobjects-dev@lists.apple.com>)
>>> Help/Unsubscribe/Update your Subscription:
>>> https://lists.apple.com/mailman/options/webobjects-dev/jeremy.deroyer%40ingencys.net
>>> 
>>> This email sent to jeremy.dero...@ingencys.net 
>>> <mailto:jeremy.dero...@ingencys.net>
>> _______________________________________________
>> Do not post admin requests to the list. They will be ignored.
>> Webobjects-dev mailing list      (Webobjects-dev@lists.apple.com)
>> Help/Unsubscribe/Update your Subscription:
>> https://lists.apple.com/mailman/options/webobjects-dev/amedeomantica%40me.com
>> 
>> This email sent to amedeomant...@me.com
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Webobjects-dev mailing list      (Webobjects-dev@lists.apple.com)
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/webobjects-dev/samuel%40samkar.com
> 
> This email sent to sam...@samkar.com

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list      (Webobjects-dev@lists.apple.com)
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/webobjects-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to