I am a newbie who just graduated.
I found my first job and begin to review some legacy codes
And I find out there are a lot of macros which could be replaced by function
(somebody especially c coders may think macro is a better choice)
Not even that, I almost could swear that the designer did not think carefully
before designed, there are a lot of weird interfaces,
what is the meaning to design something like
public : int getNum() const; void setNum(int const num); ................ protected : int num_; .....................................
A lot of inline codes, even constructor and destructor
yes, there are nothing in the constructor and destructor, but there are a lot of "unseen" constructor and destructor
would be called implicitly, I could only hope that the compiler would be smart enough to reject all of the
unnecessary inline functions.
The worst thing maybe is "copy and paste"
Oh man, maybe this is one of the most cunning evil of programming
I believe there are other problems, and maybe it is worse than what I have covered up until now
I know our company is a small company
But I never imagine our legacy codes could be so **** poor
Are those beautiful codes only existed in those textbooks
which wrote by those masters?
The most important thing is, what should I do if there are a lot
of "copy and paste", weird interfaces(meaningless), more and more prone to error
macros?Because our codes are pretty fragile and a lot of bugs, prone
to crash. I just know that our company seldom or never review codes,
because we don't have times to do that. When bugs pop out and they failed
to find out the reason, they would just write some work around to cover it.
What would you try?Any good ways or books?Since this is teamwork, I cannot
insist my opinion, but to follow the rules of the company.
I don't intent to leave this company in one or two years, except of producing
some ugly codes like that again, what could I do to make my life easier?
ps : I can't change the legacy codes, because they don't want to see any bugs occur
yes, it is reasonable. No matter how poor the codes could be, it is very hard to
change it when it is widely spread within the whole product...
Now I only hope there would not be too many bugs hide in those legacy codes