I have a Web Application for which we are adding an API now.
I am looking for best practices to keep in mind while working on this.
I am considering these factors:
DRY: Avoid redundancy (to the extent possible). Take for example, a part of the code which handles a form submission. There are some parts which are applicable for only Web Form submission but not relevant to the equivalent API Post call. I am thinking of modularizing the common code behind this Post handlers. I must add that the handler classes for Web Form and API are different. I am creating a third class which will have the common methods. This third class would be inherited by the two handler classes (along with their other base classes, multiple-inheritance).
Should I refactor the code such that the Web Form 'Post' handler method in turn calls the API Post method?
Thanks.