Should every Java domain class implement an interface? -
i've been looking on java project done @ company , in project developers created interface pretty ever domain entity (there hundreds). in cases, think abstraction works, in other cases doesn't seem need @ time.
whenever instances passed around referred , access via interface.
is bloat future proofing? or sound engineering practice?
interfaces specify required behavior without implementation. allow swap implementations without affecting clients. can useful techniques aspect-oriented programming or proxy generation.
but if implementation doesn't change, see no justification interface.
most model objects fall category. if there's no implementation differences, don't use interface.
interfaces terrific services , persistence classes, have never seen them used abstract model objects.
Comments
Post a Comment