In Scala, a value can override a function
Briefly

In Scala, a value can override a function
The uniform access principle originated with Bertrand Meyer in the 1980s and was implemented in Eiffel. It states that all services offered by a module should be accessible through a uniform notation that does not reveal whether the service is backed by storage or computation. Following the principle helps encapsulate implementation details, which simplifies refactoring when the underlying mechanism changes. If storage retrieval and computation use different notations, switching between them can require edits across multiple files. Even with modern IDEs, changing syntax such as adding or removing parentheses can still be time-consuming. Java tends not to follow the principle, while Scala is designed to support it, including when using Java libraries.
"All services offered by a module should be available through a uniform notation, which does not betray whether they are implemented through storage or through computation."
"Encapsulating implementation details, such as whether a service is implemented through storage or through computation, simplifies refactoring. If it's more efficient to change storage to computation, or the other way around, we can do so without breaking modules that depend on that particular service."
"Keep in mind that back in the 1980s, refactoring could be difficult at times. If storage retrieval and computation use different notations, changing one to the other might mean changes to several different files. Even now, with our integrated development environments (IDEs) like Apache NetBeans and IntelliJ IDEA for Java, having to add in or remove empty parentheses can be time-consuming."
"Java is not inclined to observing the uniform access principle, but Scala is, and Scala can help in the observance of this principle, even when importing from the Java Development Kit (JDK)."
Read at Medium
Unable to calculate read time
[
|
]