I’m currently confronted with a C++ project written by some senior programmers consisting of about 400 files and 200 classes.
The code is well elaborated, works fine and stable.
While I’m adding some features, for me it is just ordinary practice to take care about const-correctness.
But if I start to declare my new member functions const, there is no end with adapting old code in order make things work.
- Should I invest the amount of time to introduce
const-correctness
into this code? - Even worse, I have to touch and alter the old mature code and explain
to the seniors what I did during the code review. Is it worth it?
If you feel that you can get it all done in a reasonable time, sure.
const-correctness is a good thing, so if you can adjust the codebase to employ it properly then that can never be bad.It all comes down to how much time you have available and what else you could be doing instead, which is more about project management and more appropriate on programmers.SE.
It’s certainly worth it for them (and, by extension, to everybody else). It sounds like they will learn a lot in code review, which is fantastic!
Edit
As molbdnilo rightly points out, this is a big change and you should definitely have a group discussion about it before starting. This would be more appropriate than leaving it to code review in two weeks’ time, when you’ve already done it.