Coding standards: Function name aliases: how to use?

A forum dedicated to the Draft, Arch and BIM workbenches development.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
vocx
Veteran
Posts: 5197
Joined: Thu Oct 18, 2018 9:18 pm

Re: Coding standards: Function name aliasses: how to use?

Post by vocx »

Zolko wrote: Fri Oct 09, 2020 10:30 am you still didn't justify what the purpose of all this work is...
What is the purpose of standards? Did you think about that before?

Standards help everybody get on the same path. That's the purpose of this. Development occurs better and with less errors when people follow standards.
Always add the important information to your posts if you need help. Also see Tutorials and Video tutorials.
To support the documentation effort, and code development, your donation is appreciated: liberapay.com/FreeCAD.
User avatar
Zolko
Veteran
Posts: 2213
Joined: Mon Dec 17, 2018 10:02 am

Re: Coding standards: Function name aliases: how to use?

Post by Zolko »

Kunda1 wrote: Fri Oct 09, 2020 2:19 pm .... and ask for a little de-escalation in the tone of this important exchange of ideas and long term vision.
While I agree with you on general terms, how am I supposed to react to :

You aren't thinking long term.
Did you think about that before?
I'm honestly interested in how a (this) community is answering a clearly abusing clueless moron ? Now, as a moderator, you'll have to make decisions. Please don't forget the open/free source mantra of: show me the code. This is the only thing that counts.
try the Assembly4 workbench for FreCAD — tutorials here and here
Cyril
Posts: 133
Joined: Wed Aug 23, 2017 5:04 pm
Location: Geneva (Switzerland)
Contact:

Re: Coding standards: Function name aliases: how to use?

Post by Cyril »

Not a proof but an example. Blender is coded mainly in C, some libraries are in C++ and all the python API is PEP8 compliant. I found so much easier to get into Blender Python API than FreeCAD Python API. Of course PEP8 is not the only reason (UI is easy to modify, class inheritance etc…). It is clean and easy to read and get into.
Edit : Also if you look at old Blender Python API you will see that it was absolutely not the case before : API 2.25. So they did this work. Maybe we could found some discussions about it but I am pretty sure that you will find the same kind of pro/cons :) .

About keeping C++ style it could eventually make sense if you use mainly exactly the same class and function in both languages like it is in PySide2 (or Revit… cause it is all .NET and API is the same for C++/VB.NET/C#/python/Ruby and any .NET compatible language) but it is not the case for FreeCAD. API is not the same in C++ and python for many things.
I blog about HVAC / BIM / Energy : pythoncvc.net. If you like you can follow the RSS feed.
User avatar
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Re: Coding standards: Function name aliases: how to use?

Post by Kunda1 »

Cyril wrote: Sat Oct 10, 2020 9:56 am Not a proof but an example. Blender is coded mainly in C, some libraries are in C++ and all the python API is PEP8 compliant. I found so much easier to get into Blender Python API than FreeCAD Python API. Of course PEP8 is not the only reason (UI is easy to modify, class inheritance etc…). It is clean and easy to read and get into.
Edit : Also if you look at old Blender Python API you will see that it was absolutely not the case before : API 2.25. So they did this work. Maybe we could found some discussions about it but I am pretty sure that you will find the same kind of pro/cons :) .

About keeping C++ style it could eventually make sense if you use mainly exactly the same class and function in both languages like it is in PySide2 (or Revit… cause it is all .NET and API is the same for C++/VB.NET/C#/python/Ruby and any .NET compatible language) but it is not the case for FreeCAD. API is not the same in C++ and python for many things.
This post is a breath of fresh air. Thank you for the insight @Cyril
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
vocx
Veteran
Posts: 5197
Joined: Thu Oct 18, 2018 9:18 pm

Re: Coding standards: Function name aliases: how to use?

Post by vocx »

Cyril wrote: Sat Oct 10, 2020 9:56 am ...Blender is coded mainly in C, some libraries are in C++ and all the python API is PEP8 compliant. I found so much easier to get into Blender Python API than FreeCAD Python API.
...
Exactly my point. Blender has a great API because over the years they have done the work to standardize and place things into submodules. It's hard work, but somebody has to do it if, in the future, you want to have clean and maintainable structures.

Despite the age of FreeCAD (18 years), we are barely getting things into a better shape. A lot of work is still needed.
Always add the important information to your posts if you need help. Also see Tutorials and Video tutorials.
To support the documentation effort, and code development, your donation is appreciated: liberapay.com/FreeCAD.
Post Reply