[nbusers] Re: extract method

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

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" < "> >:
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 20140418.2d69abc). © 2013, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo
 
 
Close
loading
Please Confirm
Close