I've spent some time today thinking about what else could be done to further obfuscate source code and many ideas I've hacked out certainly show some promise for some advanced refactoring. I"m getting pretty excited about this little pet project.
Anyways, one way to certainly obfuscate source code is to collapse class hierarchies.
I plan on implementing this using an algorithm like:
1) Find a class
2) Determine if it extends any base class
3) Recursively travel up class hieracrhy until base class found
4) Scan source tree for any other classes which extend base class
5) Store each of those classes in a stack
6) Scan base class source for member variables
6.1) Refactor member variables into each of the superclasses
7) Scan base class source for member functions
7.1) Check if superclass re-defines any method
7.2) Scan re-defined method in superclass for a call to base implementation
7.4) Refactor base method call w/ inlined code OR add base method with renamed function and call that instead???
7.3) Refactor member function into each of the superclasses
Already just writing this out helped me recognize something I missed with step 7.4 - I think renaming the base method would make more sense and just cimply change the call from one to the other. As a last phase of my obfuscation CLI tool I plan on expanding private methods and static functions, but only under a certain set of rules, like if the method is invoked less than three times per method - expand/inline the code.
So anyways, as you can see the details get gory pretty quick and I could certainly use some more eyes/heads going over the details with me to help me spot potential problems, etc...
One thing I would like to request right now is, we stick to the topic at hand, that is the collapsing class hierarchies and refrain from offering other ideas on auto-refactoring techniques, such as method extraction, etc - yes I get as excited as you do about these topics but keeping things on topic will help me accelerate thedevelopment.
Cheers