![]() |
Java return intellityping?
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. |
Re: Java return intellityping?
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/ja...nv-138413.html -- Lew |
Re: Java return intellityping?
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. |
Re: Java return intellityping?
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/ |
Re: Java return intellityping?
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 |
Re: Java return intellityping?
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. |
Re: Java return intellityping?
....
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. |
Re: Java return intellityping?
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 |
Re: Java return intellityping?
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. |
Re: Java return intellityping?
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. |
| All times are GMT. The time now is 03:13 AM. |
Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.