Ask HN: Designing via Interface in Java?
Hi,
Often I see experienced Java developers asking us to develop the system using Interfaces rather than starting with classes. Yes, I do create interfaces, I know whats its usecases are etc. However the term "design your system using interfaces" is somewhat confusing to me. Is it a pattern for designing robust application in Java world? How should one learn it?
If so are there any online books / blogs regarding the same?
Note: I had already asked the question in Java Subreddit, but I want to get HN community thoughts as well.
1 comment
[ 3.8 ms ] story [ 8.6 ms ] threadOf course it's a common pattern--that doesn't mean it's always necessary. It does make a lot of things easier, like testing, etc.
It's the same thing as declaring your vars as `List` or `Collection` instead of `ArrayList`. If you do the same thing in your system you give yourself much more flexibility.