[nbusers] Re: extract method

  • From: Benno Markiewicz < >
  • To:
  • Subject: [nbusers] Re: extract method
  • Date: Sat, 5 Jan 2013 19:41:01 +0100

Cool. I was not aware that idea does it because the usecase IMHO is rare.

Please change the issue type of the existing one to enhancement. Attach a before-after-screenshot how it works in idea and please put me on the CC list. Thank you.

Greetings markiewb

Am 05.01.2013 19:31 schrieb "netbeans enthusiast" < "> >:
I definitely did it all the time in Intellij and that's where I get my sense of what this refactoring is.  I just loaded up Intellij again to make sure I am right about it working there. OK well that pretty well explains it, totally cool, so thanks Benno. I have already filed a bug; should I also file an RFE or will the bug get kicked over to the RFE bin automatically?



On Sat, Jan 5, 2013 at 1:26 PM, Benno Markiewicz < " target="_blank"> > wrote:

I think there is a misconception. Extracting the innerblocks of an ifelse-term into separate methods is not supported by NB. Neither the other mayor IDEs support it - i think. But feel free to create a new RFE.

Extract Methode by theory is simple. See
http://martinfowler.com/refactoring/catalog/extractMethod.html

Greetings markiewb

Am 05.01.2013 14:29 schrieb "netbeans enthusiast" < " target="_blank"> >:

Extract method is supposed to move the code block you highlight into a new method with the name you choose right? I looked at gJ's blog just to do a  a sanity check to make sure we  all  have  same idea  of what constitutes "extract method" .  On 7.3 beta and now on 7.2, it doesn't work as expected. Has anyone else run into this? Has anyone used it lately.. not sure how popular refactoring is...


I filed a bug report yesterday  but it's just so weird I  want to know if anyone  else is experiencing this. OK in a nutshell, here is what happens.  

original code:
.
.
.
if  (condition)
{
do some huge thing ...blah blah blah for 200  lines
}
else 
{
do some equally huge thing for 200 lines blah blah blah
}
.
.
.

Goal  state after  refactor

if (condition)
 processCondition()
else
processNonCondition();



private void processCondition()
{
do some huge thing ...blah blah blah for 200  lines
}

private void processNonCondition()
{
do some equally huge thing for 200 lines blah blah blah
}


State of file after using NB to highlight statement to be extracted into methods and using extract method functionality

.
.
.
if  (condition)
{
do some huge thing ...blah blah blah for 200  lines
}
else 
{
do some equally huge thing for 200 lines blah blah blah
}
.
.
.
private void processCondition()
{
  processCondition();
}

private void processNonCondition()
{
 processNonCondition();
}



Pretty much that's all I know. Like I say it happened in 7.3 beta and when I revert, it's now happening in 7.2 .

The thing is , I would have noticed this before now if this bug was in the original download , certainly in the case of 7.2 which I have used for a good long while and almost as certainly with 7.3 which I have used exclusively for a long time also. 

This gets me to thinking  that its somehow a regression that got automatically downloaded when automatically NB updated itself (updates available...) after it was already installed on  my machine. It's the only explanation that makes any sense to me. 





[nbusers] extract method

netbeans enthusiast 01/05/2013

[nbusers] Re: extract method

Benno Markiewicz 01/05/2013

[nbusers] Re: extract method

netbeans enthusiast 01/05/2013

[nbusers] Re: extract method

Benno Markiewicz 01/05/2013

[nbusers] Re: extract method

netbeans enthusiast 01/05/2013

[nbusers] Re: extract method

Benno Markiewicz 01/05/2013

[nbusers] Re: extract method

netbeans enthusiast 01/05/2013

[nbusers] Re: extract method

Benno Markiewicz 01/05/2013

[nbusers] Re: extract method

netbeans enthusiast 01/05/2013

Project Features

About this Project

www was started in November 2009, is owned by jpirek, and has 21 members.
By use of this website, you agree to the NetBeans Policies and Terms of Use (revision 20131025.e7cbc9d). © 2013, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo
 
 
Close
loading
Please Confirm
Close