views:

76

answers:

1

AndroMDA uses the term "cartridge" (e.g. for out-of-the-box NHibernate support). As I understood it, it takes an API/component, wrapps it, never adds new features, simplifies it, often taking away "the full power", but works well for most cases.

My questions:

  • Is the term widely used?

  • Can one properly define it?

  • Should the suffix "Cartridge" be used in class/method names?

An example: is the following Base64 helper a cartridge for Base64 conversion? You give away all the power for performance-tuning, but if you simply want to decode a simple (and small) string it works fine:

Usage:

   Base64StringCartridge.Decode(input);

Implementation

public static string Decode(string data)
{
    try
    {
        System.Text.UTF8Encoding encoder = new System.Text.UTF8Encoding();
        System.Text.Decoder utf8Decode = encoder.GetDecoder();

        byte[] todecode_byte = System.Convert.FromBase64String(data);
        int charCount = utf8Decode.GetCharCount(todecode_byte, 0, todecode_byte.Length);
        char[] decoded_char = new char[charCount];
        utf8Decode.GetChars(todecode_byte, 0, todecode_byte.Length, decoded_char, 0);
        string result = new String(decoded_char);
        return result;
    }

    catch
    {
        return "";
    }
}
+3  A: 

It's called the Facade Pattern. Presumably the AndroMDA folks are big fans of old video game machines...

Shog9