OOP Coding Questions (Suggestions)

BlitzMax Forums/BlitzMax Programming/OOP Coding Questions (Suggestions)

FBEpyon(Posted 2012) [#1]
Hello All,

I have been re-writing my code for a MineCraft like engine and I would like you opinion of my code, I have done it two different ways, and I was wanting to know which you think is the better approach.


Module Based:



Function Based:




SystemError51(Posted 2012) [#2]
I prefer using methods in all my types. That way everything that belongs to a type stays inside the type.

I use functions only as a global access point, for functions that should be externally available. The functions then reroute the requested action into the correct method of the type.


Yasha(Posted 2012) [#3]
It's literally just a matter of aesthetics. Unless you make use of polymorphism (at which point things take a massive swerve in a different direction), there is no logical difference between the two approaches. Which looks more elegant to you? There's a case to be made for both.

First one saves you some typing though. It also means that you can more easily add subclasses later, should you want them.


FBEpyon(Posted 2012) [#4]
My main goal of this is trying to get rid of arrays in the building of the blocks and chunks..

Thanks for looking at this, if you have any other suggestions let me know..