Re: Radix Class
Re: Radix Class
- Subject: Re: Radix Class
- From: Alberto Ricart <email@hidden>
- Date: Mon, 9 Jan 2006 14:28:57 -0600
Not really reading your doc, simply looking at your code without
putting too much thought behind what it does:
1) It is very weird to see struct's used in OO.
You should create another object to represent your RadixSet. If you
make the instance variables public, then from within your code you
can do foo->something to access them. True OO would not do this (as
you are breaking encapsulation), and would instead call accessor
methods. Unless you are writing high-performance code that requires
the optimization.
2) It seems that you are caching values like the count (numOfSets)
that are managed (or should be managed in a collection, so you don't
keep track of that kind of stuff, as the collection would do it for
you). I would rewrite to use the collections more fully.
3) #2 is even stronger when you realize that you are given an array
(so you use a collection to pass them around, but then revert to
unroll it into your own data structure. Why?
4) You would probably never reInitWithXXX, instead you simply alloc
and init a new Radix. If you are doing object pooling, then the
correct thing to do is to have a setter method like setArrayOfSets:
(NSArray*) to assign a new collection to your object.
5) zeroElements would be clear or something like this. If you
delegate the set management to an NSArray, you simply remove all
objects and be done, this would also remove many of the malloc/frees
/a
_______________________________________________
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>) |