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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T17:08:44+00:00 2026-06-10T17:08:44+00:00

The Open-Closed Principle states: software entities (classes, modules, functions, etc.) should be open for

  • 0

The Open-Closed Principle states:

software entities (classes, modules, functions, etc.) should be open for extension, but closed for modification

I’m designing a domain right now and including quite a bit of behavior in my domain entities. I’m using domain events and injecting dependencies into methods so make sure my entities aren’t coupled to outside influences. However, it occurrs to me that, if the client wants more functionality later on, I will have to violate OCP and crack open these domain entities to add the features. How can a behavior-rich domain entity live in harmony with the Open-Closed Principle?

  • 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-10T17:08:46+00:00Added an answer on June 10, 2026 at 5:08 pm

    It’s useful to keep the open-closed principle (OCP) in mind when designing classes, but it’s not always practical or desirable to make classes “closed for modification” right away. I think the single responsibility principle (SRP) is much more useful in practice — as long as a class only does one thing, it is okay to modify it if the requirements for that one thing change.

    Moreover, SRP leads to OCP over time; if you find yourself changing a class often, you would eventually refactor it so that the changing portion is isolated in a separate class, thus making the original class more closed.

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

Sidebar

Related Questions

The open-closed principle states that Software entities (classes, modules, functions, etc.) should be open
The Open/Closed Principle states that software entities (classes, modules, etc.) should be open for
OCP (Open/Closed Principle) is one of the SOLID principles. Which is says: Software Entities
I'm trying to grasp the Open/Closed principle (in my case for PHP, but that
Is it possible to implement the Visitor Pattern respecting the Open/Closed Principle , but
Can anyone share sample of using Builder pattern to confirm OCP (Open-Closed Principle). Which
Possible Duplicate: The Open/Closed Principle I can understand that Open/Close principle suggests that You
There has been a lot of discussion on the subject of Open Closed Principle
I am looking for free/open or closed forum software for asp.net. Most of the
I am getting some open/closed times as integers since midnight. For example: 1140 =

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.