2017-03-12 14:14 GMT+05:00 Lester Caine <les...@lsces.co.uk>:

> My problem here is with the reason for needing a different class for
'Square' when $rectangle->is_square() is a simple additional check on a
single Rectangle class.

Yes. And we have to call it in all operations with Square manually, and
throw exceptions/return errors manually.

> drawSquare() seems redundant when $rectangle->draw() does the same job

This is just example of external function with type hinting. And I'm not
sure that models should know about device contexts, canvases, pixels and
other details of presentation layer.

> Trying to create 'type's for all the variants of the object is just
wrong? int_instock, int_minorder, int_backorder, int_special_production and
so on as the types of LineItem so 'instanceof' will work for you?

I don't need to create a separate type for every characteristic. I need to
create a type for some important operations, which will contain all
required restictions of object state and which I could just write in all
functions that work with this state.

Reply via email to