[RPS] Results object

Daniel Nugent nugend at gmail.com
Thu Jul 7 10:57:28 EDT 2005


I think that's certainly a good idea, however as a I said before, I
think the syntax for access should fit closer to the traditional array
access.

Like, 

conn = R43.new(1234, "proxy.example.com)
#When this is called, the first 10 results are retrieved and the instance
#array that stores the results is initially populated.
 goals_people = conn.get_goals_people

#The array is checked if element 15 has been popluated and if it is not,
#goals 15-25 are retrieved and poplated in the array
a_person = goals_people[15]

#same thing happens here, except the 25 elements starting at 30 are asked for
bunch_of_people = goals_people[30..55]

#This calls a publically accessable method like goals_people.populate
to completely fill the array up and then iterate through
goals_people.each do |person|
...
end

PS: Did you get a chance to look at those three functions and the test
cases I sent to the mailing list?  I wanted to get feedback on them
before I continued.

On 7/7/05, pat eyler <pat.eyler at gmail.com> wrote:
> There hasn't been a lot of talk around the Results object proposals
> yet, so I thought I'd try to jot a few ideas down and see what people
> thought.
> 
> First, some stories:
> 
> * Tom wants to add the status from a team goal to his website.  He'd
> like to be able to display the last entry, and the titles of the last
> 10 entries.
> 
> * Kathy wants to get a list of the most recent 5 people who've
> adopted the 'lose 30 pounds' goal in email every day so that she
> can give them cheers.
> 
> * Bill wants to look for people with Ruby related goals in his city.
> 
> * Susan wants to get a random set of flickr pictures from people with
> the 'take more pictures' goal every day.
> 
> 
> Now for some other ideas:
> 
> I'm growing less happy with R43results or R43Results every time I see
> it.  How about just calling the class Results?
> 
> I really like the idea of a somewhat dynamic object.  That is, I'd
> like to be able to get an initial set of results back and based on
> what's given me make additional results against the same object. E.g.,
> make a get_goals_people call, then find out how many more people are
> available, and make some number of additional requests growing the
> Results::people array until I have as many people as I want.
> 
> I almost seems like a user should create the R43 object then deal with
> Result objects to get things done:
> 
>   conn = R43.new(1234, "proxy.example.com)
>   goals_people = conn.get_goals_people
> 
>   if goals_people.max < goals_people.num_people then
>     goals_people.more(goals_people.max) #get all the people listed
>   end
> 
>   goals_people.people.each do |person|
>     # do something with each person
>   end
> 
> Does this seem about right?
> --
> thanks,
> -pate
> -------------------------
> We are often unable to tell people what they need to know, because
> they want to know something else, and would therefore only
> misunderstand what we said
> - the Raven   (George MacDonald, Lilith)
> 
> _______________________________________________
> Therps-discuss mailing list
> Therps-discuss at rubyforge.org
> http://rubyforge.org/mailman/listinfo/therps-discuss
> 


-- 
-Dan Nugent



More information about the Therps-discuss mailing list