Saving newline just in case your keyboard loose them...



  • I am no programmer, but work in a closely related field. Part of my job is handling statistical data analysis - which involves a lot of poorly documented scripting in esoteric languages.

    Everytime I read a script from my predecessor I am asking myself "why did she love newlines so much?!". Basically every line of code is seperated by 5 newlines or so.

    Reading the code is a total pain - you cannot see the beginning and end of an statement at once. Logically related lines of code are seperated by huge walls of no text, whereas meaningful breaks are absent.

    Now I am going through a 10.000 LOC file with 30% newlines without purpose. Cleaning and organizing it is a pain, but afterwards I can actually see what I am doing.



    Some code to show the problem:
    text Q11Multi = "Table 11: Statiscial Analysis

    Some text
    ";

    tabselect text "Base: Use only a subset of the data;


    #t1 table = #Header1 by Variable99 sort position slice 19;
    #t1 table = #Header2 by Variable99 sort position slice 19;
    {#t1 table = #Header3 by Variable99 sort position slice 19;
    #t1 table = #Header4 by Variable99 sort position slice 19;
    #t1 table = #Header5 by Variable99 sort position slice 19;
    #t1 table = #Header6 by Variable99 sort position slice 19;
    #t1 table = #Header7 by Variable99 sort position slice 19;
    #t1 table = #Header8 by Variable99 sort position slice 19;}

































    #ifdef ascout
    spsslongnames = yes;

    asciiout ID1 = 1 13;
    setdecimals systemweight = 4;
    asciiout systemweight = 15 10;

    spss asciiout = "gew.sps";
    asciioutfile = "gew.dat";
    #end





    end;


  •  Somehow I think when she "learned" to use a compute, she pressed the Insert key. Adding text in the middle of the document is a pain in replace mode, ya'know? Must be sure to add blank space to have room for later.

     

    And suddendly the numbering of BASIC lines comes to mind...

     



  • That is a rather good explanation....



    Oh my good, I would really love Basics Line Numbers and gotos in the language I use here..

    All I have is a crappy "IF #DEBUG ELSE" syntax, which just doesn't cut it. But the developers do not understand the need for a logic flow... "Just uncomment or comment when you need a specific element not every time..."



  • I once had an intern who didn't seem to understand the Delete or Backspace keys. If he had to remove any code, he'd highlight the section using the mouse and press Spacebar or Enter. Any codefile he worked on was riddled with odd whitespace and no two indentations were of the same depth.


  • Discourse touched me in a no-no place

    @HerrDerSchatten said:

    Everytime I read a script from my predecessor I am asking myself "why did she love newlines so much?!". Basically every line of code is seperated by 5 newlines or so.
    I did once encounter code that was a little bit like that, with a mysterious wall of blank (and empty) lines. The fun bit was that removing any of the lines (in an otherwise ordinary file) made the code fail under test...


  • Discourse touched me in a no-no place

    @dkf said:

    @HerrDerSchatten said:
    Everytime I read a script from my predecessor I am asking myself "why did she love newlines so much?!". Basically every line of code is seperated by 5 newlines or so.
    I did once encounter code that was a little bit like that, with a mysterious wall of blank (and empty) lines. The fun bit was that removing any of the lines (in an otherwise ordinary file) made the code fail under test...
     

    Maybe it had a Whitespace program embedded in it.

     



  • Since you're using SPSS,  mott555 is closer than he realizes: 

    [quote user="mott555".. had to RUN any code, he'd highlight the section using the mouse and press F9.... Any codefile he worked on was riddled with odd whitespace and no two indentations were of the same depth. /quote]

    The crappy SPSS script editing/execution window (esp. if it gets lag-y) combined with Statistics-people's cargo-cult of black-magic incantations to get results like they did last time... par for the course. I feel your pain.

     



  • Sigh, I don't know what was / is worse:

    The joke of "syntaxeditor" of the older SPSS versions, which was simply notepad with no highlighting whatsoever or the newer one, which can do fancy thinks like text highlighting, but is so slow that you can see how it draws the characters on the screen.

    I have a looong inherited syntax file with 5000 LOC which simply choked my old computer and my new one is barely able to handle it (4 cores, 8gb of ram to display some text...). This is SPSS 19, which is full of enterprisey java. Newer versions are better, but I don't have them.

    Now the file is broken up in smaller parts, but I need a full blown python script the execute the files, because SPSS cannot handle relative file paths...



  • Edit -> Formatting -> Auto-Format. Done.

    Oh wait, let me guess, this shitty language has no IDE. Or the IDE is so shitty it doesn't auto-format.



  • IDE? Bwahaha!

    I use Notepad++ with a custom syntax definition file, so I can use highlighting. Before that, there where Notepad and Textpad...



  • @blakeyrat said:

    Edit -> Formatting -> Auto-Format. Done.
     

    I'm always amazed at how many of my students can't remember that this option exists in the IDE we use.  Even after reminding them several times, I still get programming submissions whose line indentations look like they were set by a random number generator.

    Granted, these are high school students, but it seems like the population of people working with code anywhere contains a significant fraction that don't seem to understand why the rest of us want the whitespace to follow some sort of consistent convention.

     


  • Winner of the 2016 Presidential Election

    I keep visible whitespace enabled and am kind of OCD about keeping it consistent. What drives me bonkers is that if someone edits a .js file with Visual Studio default settings, as soon as they type a semicolon or bracket, it reformats the ENTIRE FILE. They usually don't notice and it ends up committed. (And no, I can't fix it with another auto-format, it was done by hand.)



  • @joe.edwards said:

    (And no, I can't fix it with another auto-format, it was done by hand.)

    And that is their problem. Not yours. I see.



  • @HerrDerSchatten said:

    This is SPSS 19, which is full of enterprisey java.

     Try to revert to v16... or find a version of SPSS Server, so you can run from the CLI (and... to you detractors out there <you know who you are>,  in this case the editor-savefile-CLI-examineresults-rinse-repeat workflow is preferable to suffering with the IDE.)

    At least, by avoiding the scripting window - you'll be writing scripts that run from beginning-to-end, and you'll be able to reproduce your results - (apparently )unlike your co-workers.



  • @mott555 said:

    I once had an intern who didn't seem to understand the Delete or Backspace keys. If he had to remove any code, he'd highlight the section using the mouse and press Spacebar or Enter. Any codefile he worked on was riddled with odd whitespace and no two indentations were of the same depth.

    Former colleague of mine was always "erasing" the documents he did not need anymore by overwriting the content with spaces. Maybe they are related. Was your intern a black guy with a severe lisp?



  • @inori said:


    ... the population of people working with code anywhere contains a significant fraction that don't seem to understand why the rest of us want the whitespace to follow some sort of consistent convention.

    <FONT color=#810081>http://en.wikipedia.org/wiki/The_Elements_of_Programming_Style</FONT> 

    I have list of required reading/viewing for my children if they want to continue to receive water, food, and shelter.. This is on it. (As is Strunk and White's also useful version).



  • @Ronald said:

    @mott555 said:
    I once had an intern who didn't seem to understand the Delete or Backspace keys. If he had to remove any code, he'd highlight the section using the mouse and press Spacebar or Enter. Any codefile he worked on was riddled with odd whitespace and no two indentations were of the same depth.

    Former colleague of mine was always "erasing" the documents he did not need anymore by overwriting the content with spaces. Maybe they are related. Was your intern a black guy with a severe lisp?

    No, but he did come from a certain high-population Eastern country with a reputation for churning out mass quantities of low-quality developers.



  • @inori said:

    Even after reminding them several times, I still get programming submissions whose line indentations look like they were set by a random number generator.

    Next time you run the course, dock points for style errors. They'll quickly start paying attention.

    (I say this not entirely witihout sadism, but also because I've seen it work with first-year university undergrads.)


  • Winner of the 2016 Presidential Election

    @blakeyrat said:

    @joe.edwards said:
    (And no, I can't fix it with another auto-format, it was done by hand.)

    And that is their problem. Not yours. I see.


    Do you know of a Javascript editor that can handle long method chains, JSON parameters, and embedded closures in a sane way? Visual Studio is not that editor.



  • Unfortunately, we need some features auf 19, especially the programmabillity.

    The CLI argument is a good one, I think I will try that.


Log in to reply
 

Looks like your connection to What the Daily WTF? was lost, please wait while we try to reconnect.