March 18, 2010
Using Spring Security to enforce authentication and authorization on Spring Remoting Services Invoked from a Java SE client.... Spring framework is one of the biggest and the most comprehensive frameworks Java Community can utilize to cover most of the end to end requirement of a software system when it come to implementation.
Spring Security and Spring Remoting are ...
More »
March 18, 2010
TDD/BDD/ATDD Workshop in Melbourne in April. The Testing and TDD for Java Developers workshop is coming to Melbourne again on April 15-16.
In my experience (and that of many others), when done well, agile developer testing practices can have a huge and lasting impact on higher code quality, bet...
More »
March/2010
| Sun | Mon | Tue | Wed | Thu | Fri | Sat |
| | 1 |
2 |
3 |
4 | 5 | 6 | | 7 | 8 | 9 |
10 | 11 |
12 |
13 | | 14 |
15 |
16 |
17 | 18 | 19 |
20 | | 21 | 22 | 23 | 24 | 25 | 26 | 27 | | 28 | 29 | 30 | 31 | | | |
|
 |
home > news >
developers >
ruby screenshot of the week #23: extract method and more refactorings!
Ruby Screenshot of the Week #23: Extract Method and More Refactorings!
Last week I promised to catch up on my e-mail, but I had been missing feature work too much during the bug phase so I put it off for a week... to implement some more quickfix refactorings:
Extract Method
Introduce Variable
Introduce Constant
Here's how it works. Let's start with "Extract Method". You're looking at some code like this:
You decide there's too much going on in this method, and you want to pull the middle section into
its own method. Select it, and notice the lightbulb which shows up on the left:
Press Alt-Enter to show the quick fix alternatives:
Select Extract Method, and the IDE will pop up a dialog asking you for the name of the new method you want to extract from the selected code fragment:
Press OK (or just hit Enter), and the code will mutate into the following:
There's a lot to notice here. First, there's a new method, and the active selection and caret is on a comment for that method (so you can just type to replace it). The new method is added below the one you extracted code from. And the most important part about this refactoring is that the IDE figures out which variables to pass in to the method, and which variables to pass back out:
a, b and d are accessed from within the fragment, so they are passed in.
c is reassigned in the fragment without reading the previous value, so
doesn't need to be passed in.
f and h are assigned locally inside the extracted fragment, but...
Date: November, 12 2007
Url: http://blogs.sun.com/tor/entry/extract_method_introduce_variable_introduce
Others News
Leave a Reply
Related
- Ruby Screenshot of the Week #26: Ruby 1.9 Changes - hashes and case ... Ruby 1.9 has been released. It's a ... April 11, 2009. Boot Environments in the OpenSolaris OS: Versatility Exemplified.
- Pokemon Ruby and Sapphire GBA Game Index Page - GamersHell.com ... use their flippers to hit the targets on the Ruby ... Pokemon Ruby and Sapphire Screenshots (8) ... Updated this Week Updated this Year None of the Above
- Ruby Screenshot of the Week #5 Tim Bray just posted an entry on his first experiments with the Ruby and NetBeans support and in particular, talks about the syntax highlighting. I was already planning on spending ...
- NetBeans Screenshot of the Week #39: Ruby Code Coverage, Python Code ... Here's a new feature for NetBeans 7.0: Code Coverage support!
- Learn Ruby on Rails from Scratch: Week 2 - Nettuts+ Welcome to Ruby on Rails From Scratch Week 2. Hopefully this sequel to week 1 will help to further ... To satisfy my curiosity, What is the text editor in those screenshot? Thanks
- Pablotron: A Good Week for Gadgets ... Screenshots:: Gallery:: Links ... FAM-Ruby Freshmeat-Ruby FT2-Ruby Honeypot-PHP Imlib2-Ruby ... playing Rainbow Six a lot. So yeah, this is a great week ...
- Ruby Screenshot of the Week #30: New YAML Editor As part of our Ruby and Rails support, we've had a YAML editor in NetBeans for a couple of releases now. However, the support was primitive. Only the most basic editing features ...
- IT Influentials Clustering Engine All results (200) Ruby Screenshot of the Week (59)
- Tor Norbye's Weblog Friday May 18, 2007 Ruby Screenshot of the Week #11: Rails Debugging. First the screenshot - click for full resolution: The NetBeans Ruby support now lets you debug Rails ...
- Sam Ruby: Porting REXML to Ruby 1.9 Tor Norbye: Ruby Screenshot of the Week #26: Ruby 1.9 Changes - hashes and case statements. Ruby 1.9 has been released . It’s a “development” version meaning that you wouldn ...
- Ruby Agenda Screenshots Ruby Agenda Screenshots These are two screenshots taken from Ruby Agenda v0.7 on my iPAQ. ... v0.9-pre1) The Week view, that (for now?) can start on any day of the ...
- Ruby Screenshot of the Week #4 If you try code completion on any complicated arbitrary expression, it will show you a number of possible method completions along with the corresponding class. This gives you much ...
- Tor Norbye's Weblog Monday October 08, 2007 Ruby Screenshot of the Week #20: Purdy Colors! A lot of people have asked for a "dark color theme" for NetBeans, possibly because there are several ...
- Ruby Lane: Antiques & Art, Vintage Collectibles, Jewelry: Sat, April ... Stroll down Ruby Lane to find quality Antique, Collectible, Fine Art, Jewelry and Vintage ... Category Overview | New Shops | Featured Shops | Today's Arrivals | This Week's ...
- Ruby Screenshot of the Week #34: Detecting Duplicates Hash Keys You didn't think we had forgotten Ruby, did you? Here's a new Ruby editor feature: Detecting duplicate hashkeys. As Fjan (who filed the request) says, when some Rails calls allow ...
|