fritzing / fritzing-app

Fritzing desktop application
http://fritzing.org
Other
3.98k stars 826 forks source link

Develop & broadcast best coding practices #1123

Open davidperrenoud opened 10 years ago

davidperrenoud commented 10 years ago

From bryant.m...@gmail.com on June 15, 2010 19:29:15

Most big projects follow some form of coding standards to synchronize development from multiple authors. An example is the Apache Geronimo project ( http://geronimo.apache.org/coding-standards.html ).

Considering the variety of methods people have coded this project I would think having some coding standards to follow would be awesome. I have seen a lot of code that has weird indentation because a single standard isn't being followed.

Original issue: http://code.google.com/p/fritzing/issues/detail?id=1123

davidperrenoud commented 10 years ago

From irasc...@gmail.com on September 28, 2010 12:32:30

Labels: Component-Code

davidperrenoud commented 10 years ago

From irasc...@gmail.com on July 02, 2011 02:17:29

Owner: irasc...@gmail.com
Labels: -Priority-Medium Priority-Low

failiz commented 3 years ago

I am not sure if the wiki page is enough to close this issue.

failiz commented 3 years ago

Ping

KjellMorgenstern commented 3 years ago

The wiki page refers to the qt codeing style, then add as few Fritzing specific rules as possible. I could try to export the QtCreator specific configuration, do you think that would help?

failiz commented 3 years ago

Yes, I think that could be an easy way to start. Maybe also for Visual Studio if you have it configured. Thus, we could use the auto-format feature of the IDE. However, there are maybe other things to address too. For example, different levels of logging/when to thrown exceptions, how to document the code, how to organize the imports, etc.

KjellMorgenstern commented 3 years ago

Well, one general rule would be to never go a directory up (import "../some.h" ) For exceptions, as a rule of thumb, don't throw any exceptions in qt: https://doc.qt.io/qt-5/exceptionsafety.html . The guidelines are violated in the Fritzing code, so there would be huge refactoring to really establish them. Doxygen documentation is welcome, but please limit it to code you wrote, or really understand in detail.

failiz commented 3 years ago

never go a directory up ( import "../some.h" ) ? The code is full of these ones! I was not aware of the exceptions, actually I think the simulator code throws an exception in some cases. I will change it. Even if we do not refactor the code, I think we should try to avoid them in new code. I think the best would be if you update the wiki page with all this info, so new developers are aware of these things.