Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #19585 > unrolled thread

Java return intellityping?

Started bybob smith <bob@coolfone.comze.com>
First post2012-11-01 10:39 -0700
Last post2012-11-05 23:52 +0100
Articles 12 — 7 participants

Back to article view | Back to comp.lang.java.programmer


Contents

  Java return intellityping? bob smith <bob@coolfone.comze.com> - 2012-11-01 10:39 -0700
    Re: Java return intellityping? Lew <lewbloch@gmail.com> - 2012-11-01 11:14 -0700
    Re: Java return intellityping? Andreas Leitgeb <avl@gamma.logic.tuwien.ac.at> - 2012-11-01 19:07 +0000
    Re: Java return intellityping? Robert Klemme <shortcutter@googlemail.com> - 2012-11-01 23:33 +0100
    Re: Java return intellityping? Jim Janney <jjanney@shell.xmission.com> - 2012-11-02 08:49 -0600
    Re: Java return intellityping? Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2012-11-02 09:17 -0700
    Re: Java return intellityping? Daniele Futtorovic <da.futt.news@laposte-dot-net.invalid> - 2012-11-02 23:00 +0100
      Re: Java return intellityping? Lew <lewbloch@gmail.com> - 2012-11-03 11:58 -0700
        Re: Java return intellityping? Daniele Futtorovic <da.futt.news@laposte-dot-net.invalid> - 2012-11-04 17:39 +0100
          Re: Java return intellityping? Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2012-11-04 09:47 -0800
            Re: Java return intellityping? Robert Klemme <shortcutter@googlemail.com> - 2012-11-05 08:07 +0100
            Re: Java return intellityping? Daniele Futtorovic <da.futt.news@laposte-dot-net.invalid> - 2012-11-05 23:52 +0100

#19585 — Java return intellityping?

Frombob smith <bob@coolfone.comze.com>
Date2012-11-01 10:39 -0700
SubjectJava return intellityping?
Message-ID<4c12f491-2b3f-421b-b420-60d4220237d1@googlegroups.com>
You know how there are all kinds of typing shortcuts nowadays?

Let's say there's code like this:

m_socket.getOutputStream();

Is there some general way to get your editor (i.e. Eclipse) to create a variable of the correct type and assign it like so:

OutputStream outputStream = m_socket.getOutputStream();

I feel like this could save a lot of work.

[toc] | [next] | [standalone]


#19586

FromLew <lewbloch@gmail.com>
Date2012-11-01 11:14 -0700
Message-ID<ddb5a116-e208-4298-a1c1-b53d0ba2073c@googlegroups.com>
In reply to#19585
bob smith wrote:
> You know how there are all kinds of typing shortcuts nowadays?
> 
> Let's say there's code like this:
> 
> m_socket.getOutputStream();

You should not violate the Java Coding Conventions like this.

> Is there some general way to get your editor (i.e. Eclipse) to create a variable of the correct type and

"General" and "i.e." are not consistent.

It looks like Eclipse Preferences / Java / Editor / Templates is the way to go. 
Check your Eclipse documentation.

> assign it like so:
> OutputStream outputStream = m_socket.getOutputStream();
> 
> I feel like this could save a lot of work.

http://www.oracle.com/technetwork/java/codeconv-138413.html

-- 
Lew

[toc] | [prev] | [next] | [standalone]


#19587

FromAndreas Leitgeb <avl@gamma.logic.tuwien.ac.at>
Date2012-11-01 19:07 +0000
Message-ID<slrnk95i31.u9l.avl@gamma.logic.tuwien.ac.at>
In reply to#19585
bob smith <bob@coolfone.comze.com> wrote:
> You know how there are all kinds of typing shortcuts nowadays?
> Let's say there's code like this:
> m_socket.getOutputStream();
> Is there some general way to get your editor (i.e. Eclipse) to create a variable of the correct type and assign it like so:
> OutputStream outputStream = m_socket.getOutputStream();
> I feel like this could save a lot of work.

When I need this, I type some bogus type and the intended varname like this:
   Foo outputStream = m_socket.getOutputStream();

Then, eclipse marks it as an error, and among the "Quick-fixes" there's one that
changes my bogus Foo to the actual return-type of the expression.

hth.

[toc] | [prev] | [next] | [standalone]


#19588

FromRobert Klemme <shortcutter@googlemail.com>
Date2012-11-01 23:33 +0100
Message-ID<afgbm4F7omfU1@mid.individual.net>
In reply to#19585
On 01.11.2012 18:39, bob smith wrote:
> You know how there are all kinds of typing shortcuts nowadays?
>
> Let's say there's code like this:
>
> m_socket.getOutputStream();
>
> Is there some general way to get your editor (i.e. Eclipse) to create
> a variable of the correct type and assign it like so:

Yes.  Mark the code.  Then Refactor -> Extract local variable (Alt-Shift-L).

Cheers

	robert


-- 
remember.guy do |as, often| as.you_can - without end
http://blog.rubybestpractices.com/

[toc] | [prev] | [next] | [standalone]


#19600

FromJim Janney <jjanney@shell.xmission.com>
Date2012-11-02 08:49 -0600
Message-ID<ydnbofg5aci.fsf@shell.xmission.com>
In reply to#19585
bob smith <bob@coolfone.comze.com> writes:

> You know how there are all kinds of typing shortcuts nowadays?
>
> Let's say there's code like this:
>
> m_socket.getOutputStream();
>
> Is there some general way to get your editor (i.e. Eclipse) to create a variable of the correct type and assign it like so:
>
> OutputStream outputStream = m_socket.getOutputStream();
>
> I feel like this could save a lot of work.

In Eclipse, use Quick Assist - Assign to local variable

Usually bound to Ctrl+2, L

-- 
Jim Janney

[toc] | [prev] | [next] | [standalone]


#19601

FromDaniel Pitts <newsgroup.nospam@virtualinfinity.net>
Date2012-11-02 09:17 -0700
Message-ID<FmSks.17744$2Q3.5880@newsfe25.iad>
In reply to#19585
On 11/1/12 10:39 AM, bob smith wrote:
> You know how there are all kinds of typing shortcuts nowadays?
>
> Let's say there's code like this:
>
> m_socket.getOutputStream();
>
> Is there some general way to get your editor (i.e. Eclipse) to create a variable of the correct type and assign it like so:
>
> OutputStream outputStream = m_socket.getOutputStream();
>
> I feel like this could save a lot of work.
>
In IntelliJ IDEA, you use "introduce variable" (command-ctrl-v), and it 
will do exactly that.

I wouldn't be surprised if Eclipse had an equivalent hot-key.

[toc] | [prev] | [next] | [standalone]


#19602

FromDaniele Futtorovic <da.futt.news@laposte-dot-net.invalid>
Date2012-11-02 23:00 +0100
Message-ID<k71fp3$72q$1@dont-email.me>
In reply to#19585
...

You'd think with all that typing time saved, it would translate into
more thinking time.

In my depressing experience, it doesn't. Rather, below a certain
threshold, they appear to be congruent.

_Note_: this is not an argument, it's a </rant>

-- 
DF.

[toc] | [prev] | [next] | [standalone]


#19609

FromLew <lewbloch@gmail.com>
Date2012-11-03 11:58 -0700
Message-ID<9c8785cc-fd38-4e23-a7ba-4a3503edc3f5@googlegroups.com>
In reply to#19602
Daniele Futtorovic wrote:
> ...
> You'd think with all that typing time saved, it would translate into
> more thinking time.
> 
> In my depressing experience, it doesn't. Rather, below a certain
> threshold, they appear to be congruent.
> 
> _Note_: this is not an argument, it's a </rant>

Typing team is not exclusive of thinking time.

-- 
Lew

[toc] | [prev] | [next] | [standalone]


#19626

FromDaniele Futtorovic <da.futt.news@laposte-dot-net.invalid>
Date2012-11-04 17:39 +0100
Message-ID<k765o3$4gh$1@dont-email.me>
In reply to#19609
On 03/11/2012 19:58, Lew allegedly wrote:
> Daniele Futtorovic wrote:
>> ...
>> You'd think with all that typing time saved, it would translate into
>> more thinking time.
>>
>> In my depressing experience, it doesn't. Rather, below a certain
>> threshold, they appear to be congruent.
>>
>> _Note_: this is not an argument, it's a </rant>
> 
> Typing time is not exclusive of thinking time.
> 

That's probably the gist of the matter... :)

-- 
DF.

[toc] | [prev] | [next] | [standalone]


#19627

FromDaniel Pitts <newsgroup.nospam@virtualinfinity.net>
Date2012-11-04 09:47 -0800
Message-ID<ySxls.19626$%z6.16472@newsfe04.iad>
In reply to#19626
On 11/4/12 8:39 AM, Daniele Futtorovic wrote:
> On 03/11/2012 19:58, Lew allegedly wrote:
>> Daniele Futtorovic wrote:
>>> ...
>>> You'd think with all that typing time saved, it would translate into
>>> more thinking time.
>>>
>>> In my depressing experience, it doesn't. Rather, below a certain
>>> threshold, they appear to be congruent.
>>>
>>> _Note_: this is not an argument, it's a </rant>
>>
>> Typing time is not exclusive of thinking time.
>>
>
> That's probably the gist of the matter... :)
>
Often, most of my thinking is done before I start typing, whether it be 
to use a shortcut or not. I find that although my available "thinking" 
time may not be increased, the time-to-delivery is improved (decreased) 
because of shortcuts. I can also use my knowledge that there *are* 
short-cuts to allow my to defer thinking and decisions until a later 
time. For example, I may be writing a class which might be better as two 
classes, but it might not be.  I know that I have refactoring tools, so 
I'll start with the easiest to implement, and then consider refactoring 
when it becomes relevant.

[toc] | [prev] | [next] | [standalone]


#19634

FromRobert Klemme <shortcutter@googlemail.com>
Date2012-11-05 08:07 +0100
Message-ID<afp6suF6vskU1@mid.individual.net>
In reply to#19627
On 04.11.2012 18:47, Daniel Pitts wrote:

> Often, most of my thinking is done before I start typing, whether it be
> to use a shortcut or not. I find that although my available "thinking"
> time may not be increased, the time-to-delivery is improved (decreased)
> because of shortcuts. I can also use my knowledge that there *are*
> short-cuts to allow my to defer thinking and decisions until a later
> time. For example, I may be writing a class which might be better as two
> classes, but it might not be.  I know that I have refactoring tools, so
> I'll start with the easiest to implement, and then consider refactoring
> when it becomes relevant.

... which also can lead to the opposite effect: you end up changing the 
same logic so often that time actually increases vs. the variant where 
the absence of refactoring tools led you to do more thinking upfront and 
start coding later.

Kind regards

	robert

-- 
remember.guy do |as, often| as.you_can - without end
http://blog.rubybestpractices.com/

[toc] | [prev] | [next] | [standalone]


#19638

FromDaniele Futtorovic <da.futt.news@laposte-dot-net.invalid>
Date2012-11-05 23:52 +0100
Message-ID<k79g02$hrr$1@dont-email.me>
In reply to#19627
On 04/11/2012 18:47, Daniel Pitts allegedly wrote:
> Often, most of my thinking is done before I start typing, whether it be
> to use a shortcut or not. 

Then you are my superior and I bow to you. As for me, I often find bugs
in the code that were clearly and solely due to my not thinking (enough)
while writing it, and at other times I my find myself in an impasse
because I didn't think ahead enough while coding.

At the same time, it may be due to my approach to designing -- I tend to
do about half of a design deductively (top-down) and the other half
inductively, bottom-up, by coding the thing and seeing whether it feels
natural and just falls into place. If it does, it means the design as a
whole is usually sound.

-- 
DF.

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.java.programmer


csiph-web