• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Radix Class
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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>)

  • Prev by Date: Radix Class
  • Next by Date: committing an NSTextView bound to Core Data
  • Previous by thread: Radix Class
  • Next by thread: Radix Class
  • Index(es):
    • Date
    • Thread