Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8064589
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T11:24:55+00:00 2026-06-05T11:24:55+00:00

What are the disadvantages of using a block to define a private method within

  • 0

What are the disadvantages of using a block to define a private method within a method, instead of using a real private method? Is there any apart from not being able to call the method from somewhere else?

Example:

-(NSDictionary*)serialize
{   
    NSMutableDictionary* serialization = [NSMutableDictionary dictionary];

    TwoArgumentsBlockType serializeItemBlock = ^void(MyItemClass* item, NSString* identifier)
    {       
        if (item)
        {
            // serialization code
        }
    };

    serializeItemBlock(self.someItem1, kSomeIdentifier1);
    serializeItemBlock(self.someItem2, kSomeIdentifier2);
    serializeItemBlock(self.someItem3, kSomeIdentifier3);
    serializeItemBlock(self.someItem4, kSomeIdentifier4);
    serializeItemBlock(self.someItem5, kSomeIdentifier5);
    serializeItemBlock(self.someItem6, kSomeIdentifier6);
    serializeItemBlock(self.someItem7, kSomeIdentifier7);
    serializeItemBlock(self.someItem8, kSomeIdentifier8);
    serializeItemBlock(self.someItem9, kSomeIdentifier9);
    serializeItemBlock(self.someItem10, kSomeIdentifier10);
    serializeItemBlock(self.someItem11, kSomeIdentifier11);

    return serialization;
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T11:24:56+00:00Added an answer on June 5, 2026 at 11:24 am

    Clarity of the code is important.

    Methods allow you to encapsulate entire sections of code apart from each other, and can make it easier to read..

    Another reason to choose private methods over blocks is memory management. This is far to big of a topic to discuss here, but sufficed to say that blocks are weird in the memory management, and don’t act like any other code structure in that regard.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Are there any advantages or disadvantages to using multiple assignment in a statement? In
What would be the disadvantages of using the builder design pattern. Are there any??
Are there any advantages and/or disadvantages to using either JCache (JSR 107) or the
Are there any drawbacks / disadvantages using the default constructor for default initialization for
I'm using Zend and want to know if there's any disadvantages to using it
I was wondering - is there any disadvantages in using the hash of something
Are there disadvantages of using XML, instead of RDMS? The reason I ask this
What are the advantages and disadvantages of using Interlocked winapi functions instead of any
I wanted to know if anyone thought if there where any disadvantages to using
Are there any disadvantages to using word-wrap:break-word in the following way? body { word-wrap:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.