tea.mathoverflow.net - Discussion Feed (Long code excerpts?) Sun, 04 Nov 2018 13:41:55 -0800 http://mathoverflow.tqft.net/ Lussumo Vanilla 1.1.9 & Feed Publisher Michael Lugo comments on "Long code excerpts?" (2236) http://mathoverflow.tqft.net/discussion/184/long-code-excerpts/?Focus=2236#Comment_2236 http://mathoverflow.tqft.net/discussion/184/long-code-excerpts/?Focus=2236#Comment_2236 Fri, 29 Jan 2010 10:58:55 -0800 Michael Lugo I feel like we shouldn't be more code-friendly than Stack Overflow, given that Stack Overflow clearly has a lot more people who can actually read code.

]]>
Ilya Nikokoshev comments on "Long code excerpts?" (2220) http://mathoverflow.tqft.net/discussion/184/long-code-excerpts/?Focus=2220#Comment_2220 http://mathoverflow.tqft.net/discussion/184/long-code-excerpts/?Focus=2220#Comment_2220 Fri, 29 Jan 2010 00:22:16 -0800 Ilya Nikokoshev @Qiaochu: from that link (emphasis mine)

Most code that is going to be posted on the site is going to be a short snippet where the relevant parts are the only ones going to be posted. Anything that gets a little longer will usually have comments in relevant parts explaining what's going on. We're programmers, I think that suffices. Allowing lines might encourage bigger code blocks, and that's not a behavior I think we want to encourage.

]]>
Qiaochu Yuan comments on "Long code excerpts?" (2212) http://mathoverflow.tqft.net/discussion/184/long-code-excerpts/?Focus=2212#Comment_2212 http://mathoverflow.tqft.net/discussion/184/long-code-excerpts/?Focus=2212#Comment_2212 Thu, 28 Jan 2010 14:50:55 -0800 Qiaochu Yuan Ilya, as far as I can tell we are one of those sites, at least with respect to the first condition. Although see this discussion on SO as to why there are no line numbers: http://meta.stackoverflow.com/questions/7119/why-are-there-no-line-numbers-in-the-code-listings.

]]>
Ilya Nikokoshev comments on "Long code excerpts?" (2210) http://mathoverflow.tqft.net/discussion/184/long-code-excerpts/?Focus=2210#Comment_2210 http://mathoverflow.tqft.net/discussion/184/long-code-excerpts/?Focus=2210#Comment_2210 Thu, 28 Jan 2010 14:24:27 -0800 Ilya Nikokoshev There are many sites where you can post your code and have it nicely formatted, line numbers, easy download etc. I think linking to a code pasted onto one those sites would be a much better choice than pasting it directly into the question text. This may not apply if the code itself is the primary object of the question, but I don't imagine how it would be possible for a question appropriate for MO.

]]>
rwbarton comments on "Long code excerpts?" (2151) http://mathoverflow.tqft.net/discussion/184/long-code-excerpts/?Focus=2151#Comment_2151 http://mathoverflow.tqft.net/discussion/184/long-code-excerpts/?Focus=2151#Comment_2151 Wed, 27 Jan 2010 13:44:28 -0800 rwbarton I tihnk it would generally be best to include an appropriately high-level explanation of what the code is about in English, so that people can determine whether they are interested in the question, together with a link to the code on a pastebin site (e.g. gist.github.com) for the full gory details.

]]>
Michael Lugo comments on "Long code excerpts?" (2150) http://mathoverflow.tqft.net/discussion/184/long-code-excerpts/?Focus=2150#Comment_2150 http://mathoverflow.tqft.net/discussion/184/long-code-excerpts/?Focus=2150#Comment_2150 Wed, 27 Jan 2010 13:08:26 -0800 Michael Lugo Just to make it clear, I'm not saying that long amounts of code should be disallowed.

]]>
David Speyer comments on "Long code excerpts?" (2149) http://mathoverflow.tqft.net/discussion/184/long-code-excerpts/?Focus=2149#Comment_2149 http://mathoverflow.tqft.net/discussion/184/long-code-excerpts/?Focus=2149#Comment_2149 Wed, 27 Jan 2010 12:31:44 -0800 David Speyer That particular question didn't belong on the forum, because the math was elementary. But I could imagine having a question where a program wasn't performing as expected and I didn't know whether the flaw was in my understanding of the mathematics or my implementation of the algorithm; I think it would be OK to post code in that case.

]]>
Grétar Amazeen comments on "Long code excerpts?" (2148) http://mathoverflow.tqft.net/discussion/184/long-code-excerpts/?Focus=2148#Comment_2148 http://mathoverflow.tqft.net/discussion/184/long-code-excerpts/?Focus=2148#Comment_2148 Wed, 27 Jan 2010 11:42:35 -0800 Grétar Amazeen That particular question was inappropriate.

I agree that long chunks of code shouldn't be disallowed but I also agree with Michael that there should be something in the "how to ask" page asking people to describe their algorithms in higher level terms, rather than in code. Perhaps it's just me but I couldn't write c++ code if my life depended on it, without investing some time in learning the syntax. However I'm well capable of following the reasoning behind an algorithm, and could possibly be of help to OP's if they wrote in higher-level terms rather then code.

If a question really is about the maths behind an algorithm, then that's fine and the question should be written in terms understandable to a lot of mathematicians. If however the question is sensitive tot which programming language it is written in, then it probably is not an MO question.

]]>
Scott Morrison comments on "Long code excerpts?" (2141) http://mathoverflow.tqft.net/discussion/184/long-code-excerpts/?Focus=2141#Comment_2141 http://mathoverflow.tqft.net/discussion/184/long-code-excerpts/?Focus=2141#Comment_2141 Wed, 27 Jan 2010 09:27:45 -0800 Scott Morrison The asker has answered himself, and the question has since been closed. This particular question was inappropriate, but I agree there's no need for a "rule" about long chunks of code being disallowed.

]]>
Steve Huntsman comments on "Long code excerpts?" (2139) http://mathoverflow.tqft.net/discussion/184/long-code-excerpts/?Focus=2139#Comment_2139 http://mathoverflow.tqft.net/discussion/184/long-code-excerpts/?Focus=2139#Comment_2139 Wed, 27 Jan 2010 09:07:14 -0800 Steve Huntsman
Given that, and because MO isn't a place for publication of papers but a place to ask questions, I don't think it's necessarily helpful to take a firm stance on including code. ]]>
Michael Lugo comments on "Long code excerpts?" (2137) http://mathoverflow.tqft.net/discussion/184/long-code-excerpts/?Focus=2137#Comment_2137 http://mathoverflow.tqft.net/discussion/184/long-code-excerpts/?Focus=2137#Comment_2137 Wed, 27 Jan 2010 08:25:34 -0800 Michael Lugo This question about the Atkin sieve includes an amount of C++ code that's much longer than the text of the post.

I'm having trouble finding other examples, but I know there have been other such posts. Generally I think that many of us aren't willing to read large amounts of code, especially in unfamiliar languages. (C++ is hardly obscure, but I'm not a programmer.)

Perhaps the "how to ask" page should include something like "if your post includes lots of code, this probably isn't the right place for it?" This seems to be in keeping with the general mathematical ethos that papers don't include code (at least, not outside of an appendix); most "experimental" papers that I've read seem to include a high-level description of the algorithm, maybe even in pseudocode, but not something somebody could actually run.

]]>