开发者

When should one create interface for request or response for messaging within the application

开发者 https://www.devze.com 2023-01-01 17:51 出处:网络
I want to know if there is any need to create interface for request/response objects. I know ServletRequest is an interface.

I want to know if there is any need to create interface for request/response objects. I know ServletRequest is an interface.

I see request/response as simple pojo, where having some members to hold data and getter/setters would suffice.

The processing of such data could be delegated to external utility classes.

Does anyone have specific inputs 开发者_开发知识库on this? Thanks Nayn


What you describe looks like a transfer object. Normally there is no need to have an interface for that.


Hard to answer such a question in general... one good reason for defining such an interface is to isolate other parts of the app from the Servlet API. This may make e.g. unit testing easier.

0

精彩评论

暂无评论...
验证码 换一张
取 消