Greetings. My name is Mikko-Pentti Einari Eronen and I’m probably the least qualified person to write this post.
I have been using Blender game engine for a few years to learn Python and to build a few prototypes of various systems that I could use in larger future projects.
Lately I have spent time away from Blender to learn coding in general. I have studied Tkinter, Kivy and plain Python.
Along with that, I have studied PHP, Javascript, etc, etc.
I have also read several books and I’m still reading (which I can recommend to anyone who is interested in any language). For example even if you want to learn Python, you can read a book about C language. You’ll still learn anyway.
The purpose of this thread?
It got me thinking after reading and watching several speeches from professional programmers, that there’s a huge impact on what people who wish to learn programming see on forums as “nice tips” or “the right way”.
Shortened code
For example I have noticed a huge boom on “coding with the shortest lines”. Which as an idea may sound nice,
but soon turns out to be impractical.
The keynote when I start each programming book, I have noticed writing weighting out that we (coders) are writing documentation, instructions for computer. Computer doesn’t usually care what ever you write the short way or the long way.
So you are only hurting your self by doing so.
Commenting
I have now worked on a real application or a tool which client can use to update his website via user interface. I use Tkinter on this. After 400 lines of codes or so (which is really a ridicelously small amount of lines) I already noticed that how crucial it is to comment things. The lines you wrote yesterday will take a small time to get back up to speed,
unless you have commented them clearly. Also don’t be afraid of the “spooky empty white lines between codes”.
You’ll notice that keeping larger space between various things will keep things nicely organized to the eye!
Variables
What variable, where did I put it? When building even slighly larger projects I have found my self creating almost all variables prehand at the start of the code file. This way I know what variables I have and what their names are.
Only a few localized variables inside functions for “temporal calculations” I left out of this list.