Which would you recommend - a deep objects hierarchy (where each object hold a reference to it child objects), or flat objects (where you provide services to retrieve child objects)?
Let's assume that you are creating a database management application. You will have objects such as:
- Server
- Database
- Columns
- Views
Which option would you recommend:
- Each Server object holds a list of Database objects. Each Database object holds a list of Columns and a list of Views, etc.
- Each object is a "dumb" object, holding only its own properties, and you provide a set of services to retrieve the hierarchy, such as GetServerDatabases(Server), GetDatabaseColumns(Database).