I've seen examples in extensions and in core where blocks are created through PHP code, e.g. in a controller action:
$block = $this->getLayout()->createBlock("company_module/...");
Or a block sets its own template, usually in the _construct()
$this->setTemplate("... .phtml");
I can see the programmatic approach being necessary if there is business logic involved that decides which block to create (or perhaps not create) and which .phtml template to set, depending on the circumstances.
But there are plenty of examples where there appears to be no business logic involved, yet the developer decided NOT to use the declarative approach of the .xml
Why would one want to NOT use .xml for creating blocks? What is best practice?