What does the principle of 'Favor composition over inheritance' mean in clean code practices?
This principle recommends that inheritance should always be used because it leads to cleaner and more efficient code structures.
Thatâ€™s partially correct. While inheritance has its place, composition is generally preferred because it avoids issues with tight coupling and limited flexibility.
Can you explain how deep inheritance hierarchies can lead to problems in maintaining Java applications?