Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Suggestion for dealing with unfeasibly long code lines

by nuance (Hermit)
on Jun 17, 2000 at 21:43 UTC ( #18657=monkdiscuss: print w/ replies, xml ) Need Help??

I don't very often read any section other than newest nodes. When I did load one today I remembered why. Those really long code lines that make every other post too wide are really annoying.

I have to assume that I'm not using the site as it was envisioned by it's creators. Since I don't like the monastery gates I rarely see quests etc. I'm fairly confident that I'm not the only person this is annoying. I'm also fairly sure I'm not the only person avoiding the monastery gates for the same reason.

It has been pointed out at various times (while discussing this subject) that it is not easy to create a parser that can break code lines intelligently.

Suggestion: I think it would make the site more readable if users were given the option to force a line break at a certain number of characters. This would be similar to the facility offered by emacs. When a line is too long to display on the terminal it is terminated with a single character and continued on the next line. Mutt uses something similar except that it puts a small highlighted + at the beginning of continuation lines. This would only affect users who requested it be turned on and the line length should be independently configurable by each person.

what I envisage is something like this.

foreach (@example) {
$unfeasibly_long_variable_name_I_should_know_better_really += $why_
+do_people_not_learn_to_break_lines / $_;
}

Where the + is the place that the line was forcibly split. This keeps the text understandable and the other parts of the post will be filled as usual. I only see this being used inside <code> tags

Nuance

Comment on Suggestion for dealing with unfeasibly long code lines
RE: Suggestion for dealing with unfeasibly long code lines
by Ozymandias (Hermit) on Jun 17, 2000 at 23:58 UTC
    There's another option.

    Always force line-wrapping so that the the screen doesn't get too wide when viewing a section, like the Monestary Gates. When you view a particular message, however, the lines aren't wrapped. That way the Monestary Gates (and the other sections) always look as they should, but SoPW and others don't get their code chopped.

    - Ozymandias

Suggestion for avoiding unfeasibly long code lines
by kudra (Vicar) on Jun 18, 2000 at 01:58 UTC
    I agree completely with the first couple of paragraphs. I have a different suggestion, however: include new quests on the new nodes page. Then there's no need to go to the gates at all. :)
RE: Suggestion for dealing with unfeasibly long code lines
by draconis (Scribe) on Jun 20, 2000 at 17:50 UTC
    In addition to what the others have said I also belive it to be a matter of programming "style". One could have easily stated the example as this:
    foreach (@example) { $unfeasibly_long_variable_name_I_should_know_better_really += $why_do_people_not_learn_to_break_lines / $_; }
    This way - the code still remains readable, maintainable without needing to "figure out" where things begin and end. So monks that post may consider this as an alternative to "run-on" statements. This of course dos not apply to the obfuscated code.

      Perhaps it's not immediately apparent from what I wrote that I totally agree with you. If you look closely at the example you have rewritten, you will see that the variable names I chose suggested the line break you supplied. Without doubt your rewrite is the "preferred solution".

      My proposal is not aimed at monks who know how to break lines. Lots of people post stuff that "breaks" the formatting of the page. It is unlikely that these people will "learn" how to do it properly. If my proposal was implememted it gives a way to "fix" the code that occasionally gets posted by even the best.

      Part of the problem is that a lot of "root" nodes are not editable once they have been submitted. Even if you see a problem in the thing you have just posted it is impossible to "fix" it. Then there is the problem with anonymous monks who do not even know how to use <font> tags. This is not a criticism of anonymous monks who have not visited the site before, the use of code tags is not intuitive, you need to be told about them and how to use them. Anonymous Monks (and monks posting for the first time) often post unreadable code that gets filled like normal text. If we have a problem getting them to use font tags, then we will surely have a problem educating them to break lines in sensible places. There is also the problem that different people use different screen resolutions and different font sizes in their browser. Things that fit correctly on your screen may not fit correctly on mine.

      So yes I agree, people should learn how to post. While they are learning, it makes the site less usable and we will always (hopefully) have new members "learning" how to post. I don't think your "solution" fixes the problem.

      Nuance

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: monkdiscuss [id://18657]
Approved by root
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (3)
As of 2014-07-12 19:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    When choosing user names for websites, I prefer to use:








    Results (241 votes), past polls