Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.
Binyamin Friedman14,615 Points
Why use an interface?
Why do we implement an interface instead of just using a normal class?
Ricardo Sala16,211 Points
Using an interface has several advantages:
1) By separating the logic from the interface, you can keep working on your logic once the product has been launched,
2) It helps to re-use your code (must of the code you will re use will be in the "logic files"). (DRY --> Do not Repeat Yourself!)
3) It makes the use of the program on different platforms easier. The logic is the same for website, smartphone, tablet...the interface is not.
So is always better to maintain the "separation of concerns" and keep the interface separated from the logic!
Hope it helps!!!