Is my code overdesigned? Does it rely too heavily on interfaces? Context:

I am using XNA to create a simple game / learning project.

Problem:

I have three interfaces, each with a different purpose in mind. However, the way I use them, as well as their implementations, makes me feel as if my code is overdesigned and poorly thought out, so I am looking for better approaches, if possible.


IGrid&lt;T&gt; is intended to wrap a 2-dimensional array, exposing only the Size and indexer.
IChunk&lt;T&gt; is intended to be a grid object with a predetermined size.
IMesh&lt;T&gt; is intended to be a grid, but with several methods to manipulate and transform the data.


Interfaces:

public interface IGrid&lt;T&gt;
{
    Point Size { get; }
    T this[int x, int y] { get; set; }
}

public interface IChunk&lt;T&gt; : IGrid&lt;T&gt;
{
}

public interface IMesh&lt;T&gt; : IGrid&lt;T&gt;
{
    IMesh&lt;T&gt; Clone();
    IMesh&lt;T&gt; Flip(bool horizontal, bool vertical);
    IMesh&lt;T&gt; Rotate(bool clockwise);
    IMesh&lt;T&gt; Slice(Rectangle value);
    IMesh&lt;T&gt; Slice(int x, int y, int width, int height);
    IMesh&lt;T&gt; Transpose();
}


The idea is that I would use IGrid to create a "custom array" which could be inherited from. IChunk would hold a finite part of the world, breaking it apart for easier/segmented access, while IMesh would let me define a heightmap (with T:float), for example, and let me merge and manipulate them very easily (for generating terrain and the like).

Classes:

A secondary concern is defining custom operators for my Mesh class, in such a way that they could easily be added, subtracted, multiplied, etc. Now, because operator overloading involves static methods, it can't really be inherited in an elegant way.

I had tried a pattern in which I made an abstract MeshBase class that defined the operators, which called protected and abstract methods as handlers for the operations, but because of the typing involved, simply adding three meshes together involved heavy usage of casting. Needless to say, it was messy and almost unusuable.

My current solution is to do something like the following to have more control over the manipulation:

public class Mesh&lt;T&gt; : Grid&lt;T&gt;, IMesh&lt;T&gt;
{
    public Mesh(int x, int y)
        : base(x, y)
    {
    }

    // Clone(), Flip(), Rotation(), Slice(), Transpose() methods here
}

public class FloatMesh : Mesh&lt;float&gt; // Used as a heightmap!
{
    // Add the values of the two meshes together, creating a new mesh
    public static FloatMesh operator +(FloatMesh a, FloatMesh b) { }

    // Add the value of "b" to every element of "a", creating a new mesh
    public static FloatMesh operator +(FloatMesh a, float b) { }     
}

public class Vector2Mesh : Mesh&lt;Vector2&gt; // Possibly used for sampling perlin noise
{
    // Add the values of two meshes together, creating a new mesh
    public static Vector2Mesh operator +(Vector2Mesh a, Vector2Mesh b) { }

    // Apply the XY values of "b" to every element of "a", creating a new mesh
    public static Vector2Mesh operator +(Vector2Mesh a, Vector2 b) { }

    // Apply the value of "b" to each XY value of every element of "a", creating a new mesh
    public static Vector2Mesh operator +(Vector2Mesh a, float b) { }
}


Obviously, I would need to define these operators for every specific type I wanted to use. Nothing is stopping the user from making a Mesh themselves, if they're only interested in Transpose(), etc., but using a more derived class offers the ability to use convenient operators in addition to the transformation methods.

Conclusion:

Anyways, I am interested in whatever feedback you guys can offer. Like I said, I don't know if I made this in a very roundabout way, or if there is an easier/simpler way of accomplishing what I want.
Is my code overdesigned?


I think so ;)




  IChunk&lt;T&gt; is intended to be a grid object with a predetermined size.

public interface IChunk&lt;T&gt; : IGrid&lt;T&gt;
{
}



But a grid is already a grid object with a predetermined size:


public interface IGrid&lt;T&gt;
{
    Point Size { get; }
    T this[int x, int y] { get; set; }
}



I don't think you need IChunk&lt;T&gt;. Why not just use a IGrid&lt;T&gt;?



IGrid&lt;T&gt; is redundant here:


public class Mesh&lt;T&gt; : Grid&lt;T&gt;, IMesh&lt;T&gt;



Because IGrid&lt;T&gt; is already specified by IMesh&lt;T&gt;, you can't implement IMesh&lt;T&gt; without implementing all of IGrid&lt;T&gt;, because IMesh&lt;T&gt; : IGrid&lt;T&gt;.



I might be wrong, but it seems to me that "adding up" two terrains is a non-trivial operation that would be best rendered as a full-fledged method than in an operator for the terrain itself. Can you make an operator async?