The topic of this thread is on ways to bind a resource (eg. a pair of filenames) to a class in a concise way, based on an existing code framework. Your proposed solution:
- Does not bind a resource to a class in any way. You first asserted that I was wrong and that your code did perform this per-class binding. Then, you contradicted that initial statement and said that per-class binding would require the creation of an additional class for each class for which you want to perform the binding — which falls short of the request for a concise solution, as per the original post.
- Does not use the existing code framework provided in the original post, and instead proposes a heavy reworking. Your code is also written in another language which the original poster might not understand, and which does not compile (check the number of required arguments for the ImageView constructor). It uses a basic design that is different from that of the original post: Model-View-Controller, a design with which I happen to be familiar, having used it often in the past.
As a consequence, it seems clear enough to me that your proposal is not an acceptable answer to the question and problem described in the original post of this thread. Your implying that I do not know enough to judge your post — directing me to look up the Model-View-Controller pattern — is something I would consider downright insulting if not for the irony of your contradictions in your third post.
Your initial post does offer some good insight by giving an example of Model-View-Controller, which I agree is a very good thing to use. However, you never stated that your purpose of
showcasing an alternative design, which was quite different from the meaning of
answering the original question that the format of your post (a blob of code with no accompannying explanations) implied. Moreover, you insisted that your post did answer the original question of the thread, which it does not as you seemed to agree later on. Why not simply begin your post with "
This does not answer your question, but a better design would be: ...", maybe followed by a short argumentation of why that design is better.
You don't appear to have read the original question (or deliberately chose to ignore it), you do not answer the original question, and instead make an unsupported, unexplained post that, after thorough reading, seems to scornfully throw away the entire work of the original poster and unilaterally replace it with a half-described and crippled design that has no logical relationship whatsoever to the question, but which you appear to put forward as if it was the best thing that happened to man since the AZERTY keyboard; only to follow up by implying that I am a know-nothing idiot who does not see in which way your post helps solving a problem that it (
fact) does not solve.
Your participation is not an answer to the problem, only a suggestion for a better design that is completely orthogonal to the problem, so accept that it is only that, and nothing more.
EDIT: one final remark about your allusive statement in your last post.
Quote:If you did for some reason want to create more work for yourself, you could create specific RobotXViews that sets the image in the constructor, but my way is shorter and more flexible.
There are two errors in the above comment.
- Consider the following line of code:
int main( ) { return 0; }
Neither this line nor your proposal are acceptable solutions to the problem. My proposal is shorter. Therefore, I suggest we do not create too much work for ourselves, so we keep my solution and throw yours away.
Before saying that your solution is shorter, you should begin by providing an actual solution.
- The you could create specific RobotXViews that set the image in the constructor part of your answer has the quite ironic property of being, word for word, what the original poster wants to know how to do. Is this what you call a solution? Commenting on the general design of the code, giving a design of your own that you insist on being superior without supporting your claims, while leaving the original question unanswered?
Great, cool, you won. Your method is the best, shortest, most easily maintained and most easy to write. Here's your medal. Now, stop interfering with the actual answering of the question.