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 6768171
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T15:02:38+00:00 2026-05-26T15:02:38+00:00

A class is too large and becomes unwieldy to work with. In Objective-C I’d

  • 0

A class is too large and becomes unwieldy to work with. In Objective-C I’d be tempted to use Categories to break the class up, but then: wouldn’t categories just be dividing a house full of too much junk into rooms? The same question applies to partial classes in C#, I suppose.

Under what conditions can categories be used to solve a “class too large” code smell? When is it not correct and the class really needs to “be restructured or broken into smaller classes?”

  • 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-05-26T15:02:38+00:00Added an answer on May 26, 2026 at 3:02 pm

    A very good principle to refer to is the SOLID principle. In particular the "S" stands for "Single responsibility"

    Single responsibility principle

    the notion that an object should have only a single responsibility.

    When classes get too big, it is likely they have too many responsibilities. Can you define two or more responsibilities within the boundaries of what the class is doing? If so, separate it into two, or more, classes. You can then aggregate them back using a façade or composite pattern.

    In other words:

    • the code you have in the class should be split in different classes according to the Single Responsibility principle
    • the original God class becomes a composite or façade: it uses all the new classes, exposes the same methods to the rest of the system, but does not implement any functionality in itself, besides "converting" the old-style god-class calls in the new-style SOLID calls.

    This means that regions do exactly nothing to solve your problem, from an object-oriented point of view. In fact, they are actually counterproductive as they contribute to hiding the problem.

    See also this Jeff Atwood article:

    http://www.codinghorror.com/blog/2008/07/the-problem-with-code-folding.html

    CodingHorror-regions
    (source: typepad.com)

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

Sidebar

Related Questions

mechanize's Browser class is great and it's follow_link() function is great too. But what
I have the problem that my view controller class has too many delegates and
Here's the situation: I've got a class that is doing too much. It's mainly
Is there any cost/drawback (apart from typing too much) to adorning a class with
I have a view controller class that has to implement several protocols. Too keep
I'd like to override the Serialize methods of the ASP.NET JavaScriptSerializer class. Nothing too
Why do I get an int number is too large where the long is
I am trying to write a Java class to extract a large zip file
I often find that attributes can be too large. Sometimes it feels like the
Im having an error that says: Request-URI Too Large Actually I'm trying to add

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.