Your comments

Yeah, that's correct (with a minor correction):

Professor is dependent on Course

Professor is dependent on Student

Hi!

Sorry, it's not yet finished.

Hi!

If first & last names are used internally, that doesn't mean that they would be temporary. Imagine a local variable in a method, say you keep some intermediary value in that variable between the method start and finish. If you convert that variable into a field, that would be a 100% temporary field. Of course, there's no reason to make such a conversion intentionally. However, such a field may be created after several iterations of changes to a method, for example, when the field value becomes no longer relevant in other methods of the class.

Hi Bruno!

Yes, you understand the implications of composition correctly. However, the Professor class wasn't meant to instantiate Student objects. It may receive a reference to a student by other means (via the constructor or some setter).

Здравствуйте!

Думаю, PHP вам будет ближе всего.

Hi!

Thanks for a good question.

Strictly speaking, making the base products interfaces would be the most purist and minimal thing to do, because we are only interested in communicating the fact that the concrete products have a common parent. However, this doesn't mean that you have to specifically declare interfaces for this purpose. If you already have a class hierarchy, using the base class in the creation method result types would do just fine.

Avoiding the direct construction of products on the client code is a whole point of the pattern. If you don't have this problem, you don't need to apply the pattern. If you can get away with a simple interface, then do it—the simpler the code, the better.

Hi Bruno!

Thanks, that's a good question! In most languages I'm aware of, an interface can not contain fields. I think the main goal of interfaces in Typescript was to ensure type safety in a wild variety of possible JavaScript objects, rather than implement or enforce any of the OOP concepts.

Hi Marko!

Hm, what do you define under "portability"?

Здравствуйте!

Спасибо за ваш отзыв, рад, что вам понравилась книга.

Для паттренов, примеры на TS уже есть. На счёт Dart пока не уверен, появятся ли. Для рефакторинга примеров на TS/Dart нет, но TS версия появится во второй редакции курса (даты выхода пока неизвестны).