Kotlin makes the interface a powerful language element by offering the possibility to declare default implementations for its functions and to define default values of its properties. Those features bring the interface to a whole new level, allowing you to use it for more advanced applications than simple contract declarations.
In this recipe, we are going to define a reusable interface responsible for validating email address values entered by a user into the input field in an abstract registration form. The interface will provide two functions. The first one is responsible for parsing the email address and deciding if the given value is a valid email address, and the second one responsible for extracting a user's login from the email text entered into the form.