I've noticed a lot of people are posting code without using code tags! Not that it bothers me too much, if I can't be bothered reading it, I'll just ignore it but having to tell someone every day to use code tags does grate a little.
I looked through the "Welcome" sticky on the Beginners board: http://www.cplusplus.com/forum/beginner/1/ and although it's quite a comprehensive guide to forum etiquette there is no mention of code tags.
Not that I believe all the new guys read it before posting, but I was thinking shouldn't it be amended?
How many times a week do you ask new forum users to use code tags? And how many of those people actually listen to you?
Actually I like the warning idea best. People can blatantly ignore stickies. Most if not all newbies don't even open the threads. But a warning in the programming forums would force them to at least see it once.
Over at DaniWeb they have a very aggressive approach to encourage people to use code tags. I can't tell any difference between the percentage of posters who fail to use them and those who do between the two forums.
Remember the second rule of UI design: "Users don't read anything."
How about something that scans the post looking for something that is unmistakingly C++ code, and makes sure it is in code tags?
No need to make it too complicated, maybe just look for braces. Also, since people "get it" after they've been here a bit, no need to do it for everyone. Just do it if their post count is low.
- user submits post
- if user's post count >= 20, post as normal
- otherwise, scan post. Look for "{"
- if not found, post as normal
- otherwise, scan post. Look for "[code]"
- if found, post as normal
- otherwise redirect user to a error page that gives a simplistic example of how to use code tags.
#include<iostream>
usingnamespace std;
int main (){
char yn;
while ((yn == 'Y') || (yn == 'y')){
cout << "Hello there, handsome!\n";
cout << "Would u like to hear it again?";
cin>>yn;
}
return 0;
}
A thing that could be done is not removing excess whitespaces. I never understood why that could be a good idea.
#include<iostream>
using namespace std;
int main (){
char yn;
while ((yn == 'Y') || (yn == 'y')){
cout << "Hello there, handsome!\n";
cout << "Would u like to hear it again?";
cin>>yn;
}
return 0;
}
is definitely less readable than
#include<iostream>
using namespace std;
int main (){
char yn;
while ((yn == 'Y') || (yn == 'y')){
cout << "Hello there, handsome!\n";
cout << "Would u like to hear it again?";
cin>>yn;
}
return 0;
}
and I think that a fair amount of newbies do have their code formatted to some degree.
Though of course, code detection would be awesome.
The only solution I could see could be viewed as extremely intrusive, which would be to give the more "trusted" users a power to add certain tags to new users' posts (code, output, maybe quote).
As I said, though. It's a little bit too intrusive for my taste.
I agree with hamsterman. Whitespace is useful. However, my pretty variable-width, non-serifed font doesn't have the same whitespace characteristics as a fixed-width font.
code tags are pretty useful because it makes stuff so easy to read
that way people will actually want to help you with your work
naw'msayyeennn?
ps what's wrong with this it makes my computer look so funny?