Marco-Congedo / Diagonalizations.jl

Diagonalization procedures for Julia (PCA, Whitening, MCA, gMCA, CCA, gCCA, CSP, CSTP, AJD, mAJD)
Other
35 stars 6 forks source link

Unicode variable names #79

Open luckywood opened 2 months ago

luckywood commented 2 months ago

Some developers might use Unicode variable names simply to confuse or entertain their colleagues. This approach can be seen as a form of code golf or a way to add some humor to an otherwise dry coding environment. However, there are also some potential drawbacks to using Unicode variable names:

Readability and maintainability:

Non-standard characters can make code harder to read and maintain, especially for developers who are not familiar with the used characters or scripts.

Platform and encoding issues:

Unicode characters might not be supported consistently across different platforms, encoding schemes, or development tools, which can lead to errors or compatibility issues.

Collaboration and communication:

Using Unicode variable names can create barriers to collaboration and communication among team members, especially if they are not familiar with the used characters or scripts.

Marco-Congedo commented 2 months ago

We should add that a half a century long habit to use plain alphanumeric characters in development, due to the lack of support of Unicode characters, also plays a role. I don't think Unicode characters may confuse the peers more than the code itself, at least for the code of this package, which is unduly synthetic, thus obscure at times i guess.

luckywood commented 2 months ago

I hope not to be misunderstood. I really like your effort in developing these packages. Please consider adding a documentation section that explains the meaning and purpose of these aliases and unicode symbols, along with any escape sequences or special methods needed to type them. also giving more meaningful names to these unicode characters could make the code more "self-documenting" and perhaps easier to understand. :pray:

Marco-Congedo commented 2 months ago

Hello Andreas,

all Unicode characters supported by Julia are documented in this page. You can find any charcater in this page as well as the corresponding escape sequence. In the julia REPL, in VS code etc, just type the sequence and 'tab' to get it. Autocompletion also works.

In the way i use them, aliases aims at either making the code more readable, or more synthetic. Unicode symbols are meant to make the code shorter and/or prettier, that's all. For instance, for a variable that holds an angle, i may use ∡ as a name instead of angle. For a gradient, ∇ instead of gradient, etc. Often the meaning of a Unicode symbol is more oscure, but after all, any alphanumeric name is also a symbol!

For the AJD code, whatever is in the optim folder is not very readable, however is very effective :) Many AJD algorithms execute pretty fast by taking advantage of Julia speed (see for example this study). Trying to documenting it for developers would be worthless, i think, however, i would be happy to make a video-call with you to clarify things.

By the way, if you would like to contribute your AJD algorithm to Diagonalizations.jl, do not hesitate to make a pull request.

All the best, Marco

luckywood commented 2 months ago

Hello Marco,

thanks for the explanations. I agree that unicode symbols such as "∇" instead of gradient can be useful. However as I'm still relatively new to Julia programming and thus very not familiar with the intricacies of that language, I'm not sure if I can contribute anything meaningful at this point.

Kind regards, Andreas

Marco-Congedo commented 2 months ago

Hello Andreas, also keep in mind that julia has its own declared symbols. For example, √2 (\sqrt) is the square root of 2, 1≈1 (\approx) returns true, @. is a broadcasting macro, etc. Unfortunately these symbols are not always easy to find on julia documentation. I am glad to hear that you are trying out julia. Since you know well Matlab, it should be easy for you. If you have any questions do not hesitate to contact me. Ask Benjamin my e-mail if you don't have it. Cheers!

liam788fh commented 2 months ago

Unicode variable names allow programmers to use a wide range of characters from various writing systems, enhancing the expressiveness and readability of code in different languages and contexts My Team Names. This capability is particularly useful in multilingual environments, where code can be written in the programmer's native language, making it more accessible and understandable.