Is it a good design to make ActionFormBean to implement an interface?? i wrote one utility for pagination by which we can display the results in pages and users can select some records , by checking the check box provided. I made it as a separate utility class.. But when i gave it to offshore team they made some changes and they created an interface for pagination and made the ActionForm bean to impelment that interface. (I really don't understand why they did it ((:- ). i find no reason for making that as an interface.
It would be hard to say for sure without seeing the code and how it is used. In this case I could easily see an interface that all forms that support paging would implement. Then a common set of code could treat all these forms generically. Then again, I have run into programmers that like to cram there code full of interfaces, patterns, and abstractions for no real reason.
Joined: Jun 30, 2006
As you said ..they have used some common code which treats these form beans generically. But in formbeans they have just duplicated the implementation code. for example , some of the methods they have declared in the interface are
1. public Map getSelectedItemsMap(); 2. public void setSelectedItemsMap(Map map); 3. public String getPageSelected(); 4. public void setPageSelected(String selPage); 5. public String getCount(); 6. public void setCount(String cnt);
As you can see, these are all only getters and setters which will be same for every impelementation. Also note that it is not any behaviour that they are re-defining in different ActionForms.