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

  • SEARCH
  • Home
  • 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 6173411
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T23:34:06+00:00 2026-05-23T23:34:06+00:00

I have a class called Page in my program. It has 10 attributes, but

  • 0

I have a class called Page in my program. It has 10 attributes, but at certain point, only 3 attributes are needed (RawPage) and in other point, all or almost all atributes are needed (ProcessedPage).

Is better I have only only one class with all attributes or split these class into two classes, one for every need?

EDIT: the processed atributes are new attributes in the Page, and not overwrites none.

  • 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-23T23:34:08+00:00Added an answer on May 23, 2026 at 11:34 pm

    I suspect someone will suggest using inheritance here, but I won’t… it sounds like you logically create a “processed page” from a “raw page” (via processing) – so why not model it exactly like that?

    class ProcessedPage
    {
        private final RawPage source;
    
        // Other stuff - the results of the processing
    }
    
    class RawPage
    {
        // The data you need here
    
        public ProcessedPage process(...)
    }
    

    When a class has information which is only sometimes valid / needed / relevant, it ends up being quite tricky to work with, especially as the system grows in size. With a more explicit model, you do potentially end up with some duplication, but your classes end up with a better defined purpose in life, rather than suffering from multiple personality disorder.

    Note that I haven’t made ProcessedPage a subclass of RawPage – because I don’t imagine you’d normally want to treat a ProcessedPage as a RawPage, potentially reprocessing it. You may want to have a common interface that they both implement which doesn’t include the process method, of course, but that’s slightly different.

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

Sidebar

Related Questions

I have a class named Page with a private property currently called _pageData which
I have a class that inherits from Page, called APage. public abstract class APage:
I am writing a program to find adapters, and have made a class called
I have created a class called BasePage which inherits System.Web.UI.Page. On this page I've
I have a page with a number of links with a class called myLinkClass.
I have a class called imageResizing. It has a member, MAX_WIDTH_ORIGINAL_IMG which is defined
I have a aspx page that, when loading, will initialize a class called, Bill
I have a project which has Area called Admin. There is a class called
Within a Web Service CarService, I have a class called Car. Car has a
I have a class called EventConsumer which defines an event EventConsumed and a method

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.