Alex O'Ree created JSPWIKI-1385:
-----------------------------------

             Summary: API Changes to resolve (String pageName, int version) 
design anitpattern
                 Key: JSPWIKI-1385
                 URL: https://issues.apache.org/jira/browse/JSPWIKI-1385
             Project: JSPWiki
          Issue Type: Improvement
            Reporter: Alex O'Ree


so we have a bit of an anti pattern in our APIs. Anything related to pages, 
page text, etc that uses the API pattern
 * <return type> someAction(String pageName, int version)
 * <return type> someAction(String pageName)

is a bit of an anti pattern. As needsĀ are now emerging to add new ways to 
locate a page beyond just the page name and a version, it makes adding new 
capabilities super painful from an API and maintenance perspective. I was 
recently bit by this at my day job and the refactoring was super painful but in 
the end worth it.

A better pattern is to have some kind of record locator class

class WikiLocator {

String pageName.

int version;

//other future stuff here
}

Then the existing APIs get deprecated in favor of
 * <return type> someAction(WikiLocator locator)

which provides the same function as the two previous method.



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to