Concepts of programming language - John C. Mitchell -

- "Programs are meant to be understood, modified, and maintained over their lifetime."
--> (Me) though, I think programs are meant to express what happened in our minds, ideally with same level of abstractions. I would say that any programming language could be understood and modified, but could not necessarily allow good "abstraction means". Just readable doesn't mean that your program is "maintainable".
- Methods that detect program errors at compile time are usually conservative, which means that when they say a program does not have a certain kind of error this statement is correct. However, compile-time error detection methods will usually say that some programs contain errors even if errors may not actually occur when the program is run.
- Expressiveness: is a language programming quality making easier to write programs and make programming less prone to error.


Java inheritance VS Interface implementation

    Inheritance is a subtancial relationship between parent and child.
When the Class Integer extends a Class Number, it means that Integer is, by definition, a number.

    The goal of Interfaces is to augment a Class by a functionality needed to accomplish a specific task. The interface is not part of Class definition in the sense that you can remove the Interface, and the identity of the Class remains  intact.
For example, Integer Class may implement a "Comparable" Interface, in order to allow comparison between numbers.


Comment: Maybe,"Interface" is called so because it opens a door in the Implementer-Class.
Such "door" allows to interact safely with Implementer-Class as being a provider of Interface functionality

Externals: 
Mixin, Trait: OOP constructs for code reuse, both are an alternative to -rigid- inheritance / composition.
  • Mixin: a class (behaviour + state) that can be mixed with a target class to provide additional capabilities. In case of multiple mixins, conflicts could be raised (daemon problem), this is fixed implicitly (linearisation algorithm).
  • Trait: a set of behaviour (basically with no state) that can be reused on a target class. a class may be enhanced with multiple traits (no daemon  problem since traits are not classes). The name-claches have to be resolved explicitly (manually)

Mixin: means inheritance without sub-typing semantic (include analogy).
Trait: it's not inheritance (similar to interface with default methods on java).

 

From GOF book: 

mixin class is a class that's intended to provide an optional interface or functionality to other classes. It's similar to an abstract class in that it's not intended to be instantiated. Mixin classes require multiple inheritance:

 

(e.g.in JAVA, interfaces are mixin)



Strachey:

  • Function (applied to expressions) when applied to suitable arguments it produces a value.
  • Routine applied to commands (e.g assignment) The application of a routine to a
    suitable set of arguments is a complicated command, so that although it affects the store of
    the computer, it produces no value as a result.

No comments: