0

I was reading about Struts1 vs Struts2 and the author mentions one of the point is

" Programming the abstract classes instead of interfaces is one of design problem of struts1 framework that has been resolved in the struts 2 framework. Most of the Struts 2 classes are based on interfaces "

COuld anybody please tell me , from a developer point of view , does we need to bother if the framework uses classes or interfaces . Could anybody please help me in knowing why using Classes in a interface is not good .

1 Answers1

0

Could anybody please help me in knowing why using Classes in a interface is not good.

That's not what's said.

See this SO question/answer, or search the web for "program to an interface". The nutshell version is that programming to an interface (when done correctly) allows us to use multiple implementations of that interface based on our needs.

Doing so allows us to test more easily, allow functionality we didn't necessarily think of when we wrote the original base code (within reason), and so on.

Community
  • 1
  • 1
Dave Newton
  • 158,873
  • 26
  • 254
  • 302