Context: "How to call a method from a class referenced as a string?"
More general context: how do we educate occasional users, or new users, to the best practices to follow when posting a question on Stack Overflow (like, in this instance, on code block fence, and syntax highlighting)?
quick downvote/vote to close with the comment "Don't post images as code, read the manual", as it was done here? That seems like an advertisement for Reddit (where the same question would actually be answered)
or try to educate them by example, editing the question to include the code (I use Google Lens to transcribe the image to code: my phone can send the detected text directly to the clipboard of my computer: all I have to do is Ctrl+V, and some light edits)
The current FAQ "When should I make edits to code?" says:
Don't:
- ...
- Transcribe code from an image to text. It's just too easy to introduce new errors.
This 2016 discussion "Can we close questions that put most code in an image?" says:
If the question is well asked, well described and the image is the only problem, I would drop a comment, giving OP a chance to edit their question and replace the image with actual code
I usually don't see informative comments, just downvotes and vote to close, which, in my opinion, contribute to the negative feeling towards asking questions on Stack Overflow.
The particular question I reference at the start of this post might very well remain closed: I trust the SO Close Vote Reviewers on this, where I have posted my reopen-pls tag. And I thank them for their welcome of the SOCVR noob that I am (their FAQ is great).
But regarding picture as code, is it bad to replace them? Or, as expressed in SOCVR:
reject edits that simply inline images, or worse, edit the code in that's the OP's responsibility.
Yes, the OP has a responsibility to understand what the best practices are, but, in my experience, downvoting and closing a question immediately does not often lead to further investigation of how Stack Overflow works (not to mention that even I was not aware of the edit FAQ: that resource should be of interest to any new contributor asking a question on SO).
I prefer showing, hence my edit. I am interested in your opinion.
text
, rather than the image, is low (in my experience), however, I feel it's a very important step that the user takes the time to do it themselves. Posting code as an image is, in my opinion, reason to downvote and/or close and the OP needs to learn what Stack Overflow is about; I feel often people that post images don't understand the community or have taken the time to. Others fixing such severe and fundamental problems doesn't fix their understanding and could likely mean they continue making such bad posts.[main]
in my comment text. The [mre] "magic link" however does not work on meta, only the main site.