The Role of Interfaces in Our Code

glasses over code picture
Many programming languages allow us to define interfaces (in addition to defining classes). Despite the importance of interfaces, many programmers avoid using them.

Share This Post

Defining Interfaces in Our Code

Many programming languages (such as Java, C#, TypeScript, Kotlin, PHP, and many others) allow us to define interfaces and thus create new types, similar to creating new types when we define new classes).

The Importance for Defining Interfaces

The interfaces are used for a variety of purposes, the most important of which is creating code that is more flexible to changes. This goal is mainly achieved through definition of variables and parameters their type is created through the definition of interface.

The Usability of Interfaces in Our Code

You can find a comprehensive explanation (in Hebrew) about the important uses of interfaces in the Java programming course available on the life michael academy website. These uses include, among others, the following ones:

+ Creating a common type for various unrelated different types
+ Partial implementation of multiple inheritance
+ Apply requirements from developers in new libraries we develop
+ Using an interface as a trait (in languages that do not support traits)

An explanation in English for some of these usages can be found in the Java 8 Default Methods presentation that was prepared for a meetup that was delivered in the life michael academy meetup group.

Subscribe To Our Newsletter

Get updates and learn from the best

More To Explore

The Java Monthly Newspaper
Java

The Java Monthly Review

The Java Monthly Review is a new monthly newsletter that focuses on the Java programming language.

Do You Want To Boost Your Business?

drop us a line and keep in touch

life michael academy asynchronous online courses

Java | Python | JavaScript | TypeScript

Skip to content Update cookies preferences