Aug. 20th, 2006

gusl: (Default)
I don't like most programming books, tutorials and reference manuals. They tend to be too low-level, walking you through too many obvious steps, and they not helping you find the RightThing for your sort of problem.

I think I much prefer books that goal-oriented, like:

* How to Solve Problems with X
* Patterns in X

They are better for someone who needs to write code, rather than someone who needs to read it.

With these books, it should be much easier to find the answers my questions, partly because they tend to *have* the answers, partly because they have less boring, distracting junk.

Right now, I want to find a good book about How to Solve Problems with Java.
gusl: (Default)
Given classes A and B,

A extends B
means that instances of A can invoke methods implemented in B.

A implements B
means that A implements the interfaces in B. The methods are implemented in A.

In this sense, "extends" and "implements" are opposites.

But I often think of them as being the same, because with the class names normally used, both of them can be read as "ISA". This is confusing.

I think the solution is to consciously distinguish "is a subtype of" from "is an implementation of".

---

Multiple inheritance is a bit tricky. I don't understand how all these things fit in, but from here I learned that:

* You need to create a new class Child, to be the result of the mix between Parent (first parent) and Other (second parent).
* Child extends Parent and implements 2 interfaces, MProvides and MRequires.
* There is a class called Mixin, used for the purpose of communicating with Other, which implements MProvides, and whose constructor requires an instance of MRequires. This instance simulates a parent-class for Mixin.
* The Child's constructor instantiates a Mixin, passing itself "this" as an argument. For each method func(...) that you inherit from Other, you need to write a implement a method mixin.func(...)

I don't yet understand whether this last annoyance is circumvented with "General Multiple Inheritance".

February 2020

S M T W T F S
      1
2345678
9101112131415
16171819202122
23242526272829

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags