Is it a good or bad practice, to use empty instance?
There is "product" class, initiated with id:
class product
{
__construct($id = 0)
{
// populate class, there is no product with id = 0
}
function new($name, $data)
...
}
$product = new Product(123); // normal using
But I also need to create new product, so there is no initial object, and I create empty one:
$product = new Product();
$product->new($name, $data);
Is it good or bad?
May be I should create usual function new_product(), outside product class, because it does not use it's instance, just creates empty.
What is the best practice for this problem?