I am using
Java code, I have a class called
Texture, capable of doing some graphic manipulation stuff.
Ruby code, I will usually need to draw things, so though I should simply call
Texture class to do the drawing for me.
However, I ended up making a
Ruby class called
Texture, which wraps an instance of
Texture. Somehow like this (just an example, but rather accurate):
class Texture def initialize @reference = getMeAnInstanceOfAJavaTexture end def draw @reference.draw end def rotate @reference.rotate end def clear @reference.clear end end
As you can see, all this
Texture class does is... well, tell a
Texture to do the job for it. Just that.
Subconsciously, I think I wanted to do it this way because it looks pretty (lol).
Now, getting a bit more technical, a possible advantage I see is that this way I don't have to interact much with the
Java-side of the project. Most of the work I will do will be in
Ruby, and maintaining a constant interaction between
Java can be confusing. If I make a
Ruby class that handles this stuff for me, I might feel more comfortable in the future when I have to make like a hundred textures, but instead of interacting a hundred times with
Java, I do it with
Ruby, my main environment.
Does my reasoning make sense or is it a lame excuse to do something that looks pretty? Or perhaps there is indeed a good reason to do what I just did?