'Pocket' Functions

BlitzMax Forums/BlitzMax Programming/'Pocket' Functions

Zakk(Posted 2009) [#1]
Modules are great and all, but every now and then I find myself reusing simple functions that aren't complicated enough to merit a module of their own. To make things easier I've made a zak.misc module to hold all of them. My question is, has anyone else had a similiar experience? And if so what was your solution? :)


Czar Flavius(Posted 2009) [#2]
Copy and paste :(


_JIM(Posted 2009) [#3]
I currently have a single file (the largest in my project) that is filled with utility functions. I just stack them up there. There were a few times where I just needed to paste a bunch of code from there and write 5-10 lines of code to get a nice example running.


_Skully(Posted 2009) [#4]
I used to have that as well... including a misc include.. but now I have..

Math, Graphics, Timing, Sound, Fonts etc Nothing should be Misc

Even if an include has only one function, you should put it into its own because later it will make more sense to add to it in the right spot. Misc mashups generally get cluttered and you start to forget what you have in there!

I have a Core include that includes all those...includes :)


Zakk(Posted 2009) [#5]
:) Yeah I used to do it with seperate Includes in BlitzPlus, but so far I haven't collected enough utility(that's a better name for it) functions in BMax that I need to sort them out just yet. I've started going through my code folders to collect ones I may have missed so we'll see how many I end up with.
I've also put up some of the more useful ones in a worklog here if anyone wants to compare.


JoshK(Posted 2009) [#6]
Import "..\Common\whatever.bmx"


beanage(Posted 2009) [#7]
Maybe a little off topic, but related nevertheless:
http://en.wikipedia.org/wiki/Aspect-oriented_software_development


ziggy(Posted 2009) [#8]
That's what imports are for. :D


theHand(Posted 2009) [#9]
BMX files are essentially text files (and thus are small): be a good developer and save each "can't-be-reduced-further-but-is-a-'proof-of-concept'" in a "Misc/snippets" folder.