I don't have any specific inclination, I would use whatever becomes a standard.

However, I prefer the readability of a utility method that is readable and easy 
to understand such as isNullOrEmpty (which suggests it's doing a null check) 
versus isEmpty.

I suppose a refactoring exercise can be done by picking whatever favourite 
dependency community consensus is built for (if at all) and then write a 
utility method in something like StringsUtil in cloud-utils and use it 
throughout the codebase so in future if we want to move to something else - all 
you do is replace your favourite dependency with something new only in 
StringsUtils of cloud-utils.

... and update the cloudstack-checkstyle to enforce the new agreed upon rule 
and also update - 
https://cwiki.apache.org/confluence/display/CLOUDSTACK/Coding+conventions


Regards.

________________________________
From: Daniel Augusto Veronezi Salvador <gutoveron...@apache.org>
Sent: Tuesday, September 7, 2021 04:37
To: dev@cloudstack.apache.org <dev@cloudstack.apache.org>
Subject: [Discussion] String libs

Hi all,

Currently, the main String libs we are using are "commons.lang" and 
"commons.lang3" (either directly or by our facade, "com.cloud.utils"). We have 
a current discussion about using them directly or via a facade (such as 
"com.cloud.utils"); however, a third implementation has been added 
(google.common.base), which adds more to the discussion. "commons.lang" already 
implement all we need; therefore, adding a third one does not seem to 
add/improve/help with anything, but adding more moving parts and libraries that 
we need to watch out for (managing versions, checking for security issues, and 
so on).

I created a PR (https://github.com/apache/cloudstack/pull/5386) to replace 
"google.common.base" with "commons.lang3". However, and as Daan suggested too, 
I'd like to go forward and revisit this discussion to standardize our code. To 
guide it, I'd like to start with what I think is the main topic:

- Should we use a facade to "commons.lang"? Which are the pros and cons, 
according to your perspective?

Best regards,
Daniel.

 

Reply via email to