What made me interested in the Go programming language is the concept behind its interfaces. Object-oriented programming is conceived differently in Go, if we compare Go OOP to other OOP languages, we will notice a different approach to how objects behave in this language. Go is famous for its simple and readable syntax, it is a language that contains only 25 built-in keywords. For example, a famous keyword like the keyword (exists in most languages) doesn't exist in the syntax of Go. Instead, the is an alternative keyword for the class definition. class struct Because of this simplicity, concepts like inheritance, polymorphism, and abstraction are implemented differently in Go. Before starting to explain interfaces, an object definition in Go is of type . so in order to define a Person struct in Go, we describe it in the following block of code: struct type Person struct{ Name string Age int } The person has 2 attributes (Name and Age attributes). What is an interface? An interface is a set of method signatures that a type can implement. therefore, the interface defines the behaviors of the object (any kind of object). The definition is as simple as that. For example, let's say we have an interface called , it is defined as the following: Speak type Speak interface{ Arabic() French() English() } To make a type implement the interface, it (object or variable) must define all of the 3 methods implemented abstractly in the Speak interface : , and . Speak Arabic() French() English() The type implements , if itself has the 3 methods definitions: Person Speak func (p Person) Arabic(){ /* code here */ } func (p Person) French(){ /* code here */ } func (p Person) English(){ /* code here */ } In other languages, you need to inherit from the interface using the keyword . But you just need to define the functions. implements The capability of an empty interface Go programming language has static typing, which means that any variable in a program's life cycle has to have only one type (built-in or custom). An integer variable remains as an integer variable, the same thing applies to the other types. Unlike Python, a variable can change its type only by reassigning it with a new different value. Yet, Go can imitate the dynamic typing of Python and can change the variable from one type to another in a single program, and we can thank empty interfaces for that. Let's see how we can’t change the types in this example: func main(){ var x int x = 5 x = "change x" fmt.Println(x) } We reassigned the integer value by a variable with a different type (a string "change x"), the program then displayed the following error: x ./prog.go:10:6: cannot use "change x" (untyped string constant) as int value in assignment However, if we change the type of from to an empty interface , the program will run successfully and the variable will be reassigned again. x int interface{} func main() { var x interface{} x = 5 fmt.Printf("x=%v of type :%T\n", x, x) x = "Fares" fmt.Printf("x=%v of type :%T", x, x) } The type of changed dynamically from integer to string, and we can easily reassign it with any existing type in Go. x x=5 of type :int x=Fares of type :string Now, if we declare an empty interface variable without assigning it, what can be the result? it will be a value. nil Polymorphism using interfaces if you want to do polymorphism in other languages, you need to make a parent class and multiple children classes inherited from the parent. then you declare an array of the parent class type and instantiate the subclasses and add them to the array. In GO, things go differently, we can deal with an interface as a global custom type. we can build polymorphism on the example above and try this code block: type Speaker interface{ Arabic() English() French() } type NativeSpeaker struct{ Name string } type ForeignSpeaker struct{ Name string Nationality string } // methods for NativeSpeaker struct func (NS NativeSpeaker) Arabic(){ /* code here */ } func (NS NativeSpeaker) English(){ /* code here */ } func (NS NativeSpeaker) French(){ /* code here */ } // methods for ForeingSpeaker struct func (FS ForeignSpeaker) Arabic(){ /* code here */ } func (FS ForeignSpeaker) English(){ /* code here */ } func (FS ForeignSpeaker) French(){ /* code here */ } // all 3 methods must be defined in order to belong to the Speaker type. func main() { listOfSpeakers := make([]Speaker, 0) Sp1 := NativeSpeaker{Name: "John"} Sp2 := ForeignSpeaker{Name: "Mohamed"} listOfSpeakers = append(listOfSpeakers, Sp1, Sp2) fmt.Println(listOfSpeakers) } As you can see the Speaker interface is the global type that assembles and custom types. those shares the same method signatures that were declared in interface. NativeSpeaker ForeignSpeaker Speak