Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Java (http://www.velocityreviews.com/forums/f30-java.html)
-   -   terminology (http://www.velocityreviews.com/forums/t945571-terminology.html)

Stefan Ram 04-19-2012 10:50 PM

terminology
 
Sometimes, I was being criticized for making up non-standard
terminology. If there is a standard term for the following,
then please tell me so:

In

java.lang.Thread . dumpStack()
java.lang.System.out . print( 2 )

I do call the source code part in front of the last dot a
/context/.

I do call the simple name between the last dot and the first
parentheses a /verb/. (So a verb does never contain a dot.)

(I do /not/ call this »method name«, since I want to exclude
texts with dots, like »>java.lang.Thread.dumpStack«, which
are also method names in Java AFAIK.)

I do call the simple call after the last dot up to the last
parentheses a /sentence/.

(I do /not/ call this »[method ]call«, since the whole lines
including the dots are also called »[method ]calls« or
»[method ]invocations« in Java.)

context sentence
..------------------. .------------.
java.lang.Thread . dumpStack()
java.lang.System.out . print ( 2 )
'-------'
verb
'------------------------------'
not a verb, because of dots
'-----------------------------------'
not a sentence, because of dots

Ok, »context« /is/ a standard JLS term, but »verb« is less
so (although sometimes used in OOP, IIRC), and »sentence«
was invented by me, but seems natural, once one accepts »verb«.

However, if there are already standard Java terms for this,
I'd gladly use them.


Lew 04-20-2012 12:17 AM

Re: terminology
 
Stefan Ram wrote:
> Sometimes, I was being criticized for making up non-standard
> terminology. If there is a standard term for the following,
> then please tell me so:


<http://docs.oracle.com/javase/specs/jls/se7/html/jls-6.html>

> In
>
> java.lang.Thread . dumpStack()
> java.lang.System.out . print( 2 )
>
> I do call the source code part in front of the last dot a
> /context/.


Fully-qualified type name.
<http://docs.oracle.com/javase/specs/jls/se7/html/jls-6.html#jls-6.5.5.2>

> I do call the simple name between the last dot and the first
> parentheses a /verb/. (So a verb does never contain a dot.)


Simple method name.
<http://docs.oracle.com/javase/specs/jls/se7/html/jls-6.html#jls-6.5.7.1>

> (I do /not/ call this »method name«, since I want to exclude
> texts with dots, like »>java.lang.Thread.dumpStack«, which
> are also method names in Java AFAIK.)


Qualified method name.
<http://docs.oracle.com/javase/specs/jls/se7/html/jls-6.html#jls-6.5.7.2>

> I do call the simple call after the last dot up to the last
> parentheses a /sentence/.


Method invocation expression, except that includes the qualifier. There is no standard term for what you call a "sentence", nor would most Java programs have the faintest clue what you mean by that word.
<http://docs.oracle.com/javase/specs/jls/se7/html/jls-15.html#jls-15.12>

> (I do /not/ call this »[method ]call«, since the whole lines
> including the dots are also called »[method ]calls« or
> »[method ]invocations« in Java.)


There's always a qualifier in a method invocation, so there is no such thing as an invocation without one. The qualifier is just implicit by the graceof 'import', but it's explicit in the JVM regardless.

To be consistent with Java terminology, use the term "simple method invocation", which is not official but at least it's explicable.

>
> context sentence
> .------------------. .------------.
> java.lang.Thread . dumpStack()
> java.lang.System.out . print ( 2 )
> '-------'
> verb
> '------------------------------'
> not a verb, because of dots
> '-----------------------------------'
> not a sentence, because of dots
>
> Ok, »context« /is/ a standard JLS term, but »verb« is less


"Context" in the JLS has several meanings, all identical to the standard English usage, not a technical context:
<http://docs.oracle.com/javase/specs/jls/se7/html/jls-6.html#jls-6.5.1>
Here are a few of them:

- In a package declaration (§7.4)
- To the left of the "." in a qualified PackageName
- In a single-type-import declaration
- To the left of the "." in a single-static-import declaration
- To the left of the "<" in a parameterized type
- In an explicit type argument list in a method or constructor invocation
- As a PostfixExpression
- Before the "(" in a method invocation expression
- To the left of the "=" sign in an annotation's element value pair

and many more. Your attempt to reduce "context" to one specific construct amongst this plethora is at variance with Java's terminology.

> so (although sometimes used in OOP, IIRC), and »sentence«
> was invented by me, but seems natural, once one accepts »verb«.
>
> However, if there are already standard Java terms for this,
> I'd gladly use them.


Quite frankly I'm surprised that you aren't already using the terms definedin the JLS where they exist, and following their pattern when they don't. I'm especially surprised that you'd use terms differently from how they do ("context"). I strongly suggest that you use the terminology from the JLS.

--
Lew

markspace 04-20-2012 03:01 AM

Re: terminology
 
On 4/19/2012 5:17 PM, Lew wrote:

> Stefan Ram wrote:
>> java.lang.Thread . dumpStack() java.lang.System.out . print( 2
>> )
>>
>> I do call the source code part in front of the last dot a
>> /context/.


>
> Fully-qualified type name.
> <http://docs.oracle.com/javase/specs/jls/se7/html/jls-6.html#jls-6.5.5.2>



I'd have said the same off the top of my head. I'd also call it a
"class" if FQN was a bit long, or I was being less strict in my speaking.

>
>> I do call the simple name between the last dot and the first
>> parentheses a /verb/. (So a verb does never contain a dot.)

>
> Simple method name.
> <http://docs.oracle.com/javase/specs/jls/se7/html/jls-6.html#jls-6.5.7.1>



"Method" or "method invocation" works for me.


>> (I do /not/ call this »method name«, since I want to exclude texts
>> with dots, like »>java.lang.Thread.dumpStack«, which are also
>> method names in Java AFAIK.)

>
> Qualified method name.
> <http://docs.oracle.com/javase/specs/jls/se7/html/jls-6.html#jls-6.5.7.2>



Or identifier, or "method name," imo.


>> I do call the simple call after the last dot up to the last
>> parentheses a /sentence/.

>
> Method invocation expression, except that includes the qualifier.
> There is no standard term for what you call a "sentence", nor would
> most Java programs have the faintest clue what you mean by that
> word.
> <http://docs.oracle.com/javase/specs/jls/se7/html/jls-15.html#jls-15.12>



Also "statement" if there's a ; at the end, I think.


>
>> (I do /not/ call this »[method ]call«, since the whole lines
>> including the dots are also called »[method ]calls« or »[method
>> ]invocations« in Java.)

>
> There's always a qualifier in a method invocation, so there is no
> such thing as an invocation without one. The qualifier is just
> implicit by the grace of 'import', but it's explicit in the JVM
> regardless.



I'm not sure. If you're invoking a method that is a member of an
enclosing class or type, you don't need to qualify it. "wait()",
"notify()", etc. never need to be qualified if "this" is the qualifier.

As for "the whole line is an invocation," this is a statement with two
invocations:

double d = Math.sin(1.0) + Math.cos(1.0);

I don't think the "whole line" can be an invocations, it's just that you
happen to have a method call, expression, and statement that are all the
same thing in that one particular example. That won't always be true.

Stefan Ram 04-20-2012 04:40 AM

Re: terminology
 
markspace <-@.> writes:
>On 4/19/2012 5:17 PM, Lew wrote:
>>Stefan Ram wrote:
>>>java.lang.Thread . dumpStack() java.lang.System.out . print( 2 )
>>>I do call the source code part in front of the last dot a
>>>/context/.

>>Fully-qualified type name.

>I'd have said the same off the top of my head. I'd also call it a
>"class" if FQN was a bit long, or I was being less strict in my speaking.


A »type name« is a special kind of context, it is a static context.
My usage does not come from the JLS, but from javac who says things like:

Main.java:7: error: non-static method length() cannot be referenced from a static context
String.length();
^
1 error

When you teach java, explaining vocabulary of javac can't be
that wrong, even if it's not as authoritative as the JLS.
Obviously, the »static context« above is »String«.

I cannot call this »type name«, since the part in front of
the last dot is not always a type name, as in

java.lang.System.out . println()

. »java.lang.System.out« is the context of »println()«
(in my terms), but it is not a type name.

I already gave this example in my OP, but it got lost
somewhere. The javac compiler seems to call this a
non-static context (by analogy from the above message).

>>>I do call the simple name between the last dot and the first
>>>parentheses a /verb/. (So a verb does never contain a dot.)

>>Simple method name.
>><http://docs.oracle.com/javase/specs/jls/se7/html/jls-6.html#jls-6.5.7.1>

>"Method" or "method invocation" works for me.


Obviously, these are all different things: A method is not
a method name, and a method is not a method invocation.

Some, albeit slight, justification of my term »verb« comes
from the JLS 7, which says in 6.1:

"Method names should be verbs".


Arved Sandstrom 04-20-2012 10:09 AM

Re: terminology
 
On 12-04-20 01:40 AM, Stefan Ram wrote:
[ SNIP ]

> Obviously, these are all different things: A method is not
> a method name, and a method is not a method invocation.
>
> Some, albeit slight, justification of my term »verb« comes
> from the JLS 7, which says in 6.1:
>
> "Method names should be verbs".
>


It occurs to me that you'd like J, at least for the terminology. All
sentences in J are composed of verbs and nouns and copulas and adverbs
and conjunctions.

AHS
--
A fly was very close to being called a "land," cause that's what they do
half the time.
-- Mitch Hedberg

Lew 04-20-2012 03:05 PM

Re: terminology
 
On 04/19/2012 09:40 PM, Stefan Ram wrote:
> markspace<-@.> writes:
>>>> java.lang.Thread . dumpStack() java.lang.System.out . print( 2 )
>>>> I do call the source code part in front of the last dot a
>>>> /context/.
>>> Fully-qualified type name.

>> I'd have said the same off the top of my head. I'd also call it a
>> "class" if FQN was a bit long, or I was being less strict in my speaking.

>
> A »type name« is a special kind of context, it is a static context.
> My usage does not come from the JLS, but from javac who says things like:
>
> Main.java:7: error: non-static method length() cannot be referenced from a static context
> String.length();
> ^
> 1 error
>
> When you teach java [sic], explaining vocabulary of javac can't be
> that wrong, even if it's not as authoritative as the JLS.
> Obviously, the »static context« above is »String«.


No. 'String' is the (simple) type name. The static context is the semantic
space to the right of the dot.

> I cannot call this »type name«, since the part in front of
> the last dot is not always a type name, as in
>
> java.lang.System.out . println()
>
> . »java.lang.System.out« is the context of »println()«
> (in my terms), but it is not a type name.


"Context" is a general term, and the javac output is using it exactly as the
JLS does. Static contexts occur other than by a type name, e.g.,:

public class Foo
{
static
{ // static context
}
}

There is nothing wrong with using these terms as the JLS does.

When you teach Java, the vocabulary of the JLS can't be wrong. (Well, there
are questionable items in there, but that's another matter.) Trying to go
against it, especially diametrically, can be.

More subtly, you misidentified the static context in the 'String' call to
'length()'. "Context" is used in its ordinary, English sense in the JLS, and
in the concomitant "javac" output. It means, in that example, that at the
point of evaluation of the method name, that is, to the right of the dot, the
semantic environment is that of the type specified by the type name to the
left of the dot. By the rules of Java, since it's a type name and not an
instance name, the context is static. Likewise in a static initializer, to
between the braces is a static context. "Context" means the environment or
ontological background - are we looking at the world from the class-wide
(static) view or the instance view?

I aver that you're going about this backwards, thus impeding understanding of
Java. Instead of trying to map your terms to what exists in Java, start with
the Java terminology and grok what they really mean. Then, if you still really
feel the need, come up with synonyms, rather than shoehorning alien concepts
into the Java space.

--
Lew
Honi soit qui mal y pense.
http://upload.wikimedia.org/wikipedi.../c/cf/Friz.jpg

markspace 04-20-2012 06:03 PM

Re: terminology
 
On 4/19/2012 9:40 PM, Stefan Ram (quoting a bunch of people):
>>>> I do call the simple name between the last dot and the first
>>>> parentheses a /verb/. (So a verb does never contain a dot.)
>>> Simple method name.
>>> <http://docs.oracle.com/javase/specs/jls/se7/html/jls-6.html#jls-6.5.7.1>

>> "Method" or "method invocation" works for me.

>
> Obviously, these are all different things: A method is not
> a method name, and a method is not a method invocation.



Right. It's "method" or "method name" if you mean just the method, and
"invocation" if you're referring to the act of making the call. Since
some different concepts were being tossed around, I gave both answers.




Stefan Ram 04-21-2012 04:27 AM

"static context" (was: terminology)
 
ram@zedat.fu-berlin.de (Stefan Ram) writes:
>>>>java.lang.Thread . dumpStack() java.lang.System.out . print( 2 )

>A »type name« is a special kind of context, it is a static context.


JLS 7 defines »static context« in 8.1.3, but the compiler
uses another meaning of »static context«.

For example, the call »dumpStack()« in

class A { void m(){ java.lang.Thread.dumpStack(); }}

is /not/ in a static context according to JLS 7 8.1.3,
but /is/ according to javac.

One reason for this possibly is that JLS 1 did not yet
define »static context«, so the wording of the compiler
message might predate the first definition of »static
context« in the JLS.


Lew 04-21-2012 11:15 AM

Re: "static context"
 
On 04/20/2012 09:27 PM, Stefan Ram wrote:
> ram@zedat.fu-berlin.de (Stefan Ram) writes:
>>>>> java.lang.Thread . dumpStack() java.lang.System.out . print( 2 )

>> A »type name« is a special kind of context, it is a static context.

>
> JLS 7 defines »static context« in 8.1.3, but the compiler
> uses another meaning of »static context«.
>
> For example, the call »dumpStack()« in
>
> class A { void m(){ java.lang.Thread.dumpStack(); }}
>
> is /not/ in a static context according to JLS 7 8.1.3,


Incorrect. The statement 'Thread.dumpStack();' is not in a static context. The
simple method name 'dumpStack()' is.

I see in
<http://docs.oracle.com/javase/specs/jls/se7/html/jls-8.html#jls-8.1.3>
that is says,
"A statement or expression occurs in a static context if and only if the
innermost method, constructor, instance initializer, static initializer, field
initializer, or explicit constructor invocation statement enclosing the
statement or expression is a static method, a static initializer, the variable
initializer of a static variable, or an explicit constructor invocation
statement (§8.8.7)."

There are two contexts operating here. 'dumpStack()' occurs in a static
context established by the symbol 'Thread' and the dot. The entire expression,
or statement, 'Thread.dumpStack();'[*] occurs in a non-static context
established by the opening curly brace of the instance method definition.

> but /is/ according to javac.
>
> One reason for this possibly is that JLS 1 did not yet
> define »static context«, so the wording of the compiler
> message might predate the first definition of »static
> context« in the JLS.

[*] Why the heck do you insist on calling out 'java.lang'? It's highly
unconventional and not at all idiomatic for Java.

--
Lew
Honi soit qui mal y pense.
http://upload.wikimedia.org/wikipedi.../c/cf/Friz.jpg

Jan Burse 04-21-2012 09:50 PM

Re: terminology
 
Stefan Ram schrieb:
> context sentence
> .------------------. .------------.
> java.lang.Thread . dumpStack()
> java.lang.System.out . print ( 2 )
> '-------'
> verb
> '------------------------------'
> not a verb, because of dots
> '-----------------------------------'
> not a sentence, because of dots


Hi,

If you are up at applying linguistic
categories to parts of Java programs,
then the most successful approach would be:

+---------------- Sentence ----------------+
| |
java.lang.System.out . print ( 2 )
| | | |
+---- Subject -------+- Verb ---+- Object -+

This would make an English speaking person
very much at home, since English is typicall
a SVO language. A German speaking person can
less relate to this pattern, since his languages
is judged a SOV language.

But libraries and applications,
the classes and methods they defined, the
names that are used, need not match the
categories of some known natural languages.
Natural language verbs might have implicit
arguments which need to be made explicit
in code, which goes beyond a "this".

Nevertheless the SOV view of a code can
be very useful for problem analysis.
Especially on a higher level. This
is best viewed by the CRC method.

The classes are the subjects/actors you name
it. The resposibilities are the verbs/
steps you name it. The collaborators are
some objects/other actors you name it. CRC
cards can be elicidated by a simple role play:

- Take a group of people that are about
to execute a sequential use case and a
ball. Give the ball to the first member of
the group.

- The member of the group who has the ball
should say his role and what step he is
performing, and hand the ball to an
appropriate next member of the group.

- Write a prose flow chart of the session,
this is your use case. Let the members of
the group take notes of their steps and
collaborates, this is the component design.

I had once an idea to elaborate concurrent
interaction protocols by using multiple
balls, but had never the chance to do this
in real life. Maybe would end in
battle ball...

http://en.wikipedia.org/wiki/Subject...E2%80%93object

http://en.wikipedia.org/wiki/Class-r...aboration_card


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

Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57