Author Topic: Articles  (Read 2507 times)

0 Members and 1 Guest are viewing this topic.

Offline Dimster

  • Forum Resident
  • Posts: 500
    • View Profile
Articles
« on: October 24, 2020, 02:43:20 pm »
Not sure if there are any plans for more Articles on Common or Best Practices but if there are I would be interested in best way to use BI and BM files to build a useful library of code. I have struggled with compatibility of variable names in tagging on some of various routines I have saved from programs over the years, can often lead to a complete re-write of the routine.

Offline RhoSigma

  • QB64 Developer
  • Forum Resident
  • Posts: 565
    • View Profile
Re: Articles
« Reply #1 on: October 24, 2020, 03:21:25 pm »
Hi Dimster,

I've made a whole bunch of libraries. When- and whereever possible I did follow the rules discussed in the "Library Section" topic. The conclusion of it is here https://www.qb64.org/forum/index.php?topic=495.msg4039#msg4039, also follow the notes given right after that post by Fellippe regarding the use of _OPTION EXPLICIT.

As an additional rule to it, which I've impossed on my own library code is the use of descriptive and prefixed label names especially for those labels which mark DATA lines for the use with RESTORE.
As DATA labels are in the global scope (even if defined inside a SUB/FUNCTION), they do interfere with all other DATA labels used in the users main module and even with global GOTO/GOSUB jump labels. So always use something like "MyLib_MyWhateverData" or "MyFunc_MyWhateverData" instead of just using common labels like "TheData".

If you need examples on how to apply the mentioned rules, then feel free and just inspect some of my libraries.
My Projects:   https://qb64forum.alephc.xyz/index.php?topic=809
GuiTools - A graphic UI framework (can do multiple UI forms/windows in one program)
Libraries - ImageProcess, StringBuffers (virt. files), MD5/SHA2-Hash, LZW etc.
Bonus - Blankers, QB64/Notepad++ setup pack

Offline Dimster

  • Forum Resident
  • Posts: 500
    • View Profile
Re: Articles
« Reply #2 on: October 25, 2020, 09:51:01 am »
Thanks RhoSigma. What a wealth of knowledge there. Not sure how I missed finding it, but some days I find my coffee cup in the refrigerator and I'm damn sure I didn't put it there. Thanks again, it's all very helpful.

Offline bplus

  • Global Moderator
  • Forum Resident
  • Posts: 8053
  • b = b + ...
    • View Profile
Re: Articles
« Reply #3 on: October 25, 2020, 11:22:10 am »
Thanks RhoSigma. What a wealth of knowledge there. Not sure how I missed finding it, but some days I find my coffee cup in the refrigerator and I'm damn sure I didn't put it there. Thanks again, it's all very helpful.

It's your unconscious telling you to chill out! ;-))

Offline Dimster

  • Forum Resident
  • Posts: 500
    • View Profile
Re: Articles
« Reply #4 on: October 25, 2020, 05:35:05 pm »
Thank God, I thought it was something worst like coders' coma.