Model First

When you're creating a GUI, you should develop and test the model first. We'll assume this has been done and that it has the following interface:

               public class SearcherFactory {
                   public static Searcher get(String s)
                           throws IOException {...}
               }

               public interface Searcher {
                   public Result find(Query q);
               }

               public class Query {
                   public Query(String s) {...}
                   public String getValue() {...}
               }
               public interface Result {
                   public int getCount();
                   public Document getItem(int i);
               }

               public interface Document {
                   public String getAuthor();
                   public String getTitle();
                   public String getYear();
               }

In testing and developing the GUI, I don't mind depending on the interfaces of the model; I'm less happy when I have to depend on its concrete classes.

Get Extreme Programming Installed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.