Interface Programming
Allowing classes to have intimate knowledge of each other goes against the basic principle of object-oriented programming. That principle states that you should try to decouple classes from one another as much as possible. If you don't, you run the risk of creating spaghetti code. To understand what is meant by spaghetti code, imagine a bowl of spaghetti where every noodle represents a different object. As you can see, each class (or noodle) touches quite a few other classes. Therefore, if you change one class, you must revisit, redo, and/or recompile every other class that it touches. That might not be a problem for a small project, but for large projects that need to be maintained, that would be a big problem. One way ...
Get Microsoft® Visual C#® .NET 2003 Unleashed now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.