0
AndroMDA는 "카트리지"라는 용어를 사용합니다 (예 : 즉시 사용 가능한 NHibernate 지원). 필자가 이해 하듯이 API/구성 요소를 사용하고 wrapps하고 새로운 기능을 추가하거나 단순화하지 않으며 종종 "모든 기능"을 없애지 만 대부분의 경우 잘 작동합니다."카트리지"패턴이 있습니까?
내 질문 :
이 용어가 널리
사용됩니까?제대로 정의 할 수 있습니까?
"Cartridge"접미사를 클래스/메소드 이름에 사용해야합니까?
예 : 다음 Base64 도우미가 Base64 변환 용 카트리지입니까? 당신은 성능 튜닝을위한 모든 힘을 포기하지만, 당신은 단순히 간단 (작은) 문자열을 디코딩 할 경우 잘 작동합니다 :
사용법 :
Base64StringCartridge.Decode(input);
구현
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 "";
}
}