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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T10:43:24+00:00 2026-05-16T10:43:24+00:00

We are doing some big changes in our system and I’d like to know

  • 0

We are doing some big changes in our system and I’d like to know the best way to implement these new business logic rules, respecting SOLID principles :

Open / Closed principles says “Open for extension, but close for modification” ok, but how can I do modification ? I mean, I don’t want to keep the old business logic, and in my mind “extension” mainly means “adding code” not “changing code” , so what did I understood wrong ?

  • 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-16T10:43:24+00:00Added an answer on May 16, 2026 at 10:43 am

    Two big questions:

    What kind of changes are we talking we about here?

    What kind of existing code do you have? Is it already conforming to any SOLID principles?

    Let’s suppose we need to make some changes to a well-designed existing application. Consider perhaps a payroll application. We might have an Interafce (this is just a contrived example)

     public Interface EmployeeContract {         
          public int computeSalaryForMonth(int month);
     }
    

    and we have implementations:

     public class SalesContract implements EmployeeContract {
          public int computeSalaryForMonth(int month){
                   // computation involving sales figures and base salary
          }
     }
    
      public class HourlyContract implements EmployeeContract {
          public int computeSalaryForMonth(int month){
                   // computation involving hours worked and overtime payments
          }
     }
    

    Now all the other parts of the application are coded in terms of the Interface.

    We can now add new kinds of contract without changing any existing code, we are open for extension and adding possibly quite complex new business logic.

    BUT that’s because the original designer anticipated that kind of change, adding new monthly contract types. Not so good if we wanted to take on employees who are paid weekly? Now our interface is not suitable, we need to change it, and the effects will ripple through other code.

    Realistically, software will not be open to painless change of arbitrary business logic, and indeed trying to be flexible up front can absorb lots of effort. However do notice that even though in my example the Interface is not quite as flexible as we now need, because the Interface is the coupling point it’s vey easy to identify the portions of the code that need to be changed.

    Summary: in your situation:

    1. Understand the structure of the existing code and where it has points of flexibility. Accept that some code will need to change, and that it’s unsurprising that significnat changes in the business may require significant changes in the code.
    2. Structure generally helps with maintainability, so as you add new code pay attention to structure. Provide “firewalls” in your code by coding to Interfaces, striking a balance between getting the job done and being open to extension.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

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.