Is it an acceptable practice to initialize physical/external resources from a constructor when the resource is needed for the object to do it's work?
For instance, let's say I wanted to create an object that proxies a durable message queue and that the message queue is a physical database table.
Would that make sense to create an idempotent constructor which physically create the table if it doesn't exist yet?
IMessageQueue queue = new SQLTableMessageQueue('table_name', dataSource);
Perhaps a static factory method would be more appropriate? In that case, the table creation would occur in the factory method and the constructor would be free of such behavior.
IMessageQueue queue = SQLTableMessageQueue.create('table_name', dataSource);
I'm not too sure what would be an appropriate approach? Another idea I had was to use the Repository Pattern.