Go Back   Coding Forum > Coding World > Java

Reply
 
LinkBack Thread Tools Display Modes
Old 06-01-2015, 07:30 PM   #1 (permalink)
Stefan Ram
Guest
 
Posts: n/a
Default Wiring: A topic underrepresented in teaching?

Do you agree with my following definition?

Definition: When a reference to an object B is being
stored in an object A, this is called /wiring/.

Now, one can make this observation:

When a non-trivial Java program is being started, it builds
an /object graph/ by creating and wiring objects. In a
sense, this object graph then is »executed« by the program.
Sometimes, it is being changed in the process of this execution.

Is it possible that the important notion of »wiring« and the
observation that wiring creates an object graph (and calling
this an »object graph«) often is underrepresented in many
Java books / tutorials?

(To me, wiring seems to be even more fundamental than IoC.
One can teach wiring and the object graph first without IoC
and then introduce IoC and similar ideas later.)

  Reply With Quote
Old 06-01-2015, 08:30 PM   #2 (permalink)
Eric Sosman
Guest
 
Posts: n/a
Default Wiring: A topic underrepresented in teaching?

On 6/1/2015 3:07 PM, Stefan Ram wrote:
> Do you agree with my following definition?
>
> Definition: When a reference to an object B is being
> stored in an object A, this is called /wiring/.


In what sense can one "agree" with a definition? A definition
attaches a name to a thing, and the name is pretty much arbitrary:
If you changed /wiring/ to /lending/ every part of the revised
definition would be just as valid as the original. Definitions are
(by definition!) "correct."

The "goodness" of a definition, though, can be judged. In a case
like the present, where the name being defined is already assigned to
things other than the new one, it can be suggestive -- helpfully or
harmfully, to a greater or lesser extent. The term /wiring/ suggests
a connection, and is thus more helpful than, say, /dieting/. But
/wiring/ also carries connotations of "flow," which seem at best
irrelevant to the notion of reference. Also, /wiring/ in the existing
use suggests a bi-directional connection (tug on either end of a wire
and the other will feel the pull), and this is at odds with the
unidirectional nature of Java references. So, although /wiring/ has
merit I do not think I'd abandon the search for a better definition.

> Now, one can make this observation:
>
> When a non-trivial Java program is being started, it builds
> an /object graph/ by creating and wiring objects. In a
> sense, this object graph then is »executed« by the program.
> Sometimes, it is being changed in the process of this execution.


The notion of an object graph is surely unobjectionable -- how
could one explain reference-based garbage collection without in some
way introducing it? But I'm not so sure that Java "executes" its
object graph in any useful sense. Java maintains a distinction between
data and code, the code residing in methods and so on, while the data
resides in objects (for the most part). Yes, there are facilities that
transform data into code and vice versa, but the transformations are
too, well, "obtrusive" to fit comfortably with the notion that Java
"executes" an object graph.

Ultimately, a Java object is a container of primitives and
references. The object belongs to a class and is therefore associated
with executable code, but I don't think it's helpful to characterize
primitives and references as "executable."

> Is it possible that the important notion of »wiring« and the
> observation that wiring creates an object graph (and calling
> this an »object graph«) often is underrepresented in many
> Java books / tutorials?


"Is it possible?" Sure. "Is it actual?" Beats me.

> (To me, wiring seems to be even more fundamental than IoC.
> One can teach wiring and the object graph first without IoC
> and then introduce IoC and similar ideas later.)


I live near Boston, Massachusetts, USA, and the less I hear
about 2024 and the IOC the happier I'll be.

--
esosman@comcast-dot-net.invalid
"Don't be afraid of work. Make work afraid of you." -- TLM
  Reply With Quote
Old 06-01-2015, 09:30 PM   #3 (permalink)
Silvio
Guest
 
Posts: n/a
Default Wiring: A topic underrepresented in teaching?

On 06/01/2015 09:07 PM, Stefan Ram wrote:
> Do you agree with my following definition?
>
> Definition: When a reference to an object B is being
> stored in an object A, this is called /wiring/.
>
> Now, one can make this observation:
>
> When a non-trivial Java program is being started, it builds
> an /object graph/ by creating and wiring objects. In a
> sense, this object graph then is »executed« by the program.
> Sometimes, it is being changed in the process of this execution.
>
> Is it possible that the important notion of »wiring« and the
> observation that wiring creates an object graph (and calling
> this an »object graph«) often is underrepresented in many
> Java books / tutorials?
>
> (To me, wiring seems to be even more fundamental than IoC.
> One can teach wiring and the object graph first without IoC
> and then introduce IoC and similar ideas later.)
>


We use the term "wiring" for something different.

We have a layer of classes that are the top-level building blocks for
our class of applications. These classes are defined as isolated
entities and use abstract methods for both parametrization and callbacks.

Then in the application we define objects that instantiate-and-extend
(a-la Scala object) these classes. There the instances are linked
together by implementing the abstract methods. This is what we call
"wiring".

So we use the term to describe a pattern that prevents classes from
referencing each-other directly.

But then again: what is in a name?

  Reply With Quote
Reply

Thread Tools
Display Modes



All times are GMT. The time now is 11:50 AM.


Powered by vBulletin® Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright ©2010, CodingForum.Org