On 24.01.2011 22:49, אריה גלזר wrote:
Looking back at the last 20 posts, at least 4-5 of them had very long pieces of
code in them, that required me to copy-paste them to an external editor to dive
deeper into them. IMO that by itself suggests that a better tool is required.

...or a little more work by the author in order to reduce the amount of posted code to the necessary minimum, and to reformat it to fit in the body of an email. This action by itself has the very real potential to pinpoint the actual problem even before the question is posted to the list.

JSFiddle and the various *paste sites can be useful to present code which is too complex or cannot be easily reduced to a suitable size for inline posting. They are also handy if you want to make it simple for your readers to quickly test a piece of code, especially if your code depends on one of the common libraries. I would see these sites as complimentary tools for special cases, or for illustration/debugging, rather than a blanket replacement for inline code.

Requiring all code to be stored on external sites has a number of drawbacks:

- it makes it impossible to reliably search the list archive for certain functions or identifier names

- it introduces extra dependencies (external sites may be down temporarily or even close down permanently)

- it makes it hard to follow conversations without constantly opening pages in a browser

- it could tempt people to create Fiddles from larger, less structured blobs of code than they would send in a message (*)

I realize of course that not everybody will be disciplined enough to reduce and reformat their code, but then not everybody is going to go to the extra effort of creating a Fiddle, either. If somebody asks a question and just lazily pastes a few pages of unstructured code, their chances for a helpful reply will be slim.

There's another aspect regarding inline code vs examples in an online IDE like JSFiddle, but I'm not sure about it, so I'll just put it out there for comments. This list is named JS*Mentors*, not JSBugfixers. Maybe I'm reading too much into that, but the name seems to imply that teaching, discussion, and peer review are important - possibly more so than getting your code fixed. This is much easier to do if people can comment on parts of the original code in their replies. That's where you get helpful advice like "hey, don't use for..in to iterate over arrays (usually)". If we communicate code via JSFiddle alone, we can't really do that. In the worst case, conversations could degenerate into something like this:

  A: Why doesn't the click handler fire here: (fiddle link)
  B: Try it now: (fiddle link)
  A: Doesn't work, it says "addEventListener is not defined"
  B: Ok, how about now: (fiddle link)
  C: This is even better: (fiddle link)

...and so on. Not much to see or learn for anyone except A, B, and C.

So. How about a compromise:

* Always post code to the list
    - unless it really cannot be reduced to an appropriate length,
      in which case you should put it on the Web (JSFiddle etc)
* Take care to reduce your example to the minimum required to display
  your problem, and reformat it to fit in an email body
    - (specifics about formatting TBD)
* If you want your readers to run/debug your code rather than just
  look at it, create a Fiddle (or equivalent) as well
* If you insist on posting a ton of unformatted code, don't be
  surprised if your question is ignored


regards,
stefan



*) By the way, the folks at comp.lang.java.programmer have something they call an SSCCE: a Short, Self Contained, Correct (Compilable), Example. They even have a website to explain the concept (<http://sscce.org/>). It doesn't apply 100% to something like Fiddles, but the basic premise is the same: make your example as small as possible, as correct as possible, but still complete enough to display your problem.

--
To view archived discussions from the original JSMentors Mailman list: 
http://www.mail-archive.com/[email protected]/

To search via a non-Google archive, visit here: 
http://www.mail-archive.com/[email protected]/

To unsubscribe from this group, send email to
[email protected]

Reply via email to