Rationalize DataModel.getNumUsersWithPreferenceFor() API
--------------------------------------------------------

                 Key: MAHOUT-764
                 URL: https://issues.apache.org/jira/browse/MAHOUT-764
             Project: Mahout
          Issue Type: Improvement
          Components: Collaborative Filtering
    Affects Versions: 0.5
            Reporter: Sean Owen
            Assignee: Sean Owen
            Priority: Minor
             Fix For: 0.6
         Attachments: MAHOUT-764.patch

DataModel has a method getNumUsersWithPreferenceFor(long... itemIDs). It does 
what it says. However I think this is a suboptimal API (for which we have me to 
blame).

- All calls to this involve 1 or 2 arguments only
- No implementation supports more than 2 arguments, which makes the signature 
misleading
- All implementations internally have some logic like "if it's 1, do X, if it's 
args, do Y, otherwise fail"
- Calling this method, which happens frequently, always incurs the overhead of 
allocating a long[]

The change is simple: make this two methods, with one and two args 
respectively. Implementations would then just split their current 
implementation into these two methods.

There is no API change for callers, at all, if invoked with 1 or 2 args. I 
assume callers are not trying 3+ args now, as it has never been supported.
It does involve a straightforward change to implementors of DataModel.

Open for comment?

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to