Should interface only be used for behavior and not to show logical data grouped together?
Posted
by
jags
on Programmers
See other posts from Programmers
or by jags
Published on 2014-05-29T06:17:48Z
Indexed on
2014/05/29
15:52 UTC
Read the original article
Hit count: 202
Should an interface only be used to specify certain behavior? Would it be wrong to use interface to group logically related data?
To me it looks like we should not use interface to group logically related data as structure seems a better fit. A class may be used but class name should indicate something like DTO so that user gets the impression that class does not have any behavior.
Please let me know if my assumption is correct.
Also, are there any exceptions where interface can be used to group logically related data?
© Programmers or respective owner