I've just been reading through the SOLID principles, and this is one I have real difficulty with when designing software.  I am relatively new (4 months professionally) at coding.The idea is simply to encapsulate classes into ones that perform a single task.For example, what if you have a class that creates and populates a Treeview and configures it to your specification.  You then want data retrieved from a database when the user clicks on the nodes.  Would you say this is two separate concerns?  Populate and configure the treeview Obtain data from the database?Also, in the same app.  You have a datagridview that is also populated with dynamic data.  Would you therefore put that data retrieval in the same class as the treeview data retrieval or would that be yet another completely seperate class?Thanks.
Separation of Concern/Single Responsibilty Principle
design;language agnostic
Separation of concernsEach object does its own job. Thus in your example the tree view knows only about being a tree view (presumably displaying data). It may may load its own data but it should not know where the data is coming from. If it knows were the data is coming from then it is tightly coupled with the data source (i.e. It may be a DB now, but what happens in version 2 when you need to get data from the space shuttle?).Instead you should pass the tree view an interface (that it knows how to use) to retrieve its data from:// Exampleclass DataRetrieveInterface{     // STUFF     virtual std::string getItemAt(int index)  = 0;};class DBDataRetriever:      public DataRetrieveInterface {};class ShuttleDataRetriever: public DataRetrieveInterface {};class MockDataRetriever:    public DataRetrieveInterface { /* Needed for testing */ }class TreeView{    public:        TreeView(DataRetrieveInterface& data)        {             // use data to populate the view.        }};If you re-use the DataRetrieveInterface for the grid is something you need to decide as part of your design. Is generic enough? Alternatively you can derive from this interface and have something more grid-specific for the grid object. At this point there is not enough information in the question to say if you should or should not have a different interface for the grid.