Principle-Based Refactoring: Learning Software Design Principles by Applying Refactoring Rules