Should I include utility functions in the class?

Discuss Autohotkey related topics here. Not a place to share code.
Forum rules
Discuss Autohotkey related topics here. Not a place to share code.
william_ahk
Posts: 481
Joined: 03 Dec 2018, 20:02

Should I include utility functions in the class?

Post by william_ahk » 23 Jan 2022, 03:26

For example, general utility functions like JSON, UrlDownloadToVar, etc. Should I include them in my class for easier distribution or should I leave them out of it for modularity? Or should I tell people to include these functions on their own?

iseahound
Posts: 1434
Joined: 13 Aug 2016, 21:04
Contact:

Re: Should I include utility functions in the class?

Post by iseahound » 26 Jan 2022, 11:42

I think what the AHK community prefers is that you don't pollute the global namespace. But they also don't want to download a separate file or script.

Lepes
Posts: 141
Joined: 06 May 2021, 07:32
Location: Spain

Re: Should I include utility functions in the class?

Post by Lepes » 26 Jan 2022, 13:42

It is and endless discussion topic:
- read the license of your utilities, maybe a creator don't like you include its software embeded in other software.
- If you include source code, your piece of software will ever work. If you include a link to resources and the owner changes something in it, That change may broke your software.
- Think about third party updates: updates may fix bugs that you would like to incorporate into your software, so you need to update everything and maintain updated your class again.
- On the opposite side: Maybe you don't need to use the latest version of a utility, just because you don't use the new functions, or maybe the new version has grown too much and you are confortable with the old one... There are a lot of reason for using an old version versus the new one.

In my opinion, I will create a folder "third party" and include all files in my download, that way I ensure everything works out of the box.
Software that needs separate downloads dependencies are a kick on the stomach for every user.

There are always pros and cons, just evaluate.

Post Reply

Return to “General Discussion”