BlitzMax Design Patterns

BlitzMax Forums/BlitzMax NG/BlitzMax Design Patterns

Brucey(Posted 2016) [#1]
Hallo.

I've created a new BlitzMax NG resource that some of you may find interesting.

It is various design patterns implemented in BlitzMax :

https://woollybah.github.io/blitzmax-design-patterns/


NG, because it comprises language features such as Interfaces and method overloading.


Have fun !



Site design and original code ported to BlitzMax from the java-design-patterns project.


Derron(Posted 2016) [#2]
It is interesting to see that I have done some of these things "intuitively" in a very similar way - without knowing the "pattern".


Some of these patterns look a bit esoterical to me - or hmm "could be done with one of the other patterns".


Think most of the time the main problem is: how to find out, which pattern to use best for your problem. And, to recognize the problem before starting to write some code.



Regarding "singleton pattern":
Is there a reason to have "final" there? I avoid this to be able to extend a basic "singleton" with a more advanced one. The advanced one then converts to "TAdvanced" if instance is not "TAdvanced" yet.
It returns "global instance:TBase" casted to "TAdvanced".

Which pattern to choose then to avoid this?
"Singleton" + "Component"?
The components then get the "singleton" passed as parameter (to eg. access the properties of the singleton - lists, maps, ...)


Questions as the one above are what makes me left puzzled most of the times and just doing it "intuitively" (which is not the best thing very often :-)).



bye
Ron


Brucey(Posted 2016) [#3]
Is there a reason to have "final" there?

No, it doesn't need to be there :-)


BlitzSupport(Posted 2016) [#4]
Thanks for posting this, Brucey... not sure design patterns are my cup of tea (all seems too formal/businesslike for my hobbiest's taste), but I am at least curious due to my recent dabblings in C++. Having examples in a familiar language may help me grasp/appreciate them somewhat...


col(Posted 2016) [#5]
Cool stuff.
It's also a nice crisp looking website :o)


Brucey(Posted 2016) [#6]
The design isn't mine but I did a complete rewrite of it using aurelia (for some practice). It's not quite so flashy as the original, but is functional enough for its purpose :-)

I'm looking to add some more patterns in the future.


therevills(Posted 2016) [#7]
Nicely done Brucey!


BlitzSupport(Posted 2016) [#8]
/moved to NG since that's now a thing.


MikeHart(Posted 2016) [#9]
Thanks Brucey for publishing this. I am surprised how much I have done it these ways already. But still, create resource by itself.