The way Stack Exchange works is that volunteers get reputation, and when a user gets 3000 reputation they can vote to close questions. These moderators are different to elected moderatorsthan elected moderators, who have diamonds displayed next to their names.
-
we require that the code be posted by an author or maintainer of the code
In this case it is debatable who the author is. However you are a maintainer.
In this situation the closers may have assumed you were neither; instead you just took the code from the book.
-
that the code be embedded directly
You have included the code. It is not this reason.
-
the poster know why the code is written the way it is
Some closers may have thought you were asking how the code works. A segment of your question can read as a if you're trying to circumvent the rules.
Does the code below program correctly to interfaces, encapsulate changeable behavior, and employ composition in a reasonable manner?
If the code does work as intended, the interfaces, etc., are correct then we would answer the question with "yes". But it doesn't stop there; since we're just random people on the internet we should provide proof that we are correct. And so we would be explaining how or why the code is correctly applying interfaces, etc.
So from my perspective I can see potentially two reasons to close your question for this reason. But letslet's look at another close reason too, as some may have voted to close for this too.
Linking to:
If your code was deemed to be example code, too hypothetical to be meaningfully reviewed, then we need you to provide concrete details.
Your code doesn't really do much. It creates two objects which in some convoluted way add "I'm flying" and "not flying" to the page. I can see people voting to close your question for this reason.
-
generic best practices are outside the scope of this site.
Your question could also be thought of as a generic best practice. As as all you've implemented is a design pattern.
- It's not clear on ifwhether you're an author or maintainer.
- It may look like you're trying to circumvent our rules.
- Your post looks like example code / generic best practice.
At the least, closed for the wrong reason.
I've read the first chapter, and whilst I can see similarities, the code is your own. I
I also think it's rude of us to assume that you're trying to circumvent the rules.
I don't think your question is off-topic for MRC either.
I'm used to a higher code density, and your code gives off a hint that it's example code. But
But I do think the question is answerable, there's enough context to answer this.