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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T12:59:20+00:00 2026-05-19T12:59:20+00:00

Recently, i took ownership of some c++ code. I am going to maintain this

  • 0

Recently, i took ownership of some c++ code. I am going to maintain this code, and add new features later on.
I know many people say that it is usually not worth adding unit-tests to existing code, but i would still like to add some tests which will at least partially cover the code. In particular, i would like to add tests which reproduce bugs which i fixed.

Some of the classes are constructed with some pretty complex state, which can make it more difficult to unit-test.

I am also willing to refactor the code to make it easier to test.

Is there any good article you recommend on guidelines which help to identify classes which are easier to unit-test? Do you have any advice of your own?

  • 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-19T12:59:21+00:00Added an answer on May 19, 2026 at 12:59 pm

    While Martin Fowler’s book on refactoring is a treasure trove of information, why not take a look at “Working Effectively with Legacy Code.”

    Also, if you’re going to be dealing with classes where there’s a ton of global variables or huge amounts of state transitions I’d put in a lot of integration checks. Separate out as much of the code which interacts with the code you’re refactoring to make sure that all expected inputs in the order they are recieved continue to produce the same outputs. This is critical as it’s very easy to “fix” a subtle bug that might have been addressed somewhere else.

    Take notes too. If you do find that there is a bug which another function/class expects and handles properly you’ll want to change both at the same time. That’s difficult unless you keep thorough records.

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

Sidebar

Related Questions

Recently I took a look at some code I'd committed to our version control
I recently saw some Perl code that confused me. I took out all of
I recently took some code from Delphi 2007 and upgraded it to Delphi 2009.
Recently, i am working with jquery for my mini-project. I took a code from
I was recently on CodeSchool's website and took the JQueryAir course that features a
I recently took up learning some css... and I am getting stuck on some
I recently took over some C and firmware responsibilities at work, and am having
Someone recently took a look of my code and commented that it was too
I recently took over some work form another developer and am trying to understand
I recently took part in ACM certified programming competition. This is the question which

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.