Reputation: 1329
I have a legacy c++ application and refactoring it step by step. I came across lots of typedef as below
typedef std::vector<class OrganisationData *> VECTP_ORDATA;
VECTP_ORDATA g_OrganisationData;
There are lots of free functions using on g_OrganisationData currently. What I feel is, previous developers should have made a class and made it more object based instead of free function spreaded everywhere.Currently I am in a process of grouping relevent functions together and make it as a static class around g_OrganisationData
and call static functions whereever necessary.
Another option is grouping the function together under a single header file and use it. Is there any other best alternatives? Due to the nature of the code, I can't make changes step by step only.
Upvotes: 0
Views: 213
Reputation: 206607
My suggestion will be to put related functions in appropriately named namespace
s instead of making them static
member functions of a class
.
Examples:
namespace RenderAPI
{
// Put all rendering related functions here
}
namespace PersistenceAPI
{
// Put all read from disk and write to disk functions here.
}
namespace MySuperCoolBusinessLogicAPI
{
// Put all the functions dealing with your super cool business logic here.
}
Upvotes: 2