Trying to design small project in right way and have a trouble in it:\
about task: need to realize multiplication of big numbers, using fft
First, i have classes
class LargeNumber{};
class Field{}; -- abstract (maybe interface would be better)
class C_C:public virtual Field{};
class Z_p:public virtual Field{};
So, LargeNumber can use Z_P(modulo P) or C_C(complex) classes (more correct: C_C and Z_P have Mul and Sum functions to multiply LargeNumber objects)
but another task more interesting and difficult.
I need to calculate all operations and time each 'big' operation take. And also need to throw messages and create logs.
How to solve this problem? ( what should i do? )
Also will be great, if you comment patterns and your best practices. and so this classes:
class LargeNumber {
private:
int length;
vector <short int> number;
public:
//prototype
LargeNumber clone(){
return (*this);
}
//get
int Length() const;
vector <short int> Number()const;
//static
static LargeNumber& GenerateOne(int);// create new LargeNumber
static void Print(const LargeNumber& print);
//constructors
LargeNumber();
LargeNumber(const LargeNumber& obj);
explicit LargeNumber(int len);
explicit LargeNumber(vector <short int>);
LargeNumber(int,int);
//destructors
~LargeNumber();
void Kill();
//operators
LargeNumber& operator= (const LargeNumber& );
LargeNumber& operator--();
LargeNumber& operator++();
bool operator<(const LargeNumber&)const;
};
class Field {
private:
inline int max(const int a, const int b){return (a>b?a:b);}
inline int min(const int a, const int b){return (a<b?a:b);}
int i;
//need Mod and 2**P-1
LargeNumber& Deux (const int );
LargeNumber& Mod (LargeNumber&);
public:
virtual ~Field();
virtual LargeNumber& Sum (const LargeNumber& , const LargeNumber& );
virtual LargeNumber& Sub (const LargeNumber& , const LargeNumber& );
virtual LargeNumber& Mul (const LargeNumber& , const LargeNumber& );
virtual LargeNumber& Pow (const LargeNumber& , const LargeNumber& );
virtual bool Prime (LargeNumber& );
};

C_CandZ_p, nor method names likeMulandSum. Code is written once, read many times. Even with experimental or throwaway code, it is best to get into the habit of using meaningful, easy to read names always. Your future teammates - and the future you - will be glad you did. – Péter Török Feb 12 '12 at 17:25Z_pandC_Care perfectly understandable in this domain, and are not cryptic. – Sjoerd Feb 12 '12 at 22:44Fieldmust be named likeFftCoreor something similar. andC_C-ComplexFieldandZ_PModulo_Prime_Por something similar. – loldop Feb 13 '12 at 6:29Statistics,TimeKeeper( maybe a part ofStatistics) andLogFormerBut can't understand HOW they must interact with previous classes. – loldop Feb 13 '12 at 6:29