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


Groups > comp.lang.java.programmer > #21685

Re: ctrl-c ctril-v

Newsgroups comp.lang.java.programmer
Date 2013-01-24 18:59 -0800
References <1q92g8hfr69f0422pq5r81cqqlpfngkotj@4ax.com> <ydnobge12px.fsf@shell.xmission.com> <89bbdac8-688c-4fbb-98ec-a1ae8ab25770@googlegroups.com> <ydnk3r20yc2.fsf@shell.xmission.com>
Message-ID <7a1c356f-e9d7-4a2a-a4ec-836d55d9acda@googlegroups.com> (permalink)
Subject Re: ctrl-c ctril-v
From Lew <lewbloch@gmail.com>

Show all headers | View raw


Jim Janney wrote:
> Lew writes:
>> Jim Janney wrote:
>>> This is a good thing.  Programmers should not copy/paste on a regular
>>> basis.
> 
>> Ridiculous assertion.
> 
> I wan't entirely serious when I wrote that.  However...
> 
> Any time I find myself faced with a lot of similar code, I do start
> looking for ways to abstract out the similarities, in whatever language
> I happen to be working in.  Java is particularly rich in ways to
> accomplish this.  And for really trivial boilerplate code, any good
> programming editor should provide ways to generate that that are both
> more flexible and less error-prone than simple copy/paste.  Again,
> Eclipse is particularly rich in ways to accomplish this.
> 
> I stand by my ridiculous assertion :-)

It's too broad.

Let's say I have a method name 'loadResourceFromBlarg()' and I'm programming with 
Eclipse or NetBeans or one of those editors. Now I could use Ctrl-space to get code 
completion, but if there are a number of 'loadResourceFromXxx()' methods, the completion 
list might take time. If there are many calls to the method of choice, I'll likely copy the 
method name once into the clipboard and repeatedly paste it.

Let's say I'm importing static a bunch of members from a utility class.

import static junit.framework.Assert.assertEquals
import static junit.framework.Assert.assertNotNull;
import static junit.framework.Assert.assertNotSame;
import static junit.framework.Assert.assertTrue;

It's much faster to copy "import static junit.framework.Assert.assert", repeatedly paste it 
and just type the part that varies.

This type of thing comes up a *lot*, so I copy and paste on a regular and frequent 
basis. This has nothing to do with the refactoring of which you spoke.

You're assertion was ridiculous because it banned legitimate uses of copy-paste.

-- 
Lew

Back to comp.lang.java.programmer | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

ctrl-c ctril-v Roedy Green <see_website@mindprod.com.invalid> - 2013-01-24 04:23 -0800
  Re: ctrl-c ctril-v Andreas Leitgeb <avl@gamma.logic.tuwien.ac.at> - 2013-01-24 13:02 +0000
  Re: ctrl-c ctril-v Arne Vajhøj <arne@vajhoej.dk> - 2013-01-24 09:23 -0500
  Re: ctrl-c ctril-v Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2013-01-24 08:16 -0800
    Re: ctrl-c ctril-v Arved Sandstrom <asandstrom2@eastlink.ca> - 2013-01-24 15:20 -0400
      Re: ctrl-c ctril-v Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2013-01-24 14:11 -0800
  Re: ctrl-c ctril-v bob smith <bob@coolfone.comze.com> - 2013-01-24 08:28 -0800
  Re: ctrl-c ctril-v "John B. Matthews" <nospam@nospam.invalid> - 2013-01-24 12:10 -0500
  Re: ctrl-c ctril-v Jim Janney <jjanney@shell.xmission.com> - 2013-01-24 18:16 -0700
    Re: ctrl-c ctril-v Lew <lewbloch@gmail.com> - 2013-01-24 17:18 -0800
      Re: ctrl-c ctril-v Jim Janney <jjanney@shell.xmission.com> - 2013-01-24 19:51 -0700
        Re: ctrl-c ctril-v Lew <lewbloch@gmail.com> - 2013-01-24 18:59 -0800
        Re: ctrl-c ctril-v Arne Vajhøj <arne@vajhoej.dk> - 2013-01-24 22:56 -0500
    Re: ctrl-c ctril-v Roedy Green <see_website@mindprod.com.invalid> - 2013-01-25 08:56 -0800
      Re: ctrl-c ctril-v Jim Janney <jjanney@shell.xmission.com> - 2013-01-25 11:29 -0700

csiph-web