We are working on updating a code project that has become very messy over time. There are lots of modules which contain public functions that can be used from anywhere.
We want to move as much of the code into classes as possible, so that these can eventually be re-used in the next generation of the application. Is there a way that we can prevent these classes from using any (non-system) functions?
Example:
public module annoyingModule
public function addOneAndOne() as int
return 2
end function
.....(load more functions)....
end module
public class pricer
...(class code)...
end class
I want to make sure that nobody on the team can accidentally make a reference to the addOneAndOne function – if they need functionality from a module which is not part of the class, they need to re-implement it inside the new class.
You need to move your new classes to a separate class library project. As long as your new class library project does not reference the old project and does not include a copy of the old modules, all of that stuff will be inaccessible from the classes in that class library project. You then, in the old project, need to add a reference to your new class library project. That way, the old code can use the new classes, but the new classes will not be able to use the old modules.