Suggestion Template in Programming & Comp Sci forum

  • Thread starter Thread starter jhae2.718
  • Start date Start date
AI Thread Summary
The discussion emphasizes the need for a template in the programming and computer science forum to encourage the use of code tags for better readability. Participants express frustration over poorly formatted code, particularly in Python, where indentation is crucial for understanding logic. Suggestions include creating a tool for formatting source code into BBCode with syntax highlighting and considering a sticky announcement to promote proper code tagging. The conversation highlights the importance of whitespace and indentation in making code comprehensible. Overall, a collective desire for improved code presentation and user engagement is evident.
jhae2.718
Gold Member
Messages
1,184
Reaction score
20
I was thinking that it might not be a bad idea to have a template for the programming and comp. sci. forum not unlike Homework Help.

Basically, something like:
Code:
If you have example code, please place it inside code tags...

That way there might actually be readable code posted, as no one seems to know about code tags.
 
Physics news on Phys.org
I do like this idea. Particularly after one of the last ones with a huge block of unindented code. What a lovely read that was.

(Big thanks to Mark44 who re-wrote it with tags and indents.)
 
Tangential to this: is there any way to allow for tab characters? White space, and proper indenting make code readable. I have to open up Notepad, type a tab character, and then copy and paste it in code here.
 
JaredJames said:
I do like this idea. Particularly after one of the last ones with a huge block of unindented code. What a lovely read that was.

(Big thanks to Mark44 who re-wrote it with tags and indents.)
I have a hard time trying to discern the logic (or lack thereof) when code is poorly or not indented. Sometimes I'll go in and indent it to help me understand what the OP is trying to do, and to help other readers.
 
Mark44 said:
I have a hard time trying to discern the logic (or lack thereof) when code is poorly or not indented. Sometimes I'll go in and indent it to help me understand what the OP is trying to do, and to help other readers.

The majority of stuff I do now is with Python, so when not indented it's impossible to see what goes where (as I'm sure you're aware).

So when a thread pops up without proper formatting, I usually just give up on the code if I can't see it clearly with a quick skim through.
 
JaredJames said:
The majority of stuff I do now is with Python, so when not indented it's impossible to see what goes where (as I'm sure you're aware).

So when a thread pops up without proper formatting, I usually just give up on the code if I can't see it clearly with a quick skim through.

For Python cases, if I'm in a good mood I'll quote the post with the code, and then throw it in code tags, which can usually recover the indentation.

There's certainly no lack of unclear posts, though. Sometimes I get the feeling that the posters don't even indent their source code. :eek:
 
jhae2.718 said:
There's certainly no lack of unclear posts, though. Sometimes I get the feeling that the posters don't even indent their source code. :eek:

Some of the worst, IMO, is Awful Fortran Code, with no indenting, and lots of incomprehensible variable names such as rtlxgn and the like.
 
Would anyone be interested in a tool that you could paste source code into and have it formatted for BBCode (e.g. syntax highlighting)? I was thinking that might be a fun summer project.
 
jhae2.718 said:
Would anyone be interested in a tool that you could paste source code into and have it formatted for BBCode (e.g. syntax highlighting)? I was thinking that might be a fun summer project.

As long as the words "open source" are there somewhere, it sounds great!
 
  • #10
But of course! (Right now I'm thinking of Python/wx and using XML to define syntax files.)

Note that this will be a spare time thing, and right now I have very little spare time.
 
  • #11
jhae2.718 said:
But of course! (Right now I'm thinking of Python/wx and using XML to define syntax files.)

Note that this will be a spare time thing, and right now I have very little spare time.

Join the club.
 
  • #12
MATLABdude said:
Tangential to this: is there any way to allow for tab characters? White space, and proper indenting make code readable. I have to open up Notepad, type a tab character, and then copy and paste it in code here.
The problem is the browser(s). Rather than allowing you to type a tab, they use tab to cycle through inputs sources on the page. (A "feature" I never use.) To get the above tab, I hit tab in a text editor, and copied and pasted it here.

As for encouraging code tag usage, try something like what C Programming.com does; see the first announcement?

Maybe a sticky with a title like "USE CODE TAGS, OR I'LL COME TO YO' HOUSE AND KICK YOU IN YO' TEETH!" would attract attention.
 
Back
Top