3 ms·
I recommend consulting my other remarks within this topic, but on this specific point: The title's inconsistency with the body text, i.e. "open tags" vs "openi
by inopinatus 5y ago
I recommend consulting my other remarks within this topic, but on this specific point:
The title's inconsistency with the body text, i.e. "open tags" vs "opening tags", is especially and immediately notable because they are (in context) grammatically interchangeable but have dissimilar meanings. This is immediately suggestive of (but not diagnostic of) a writer revealing context and then switching to detail. As a longtime reader of requirements documents and S.O. questions, a mental flag to check the intended meaning of both is already raised at this point.
The reference to XHTML is ambiguous, since it speaks to working around XHTML that is already present, rather than defining an input or output document, which means this is something thinking at the character level rather than in terms of DOM. This impression is verified by the comparison pairs in the question body, leaving the essential context question of what are the desired inputs and outputs?" glaringly unanswered.
The early construct, "I need to ..." is a secondary flag that immediately reinforces the likelihood of a critical gap in context, since it does not explain why the need has arisen.
To anyone familiar with the structure & semantics of the HTMLs, the omission of any mention of tag closing, having discussed "opening tags", boosts the sense that something relevant is missing from the question. The obviously flawed regular expression then attracts a "probable novice" qualifier, which is amplified by both the closing "what do you think?" and the original's emoticon.
At this point, we're about ten seconds into the read-through and there's already a ton of labels pointing to a beginner who may be conflating dissimilar concepts and (through inexperience) choosing the wrong tool for the task, whatever that may be. Another few seconds to review comments, at which point it appears that author does understand the distinction between an "open tag" and an "opening tag", and this reweights the XHTML reference in the title toward being a need to output strict XHTML.
Given their apparent beginner standing it's likely this is either their first S.O. post, or one of slightly too many, and a check in their profile for proximate questions immediately reveals the latter case. References to balancing of "dangling tags" abound, collapsing all preceding problem variants and likelihoods into the only focused understanding that fits: it's a PHP novice, bright but inexperienced, who wants to normalise a nonconforming document into XHTML by balancing the tags, and that the mostly likely use case is injecting an existing HTML fragment into a RSS XML feed.
Elapsed time ca.90 seconds.
Another minute to scroll through surrounding Q&A materials, to allow alternative options to appear (they don't).
A few seconds for a chuckle at that old friend of an amusing answer, and recognise that the advice within is sound: what they really need is, indeed, a parser. Then, a pause to consider a contrasting notion, that what they're trying to do is write a parser. Consider evidence that author has taken at least one step towards inventing stacks on their own from first principles; prospect loses to existing top answer because the experience level required to write parsers cannot, ultimately, be acquired from a single S.O. question.
Last but not least; the final boss: convincing the chorus of Hacker News to accept this interpretation. That takes much longer.
- DangitBobby 5y agoConsider alternatively that this is a tiny piece in the much broader puzzle of what they are trying to accomplish, that they are aware both of their own beginner status but also that, in this case, good enough will be good enough, or that they don't have the time or inclination to switch to a real parser and that's why they didn't ask about it. Or maybe even that the goal here is to specifically learn to use regex to solve a real software problem that they have. It's all a matter of interpretation of context that we don't have. As an asker of questions on SO where people provide answers to questions I specifically intended to not ask, this pattern of reading deeply into context we don't have is actually kind of annoying. Unless you provide both the answer to the actual question and then some guidance on how you really should be doing something. Those answers are very, very helpful.
- inopinatus 5y agoThese objections may seem relevant to your personal experience, but they don't pertain to the case at hand, for which ample context is available. Dealing with responses from people who've rushed to write something without bothering to properly consider the problem is, of course, internet 101, but such answers generally take the short road to content oblivion. For those answers of any quality, however, note this: if people are answering, for free, on their own time, questions that you don't think you asked, but they evidently do, then consider taking some personal responsibility for that outcome. Complaining about it would seem wholly entitled and ungrateful, and unconstructive besides. If they are well-meaning beginners, coach them: it's how the stone soup gets made.
- DangitBobby 5y agoI also both ask and respond to questions. Mostly respond. For free. On my own time. People who answer on SO are not a unique special breed in the sense that they are willing to help others with their problems. I have read your reading of the thread, gone through it myself with that in mind, and disagree wholeheartedly that you have meaningfully extrapolated the context you claim.