• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: VS.NET-style code outlining?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: VS.NET-style code outlining?


  • Subject: Re: VS.NET-style code outlining?
  • From: Erik Hanson <email@hidden>
  • Date: Tue, 24 Feb 2004 13:28:56 -0800

On Feb 24, 2004, at 12:55 PM, Keith Esau wrote:
On 02/24/2004 1:58 PM, "Erik Hanson" <email@hidden> wrote:
If a block of code can be collapsed and replaced with a comment, why
not extract it into its own method? That would not only make the code
easier to read, it would increase the chance of reuse and probably
improve the structure of the code. I'd like to see Xcode development
time spent on extracting the method for me rather than collapsing the
code.

The most common reason is that the block uses variables in the scope of the
enclosing function that are not available elsewhere, but are not changed in
the scope of the block, making the block itself collapsible.

Which sounds like a perfect candidate for extracting a method to me. A refactoring editor will create a new method, pass those variables in for you automatically and return whatever needs to be returned. A really smart refactoring editor will find other places in your code where you have that same block and replace that with the new method too.


In my Java work, I've been using an editor that can both collapse blocks and can extract methods for me. Whenever I've wanted to reduce the complexity of a method, I always choose to extract a block rather than collapse it. To me, it's the difference between reducing complexity and merely hiding it.


-- Erik Hanson _______________________________________________ xcode-users mailing list | email@hidden Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/xcode-users Do not post admin requests to the list. They will be ignored.


References: 
 >Re: VS.NET-style code outlining? (From: Keith Esau <email@hidden>)

  • Prev by Date: Re: LIBRARY_STYLE flag?
  • Next by Date: Re: sourcecode for gdb 309
  • Previous by thread: Re: VS.NET-style code outlining?
  • Next by thread: Intermediate Library Targets
  • Index(es):
    • Date
    • Thread