Re: Radix Class
Re: Radix Class
- Subject: Re: Radix Class
- From: Lester Dowling <email@hidden>
- Date: Mon, 9 Jan 2006 13:57:29 +1100
On 09/01/2006, at 12:48 PM, Jordan Evans wrote:
#import <Foundation/Foundation.h>
@interface Radix : NSObject
{
id arraySource;
int possibilities;
struct radixSet
{
id setPtr;
int element;
int omegaElement;
int radix;
}radixSet;
struct radixSet *sets;
}
Just a few things:
1. The extra effort to write clear documentation is well rewarded. I
still pull my hair out whether I come across undocumented code that I
wrote a long time ago and have completely forgotten about.
2. You can keep the struct radixSet out of the interface file and place
it in the implementation file where it properly belongs because it is
implementation detail. (Also, the way it is written, you have declared
not only the struct radixSet but also an instance variable radixSet
which is not used.) So, your interface can collapse to:
@interface Radix : NSObject
{
id arraySource;
int possibilities;
struct radixSet *sets;
}
and then your implementation can start with:
@implementation Radix
struct radixSet
{
id setPtr;
int element;
int omegaElement;
int radix;
};
// ...
3. Try to refactor the three methods allSequences, sequencesInRange,
and sequence. Keeping your key algorithm in one place helps enormously
with debugging. For instance, the method allSequences is a special
case of sequencesInRange, so it should simply return the result of
calling sequencesInRange with the whole range.
Hope this helps.
-- Lester
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden
References: | |
| >Radix Class (From: Jordan Evans <email@hidden>) |