Coding. style

Here's the place for discussion related to coding in FreeCAD, C++ or Python. Design, interfaces and structures.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
FreddyFreddy
Posts: 176
Joined: Wed Mar 09, 2022 3:15 am
Location: Oz

Re: Coding. style

Post by FreddyFreddy »

adrianinsaval wrote: Tue Apr 19, 2022 10:03 pm someone has to do the work of changing stuff which may not always be trivial.
Well I am enjoying doing some work, maybe making a tiny difference. Fantastic way to learn!
User avatar
doia
Posts: 251
Joined: Sat May 29, 2021 5:47 am
Location: Düsseldorf

Re: Coding. style

Post by doia »

FreddyFreddy wrote: Sat Apr 30, 2022 8:23 am Code style and formatting matters! When you're not a rocket scientist at least. Time and again I see "Code is read much more often than it is written"
And that‘s why EVERY! function or method MUST have a short description of What and Why it does something, even the trivial ones. „The code is the documentation“ requires too much mental overhead.
FreddyFreddy
Posts: 176
Joined: Wed Mar 09, 2022 3:15 am
Location: Oz

Re: Coding. style

Post by FreddyFreddy »

doia wrote: Sun May 01, 2022 7:36 am And that‘s why EVERY! function or method MUST have a short description of What and Why it does something, even the trivial ones. „The code is the documentation“ requires too much mental overhead.
I 'somewhat' disagree. As Bjarne Stroustrup famously said "Express ideas directly in code". If the code uses natural wording to express meaning, then why do we need comments to further explain, or, Heaven forbid 'documentation' to restate the same thing without adding any understanding. The example I quoted could, I believe, have been better expressed which would have negated any firther documentation requirement. Just my 2c.
Post Reply