Good Programming Practices talk

inspired by this thread (https://forum.xojo.com/44231-recommendations-for-new-framework/11#p359280) and especially by @Markus Winter comment , i propose you to write here best programming practices. then, based on this conversation, we could make a wiki page, a github page or something else with a summary of the material here exposed. the final wiki page could have categories, like “UI design”, “speed”, “security” or something else
maybe is a bad idea, I would like to hear your thoughts

I thought of something like this myself, so I’m glad you come up with it. And while I see myself more as a beginner in this matter (so I cannot contribute much), I’m even more interested in what experienced programmers will share…

in this forum you can find a lot of experienced programmers. every month i learn a lot just reading this forum threads. in fact, i think this is one of the best forum about programming on internet

here is a good practice about dates–> https://blog.xojo.com/2017/11/04/get-better-dates-with-the-new-xojo-framework/ written by @Geoff Perlman

best practice about working environment at home–> https://blog.xojo.com/2017/08/16/5-tips-for-setting-up-your-home-office-for-sanity-and-productivity/ written by @Alyssa Foley

RaiseEvent best practice–> https://blog.xojo.com/2017/08/09/raise-your-events-the-right-way/ by @Norman Palardy

app localization–> https://blog.xojo.com/2017/08/03/5-things-to-keep-in-mind-when-localizing-your-app/ by @Dana Brown
also this post–> https://blog.xojo.com/2017/01/24/localizing-web-apps/ by @Paul Lefebvre

doing a password loggin the right way–> http://blog.xojo.com/2015/10/09/tips-dealing-with-the-problem-of-passwords/ by @Paul Lefebvre
good practice to reset password --> https://forum.xojo.com/9051-good-practice-to-reset-password/ by @Albin Kiland

working with files: FolderItem --> https://blog.xojo.com/2017/02/20/working-with-files-folderitem/ by @Javier Menéndez
recursively delete a folder --> https://blog.xojo.com/2016/03/02/how-to-recursively-delete-a-folder/ by @William Yu

SQL TOPIC
avoid sql injection --> https://blog.xojo.com/2016/02/18/avoiding-sql-injection/ by @Paul Lefebvre

helps or tools to speed up and/or encourage good practices on database development
https://github.com/1701software/SQLdeLite by @Phillip Zedalis

coding guidelines --> https://blog.xojo.com/2016/02/09/tip-coding-guidelines/ by @Paul Lefebvre

bear in mind, that all the links you shared, and any links or information others may share in the future…
illustrate ONE way to do a particular thing… They may or may not be “Best Practices” and you should never assume as much.

Take the information you gather from this forum, and do what works for you…

Ask 10 developers what the best way to do something is, and you will get 13 answers

Don’t forget Goto :stuck_out_tongue:

I second what Dave said. A company/team will use coding standards just to keep it all working together and not let every programmer do it his way. But when you get to decide - make it what works best for YOU.

Thought I would add an example. The Xojo coding guidelines says you should Dim variables close to where they are used. I won’t debate the ‘correctness’ of this but I always but ALL the Dims at the top of the method or module or what ever. If they are all at the top then I know where they are if need to look at the dim.

And by the way, I mostly like the guidelines listed in the above link.

I too DIM variable as Bill described… partly for the reason he specified… but also because when I started programming that was how you HAD to do it… but while compilers may have changed THEIR ways, I haven’t :slight_smile:

Part of that is the variable naming conventions: https://www.maxprog.com/site/blog/post.php?id=844

website cannot be reached

the link work from UK.

from here now as well…

That being said… variable names (my opinion) should indicate intent over datatype… often datatype can be inferred from the intent, or in a modern GUI, by moving the mouse over it :slight_smile:

However I do have specific variables that are ALWAYS the same type
I,J,K are ALWAYS Integer (Fortran anyone?)
s,t as ALWAYS String