Pixelitor icon indicating copy to clipboard operation
Pixelitor copied to clipboard

Increase the usage of compound assignment operators

Open elfring opened this issue 4 years ago • 4 comments

:eyes: Some source code analysis tools can help to find opportunities for improving software components. :thought_balloon: I propose to increase the usage of compound operators accordingly.

Would you like to integrate anything from a transformation result which can be generated by a command like the following? (:point_right: Please check also for questionable change suggestions because of an evolving search pattern.)

lokal$ perl -p -i.orig -0777 -e 's#\b(?<target>\S+)\s*=\s*\k<target>[ \t]*(?<operator>[+\-*/%^]|&(?!&)|\|(?!\|)|<<|>>>?)#$+{target} $+{operator}=#gm' $(find ~/Projekte/Pixelitor/lokal -name '*.java')

elfring avatar Dec 19 '21 18:12 elfring

I appreciate that you want to improve Pixelitor's code, and this Perl script is a cool trick, but in 2021 it's pretty late. There are lots of free static analyzers now that can find and change such issues in a more convenient way. I recommend using Intellij Idea (the free community edition is fine), which has hundreds of inspections (File/Settings/Editor/Inspections), including this one (under Java/Assignment issues/Assignment can be replaced by operator assignment)

Another issue is that in some cases I think the long form is more readable.

A third issue is that only the packages under the pixelitor package are the core of this app, the other packages are libraries (not all libs could be taken from Maven), and I don't want to change them too much.

lbalazscs avatar Dec 20 '21 19:12 lbalazscs

BTW, looking at your repositories, it seems that you have experience with C/C++. I would like to use C/C++ libs in Pixelitor, but the problem is that I have limited experience with them (I used them a long time ago, but I'm not familiar with modern practices and tools, such as cmake). So if you want to contribute to Pixelitor, then helping with setting up a cross-platform compilation system could be a more important contribution.

lbalazscs avatar Dec 20 '21 19:12 lbalazscs

I appreciate that you want to improve Pixelitor's code, and this Perl script is a cool trick,

Thanks for such a positive feedback.

but in 2021 it's pretty late.

I wonder about this view.

There are lots of free static analyzers now

These software analysis tools are evolving in various directions.

that can find and change such issues in a more convenient way.

Really? ‒ I got other impressions for some programming languages.

…, including this one (under Java/Assignment issues/Assignment can be replaced by operator assignment)

Were any update candidates left over according to this change possibility?

A third issue is that only the packages under the pixelitor package are the core of this app, the other packages are libraries …

Thanks also for this background information.

elfring avatar Dec 20 '21 19:12 elfring

…, it seems that you have experience with C/C++

This view is appropriate.

So if you want to contribute to Pixelitor, then helping with setting up a cross-platform compilation system could be a more important contribution.

:thought_balloon: Which software build systems would you like to choose?

elfring avatar Dec 20 '21 19:12 elfring

Sorry, I noticed only now that there's an unanswered question here...

Which software build systems would you like to choose?

Well, I don't know. CMake is mentioned a lot... I don't know what is good, what are the best practices, tradeoffs. As far as I understand, the best approach would be to copy the C/C++ source files into this repository, and have some command that builds .so and .dll files from them. It would be nice if all of this could also run in GitHub Actions. Do you have some advice?

lbalazscs avatar Nov 09 '22 21:11 lbalazscs

It seems that the selection of a more helpful software build system distracts from the clarification for the original issue. 💭 Would you like to move the corresponding discussion to a separate issue?

elfring avatar Nov 10 '22 10:11 elfring

Sure, I opened a new discussion here: #282

lbalazscs avatar Nov 10 '22 17:11 lbalazscs