Interface for object-oriented languages..
They are more than a just a class with abstract methods.
They play a key role in many design patterns and principles.
A
https://abs.twimg.com/emoji/v2/... draggable="false" alt="🧵" title="Thread" aria-label="Emoji: Thread"> about 6 imp. aspects of interfaces.
#SoftDev #Java #100DaysOfCode #Linux
They are more than a just a class with abstract methods.
They play a key role in many design patterns and principles.
A
#SoftDev #Java #100DaysOfCode #Linux
When you call an interface method, you can often ignore what is under the hood.
Example: class & #39;C& #39; need not know the exact database that stores the data.
The buttons of your calculator are its interface.
When you push & #39;+& #39;, you send the & #39;sum& #39; message.
Same with objects.
When A calls a method on B, A sends a message to B.
They set:
If you call "setSide" on a square, you expect all 4 sides to change.
If you implement "setSide", you must change 4 sides or you& #39;ll break the contract.
You can write a function that uses "Shape" and it will work for "Square" and "Circle".
If you ever need "Triangle", you don& #39;t have to modify the function.
This is how you write abstract code.
Control flow can go from class & #39;C& #39; to class & #39;Database Access& #39; without the former depending on the latter.
Control flow dependencies need not mirror source code dependencies.
Therefore - -
https://abs.twimg.com/emoji/v2/... draggable="false" alt="✨" title="Funken" aria-label="Emoji: Funken"> Interfaces are a key part of object-oriented languages
https://abs.twimg.com/emoji/v2/... draggable="false" alt="✨" title="Funken" aria-label="Emoji: Funken">
They allow you to create well-designed systems that:
https://abs.twimg.com/emoji/v2/... draggable="false" alt="✅" title="Fettes weißes Häkchen" aria-label="Emoji: Fettes weißes Häkchen"> Keep complexity under control.
https://abs.twimg.com/emoji/v2/... draggable="false" alt="✅" title="Fettes weißes Häkchen" aria-label="Emoji: Fettes weißes Häkchen"> Separate concerns.
https://abs.twimg.com/emoji/v2/... draggable="false" alt="✅" title="Fettes weißes Häkchen" aria-label="Emoji: Fettes weißes Häkchen"> Are modular, loosely coupled, and testable.
https://abs.twimg.com/emoji/v2/... draggable="false" alt="✅" title="Fettes weißes Häkchen" aria-label="Emoji: Fettes weißes Häkchen"> Are easy to change.
They allow you to create well-designed systems that: