haldric icon indicating copy to clipboard operation
haldric copied to clipboard

Learning from old mistakes

Open Byteron opened this issue 6 years ago • 8 comments

We discussed the things that we want to have in our prototype. What might also be interesting to know, especially for the new volunteers, is what mistakes we don't want to repeat, which have been made in the Wesnoth 1.x. series. So please, go ahead and tell us what the mistakes there were and how we could improve on that!

Byteron avatar Oct 15 '18 14:10 Byteron

Stop exposing yourself in public.

Wesnoth 1 has far too many subsystems which would be good except that what should be private implementation details are public interfaces.

GregoryLundberg avatar Oct 15 '18 15:10 GregoryLundberg

I'm not quite sure what you mean. Could you give an example?

Byteron avatar Oct 22 '18 16:10 Byteron

I guess he means that you should only make vars/methods public that should be used by others, and keep the internal ones private so they don't get used/accessed outside of the module/sub-system.

LawnCable avatar Apr 09 '19 17:04 LawnCable

Well that's somewhat probematic given that gdscript does not support encapsulation.

Byteron avatar Apr 12 '19 14:04 Byteron

Using an underscore to mark private methods like _methode should be enough (though I don't know if this changes any behaviour in gdscript because its python similarities)

LawnCable avatar Apr 12 '19 14:04 LawnCable

yeah I'm generally using underscores to mark functions that are not supposed to be called, but gdscript does not prevent you from calling them anyways.

Byteron avatar Apr 12 '19 15:04 Byteron

Perhaps a loose coding standards document should be drawn up then solidified once the majority of the project has been prototyped

spartanatreyu avatar Apr 23 '19 06:04 spartanatreyu

@spartanatreyu while not enforced everywhere (yet), we do follow this style guide: https://docs.godotengine.org/en/3.1/getting_started/scripting/gdscript/gdscript_styleguide.html (also linked in the CONTRIBUTING.md)

Byteron avatar Apr 23 '19 09:04 Byteron