Twoje komentarze

Спасибо за тёплые слова, Александр. Рад, что вам всё понравилось.

In other words, you would have a single Store class (Singleton), and a hierarchy of StoreStrategy (for a lack of better name) classes.

Hi!

I'm not sure why do you need a Singleton here, most likely to get a way to access the store instance globally. If so, have you considered separating this "accessor" and the actual store functionality into separate classes? This way you won't have to create subclasses of the singleton, which is indeed not convenient. Instead, the Singleton class can act as context for the strategy classes.

Thanks for the idea, Sean! Since I'm not a C++ programmer myself, I would need a volunteer to do it. If anyone is willing to do it, please shoot a pull request to this repo: https://github.com/RefactoringGuru/design-patterns-cpp

Hi!

We do let you download the invoice after purchase, however, please be aware that it's not a Chinese "fapiao" invoice, since we're a foreign company.

All right, this was easier than I expected. I added the "Refactoring.Guru" LinkedIn organization, it's now discoverable. The rest is straightforward:

1. Finish the course and open your certificate, here's an example:

2. Note the certificate ID, beginning with the # on the bottom left, and the certificate URL on the very bottom. Put those into Credential ID and Credential URL on LinkedIn, like this:


3. As a result, you'll get a shiny block like this on your LinkedIn profile:

Hi David!

Thanks, this is a great question. I'll see how this can be done.

Спасибо на добром слове, Максим.

That's a nice catch! Here's a difference, though. In the book, I'm talking about objects—I meant that a component object can't act on its own, so when you create objects you will most likely create both the container and the component. There's no reason to create an instance of a component (make it exist) on its own. But when we're talking about classes, there's a slight distinction that I pointed out in the previous comment. I'll make a note to myself to revise this part in the book to eliminate the confusion.

Hi Martin!


Thanks for a good question. I don't think it's a requirement of the composition. There are certainly cases when both the container and the component don't make sense without each other. But I can also imagine the composition, where the component can be used in several different containers, and it's the container that can't exist without a component.