• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[JASS] Have I gone mad?

Status
Not open for further replies.
Level 13
Joined
May 11, 2008
Messages
1,198
Over at thehelper.net...
people are CONSTANTLY complaining that i am not indenting my code.

but the truth is, i dislike whitespace a lot.

you indent a huge trigger, and ask me to read it...it'll take me forever to get through it because of the whitespace(all those indents).

so what i do is i do ctrl h to replace all the 4 spaces with nothing.
that takes care of most of the problem. not really a big deal.

anyway...i feel like i'm being oppressed over there because everytime i try to post some code, i get like 4-5 people or so responding that they hate my lack of indenting.

but for me...when you take out all those indents...your eyes don't wander all over the screen looking for the words. all the lines of coded text are all lined up. whereas indented code leaves your eyes moving around jaggedly and zigzaggedly...and it simply takes longer to read.

i like to read, i find it fun. maybe i have such a problem with whitespace because i read a lot of books and most of the other coders don't? i don't know.

but what i'd like to know is...do you guys think i'm crazy? i'm just curious.
i'm asking for your opinion, so be honest.

here at hiveworkshop.com, things are different...
there are more and better options for displaying code, for example. you can post trigger code, jass code, and regular code. but at thehelper.net, there are two display styles for the site. one is white everywhere, and it gets sickening to the eyes to read stuff for too long there. the other one is more of a grey and red theme. i use the grey and red display style. but, the problem is, pretty much everyone there uses jass boxes...and when you try to read their code in those boxes...it's really hard.

alot of the text is invisible, you have to highlight it...and when you highlight the text you can't scroll at the same time. it's frustrating, so i usually end up quoting the text and putting it in a textfile so i can read it...or sometimes i do deal with it and highlight it to find the invisible words, and then memorize them as i read the rest of the text. when you highlight, everything turns into bright colors, like white and bright green. so i just highlight it long enough to read the invisible words and then i memorize them and read the rest of the code. this is what i do, and i generally don't complain.

but these guys have the nerve to complain constantly about my lack of indenting. i mean, seriously, sometimes i feel like some of them are just following me around posting that, as if they think i'm going to do what they ask when they ask me to indent my code.

why don't they get the hint? and, am i crazy for not submitting to them? am i crazy if i do what they ask? if i don't want to do it, why should i? isn't it kindof like having sex, like if the girl you like doesn't like you, she doesn't have to right? isn't it the same thing with what i type up? i guess so...it's just weird that they won't let me hear the end of it.
 
Level 10
Joined
Nov 28, 2008
Messages
655
because:
JASS:
public static void main(String [] args)
{
    int a = 1;
    int b = 2;
    String s = new String("");
    
    for(int i = 0; i < 5; i++)
    {
        int c = a + b;
        if(c > 2)
        {
            s = "OMG!";
        }
        else
        {
            s = "ZOMG!";
        }
     } //End of For
} //End of main()
is MUCH easier to read than:
public static void main(String [] args)
{
int a = 1;
int b = 2;
String s = new String("");

for(int i = 0; i < 5; i++)
{
int c = a + b;
if(c > 2)
{
s = "OMG!";
}
else
{
s = "ZOMG!";
}
} //End of For
} //End of main()


//*****************************

it is non-sense Java, BUT, you get the point.

It is much easier to read when formatted correctly...
 
Level 14
Joined
Nov 18, 2007
Messages
1,084
Mainly indenting code is a standard and as tagg1080 has mentioned, it can be much easier to read indented code.
If you want to submit something public without receiving complaints, just indent for the benefit of other people.
You may find it easier to read without indentations, but I think most people will find otherwise especially in a code that contains nested conditionals.

To further illustrate this with a freehanded code:
JASS:
loop
set i = i +1
if IsUnitEnemy(u,GetOwningPlayer(cast)) then
if IsUnitType(u,UNIT_TYPE_SUMMONED) then
call KillUnit(u)
elseif GetWidgetLife(u) > 0.405 then
call DisplayTextToPlayer(Player(0),0,0,"This unit is not a summoned unit, but at least it's  alive. =D")
endif
if IsUnitInGroup(u,g) then
call GroupRemoveUnit(g,u)
else
call GroupAddUnit(g,u)
endif
endif
exitwhen i == 5
endloop
Before looking at the code below, try to note what conditional IsUnitInGroup(u,g) is nested in.

JASS:
loop
    set i = i +1
    if IsUnitEnemy(u,GetOwningPlayer(cast)) then
        if IsUnitType(u,UNIT_TYPE_SUMMONED) then
            call KillUnit(u)
        elseif GetWidgetLife(u) > 0.405 then
            call DisplayTextToPlayer(Player(0),0,0,"This unit is not a  summoned unit, but at least it's alive. =D")
        endif
        if IsUnitInGroup(u,g) then
            call GroupRemoveUnit(g,u)
        else
            call GroupAddUnit(g,u)
        endif
    endif
    exitwhen i == 5
endloop

My own thoughts on indenting is that it helps to see what functions belong to which place. Ex: It's much easier to tell which conditionals are nested.
 
Level 13
Joined
May 11, 2008
Messages
1,198
i find it harder to type indented code, and harder to read it.

i can understand that maybe it's more obvious for lots of ifs what is in what ifs...but i think it's obvious enough without the indenting.
i mean...if it's all in a line...you can read from top to bottom, can't you?
i know i can. maybe that's the problem. people don't know how to read vertically.

Everyone at thehelper.net is right, and if you post un-indented code here I'll complain too.

actually i've been at this site longer than i've been at thehelper.net
although i used to go to thehelper.net everyonce in a while from a google search before i became a member.

at any rate, the people here are always nicer than over there. but over there they respond a lot faster so usually i can get questions answered faster when i ask them over there, so i tend to post more often over there. but i still like it here better.

i can understand some complaining, that's normal, but they really chew me out over there and i don't think it's natural.
 
Level 40
Joined
Dec 14, 2005
Messages
10,532
I can bash myself over my head with the rusty nail-filled board that is reading unindented code, but I'd rather not. Just because you can do something (like read unindented code) doesn't make it as easy nor does it mean you should.

I disagree with TH on most points, but I doubt anyone disagrees with them here.
 
Last edited:
Level 7
Joined
Jul 18, 2009
Messages
272
i like to read, i find it fun. maybe i have such a problem with whitespace because i read a lot of books and most of the other coders don't? i don't know.
Well, I really like reading. I even read Robert Jordan's Wheel of Time on my computer (due to a lack of money for books). Before you ask, that's around 15000 pages of pdf.
And in my opinion, coding has not much to do with normal reading. It's more like math+grammar.

at thehelper.net, there are two display styles for the site. one is white everywhere, and it gets sickening to the eyes to read stuff for too long there. the other one is more of a grey and red theme. i use the grey and red display style. but, the problem is, pretty much everyone there uses jass boxes...and when you try to read their code in those boxes...it's really hard.
I have no idea what you are talking about. The Jass boxes on theHelper look exactly the same as the do here on Hiveworkshop.

alot of the text is invisible, you have to highlight it...and when you highlight the text you can't scroll at the same time. it's frustrating, so i usually end up quoting the text and putting it in a textfile so i can read it...or sometimes i do deal with it and highlight it to find the invisible words, and then memorize them as i read the rest of the text. when you highlight, everything turns into bright colors, like white and bright green. so i just highlight it long enough to read the invisible words and then i memorize them and read the rest of the code. this is what i do, and i generally don't complain.
I have never ever seen an invisible word in any Jass code. Maybe something is wrong with your monitor or your browser? Or please show me an example for this "invisible code".

i find it harder to type indented code, and harder to read it.
I think it's exactly the other way around...

i can understand that maybe it's more obvious for lots of ifs what is in what ifs...but i think it's obvious enough without the indenting.
Look at watermelon's post. If you tell me the structure of that trigger is obvious without indenting, you are either crazy or a genius (or both).

i mean...if it's all in a line...you can read from top to bottom, can't you?
i know i can. maybe that's the problem. people don't know how to read vertically.
Appearantly not. So couldn't you just use indenting when posting in a forum, to be nice to the other programmers?

wow...that's really how they view it?

ok, case closed....i'm NOT the insane one on the internet! thanks for the insight, mate.
Now how the hell did you come to THAT conclusion? Everyone tells you you are wrong, and what you conclude from it is "not I am crazy, but every one else on the whole internet is"? lol
 
Level 40
Joined
Dec 14, 2005
Messages
10,532
wow...that's really how they view it?

ok, case closed....i'm NOT the insane one on the internet! thanks for the insight, mate.
Uuh, the only useful way to define insanity is extreme deviation from the norm with regards to thoughts and in general mental function, so if anyone is insane it's you by definition.

Really, indenting is necessary for complicated scripts, even if it may not be for linear stuff.
 
Level 10
Joined
Nov 28, 2008
Messages
655
In my Java class, one of the assignments required us to to pass a class definition as a parameter... (just to see that it is possible, not to get into that habit...)


I would LOVE to see how that looks with no indentation.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,287
Code indentation is to allow one to easilly keep track of the scope of structres. If you do not like indentation, use assembly as that has none worth mentioning.

Try making a 3000 line program without indentation, waiting 2 years and then extending it... You will need hours just to remember where each loop or condition leads and does. Additionally comments also help.

In languages like python, indentation is manditory.
 
If you like to code without indentation. That is fine. Whatever works for you. But it is a bit harder to read for others.

So instead, download JASSCraft. Go to Jass -> Indent Text and bingo it is done. (Except it doesn't support vJass, so it might f'up the indenting for the rest if you paste structs/methods/some other vJASS containers in there)

here at hiveworkshop.com, things are different...
there are more and better options for displaying code, for example. you can post trigger code, jass code, and regular code. but at thehelper.net, there are two display styles for the site. one is white everywhere, and it gets sickening to the eyes to read stuff for too long there. the other one is more of a grey and red theme. i use the grey and red display style. but, the problem is, pretty much everyone there uses jass boxes...and when you try to read their code in those boxes...it's really hard.

People will always get angry of non-indentation. You can't really avoid it. =)

At TH btw, you can post all those as well. The second theme is just there for fun, it was developed but doesn't support the jass tags. There was actually a discussion about new themes a long time ago, but everyone loved theHelper's normal theme because it pleased the eye. (I agreed) It just looks nice, neat, and has enough contrast.

alot of the text is invisible, you have to highlight it...and when you highlight the text you can't scroll at the same time. it's frustrating, so i usually end up quoting the text and putting it in a textfile so i can read it...or sometimes i do deal with it and highlight it to find the invisible words, and then memorize them as i read the rest of the text. when you highlight, everything turns into bright colors, like white and bright green. so i just highlight it long enough to read the invisible words and then i memorize them and read the rest of the code. this is what i do, and i generally don't complain.

You should list that in the bugs & features forum. It definitely wasn't intentional. =) Also, you can just post it in a tool like JASSCraft or NewGen if you want to see it more clearly for the time being.

----
Overall though, I'm sure everyone is just telling you to indent so they can help you more easily. For others, it can determine whether or not they want to help you at all, because what's the point in helping if you can't read it? It is like viewing a thread on an English forum and reading german. =P As watermelon said, there are times where it is really confusing when there is no indentation, such as nesting pretty much anything.
 
Level 13
Joined
May 11, 2008
Messages
1,198
well, for the time being i actually changed the display style of posts from original post first to the default that getdota/playdota or whatever the site is uses...which is most recent posts first.
that combined with the terribly bright snowy theme seems to work out, somehow.

lots of good points, guys, and thanks for the ideas, PurgeandFire111

i have decided to basically indent my code whenever i feel it's necessary, which is rarely. pretty much only when i want to submit a resource...
that way, i guess it doesn't hurt anyone. i mean, you gotta figure if i have to add comments anyway, i might as well add in some indents.

still, i think about things very philosophically, for example:
i think they have a lot of nerve complaining about me not indenting code when a lot of other coders don't even share their code...in fact lots of good coders protect their maps and you can't access their code at all.

if unindented code is something cryptic for people, i feel sorry for them. if it's how you say, then it's not my fault they're not geniuses...i just thought it meant they were retarded...
but if you want my honest opinion...i don't think i'm a genius at all.
i think i'm just a smart guy WHO EATS HIS VEGETABLES!

edit: another thing i was just thinking...WHY DON'T PEOPLE USE THE TREE THINGY ON THE LEFT SIDE?? I don't use it because i find it unnecessary and takes up extra space, same goes for the line count numbers, but i think the tree thing would help them read code that isn't indented...
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,287
Honestly, your argument for not indenting code is flawed and lacking.

Indenting easilly allows you to find the end and start of various structures without having to count each endif or endloop. Imagine if you have a dozen conditional statements in a row (for some reason). Each has like 20 to 50 lines of code in them. The result is a jumbled mess where you actually must stop and note mentally where each conditional statement starts and ends which takes time. Nested structures make this worse and worse as you then have to keep track of what tier in the execution code is.

With indented code you can imediatly gauge where stuff starts and ends without having to think. You can easilly see where tiers start and end as well. All you need to make a note of is what the cause of the different tiers are, which you had to do with the above method as well as actually noticing when they end.

If you are dumpped a 500 line long block of code, it is far easier to understand it with indentation than without. Yes if you go through it line by line you will get an idea but with indentation you can literally grab the scroll bar and slide it down and completly understand the flow of the program.
 
Level 13
Joined
May 11, 2008
Messages
1,198
If you are dumpped a 500 line long block of code, it is far easier to understand it with indentation than without. Yes if you go through it line by line you will get an idea but with indentation you can literally grab the scroll bar and slide it down and completly understand the flow of the program.

i don't think so. first of all...500 line long block of code is quite variable.
when people scroll through indented code, it's a lot more scrolling. there's a lot more to read. it just takes longer to read everything because everything's spread out all over the interface instead of being there in a line, where you can see it all.

maybe the reason i don't stop is because i automatically count everything anyway. like when i'm observing a game and i go off and do whatever...i listen to the messages sent by the players and mentally note how many messages they send. i even note the frequency. if my brain does so much counting automatically where everyone else has to stop to count...then it only makes sense not to clutter up my interface with excessive scrolling and line numbers and so on.

imagine my situation. i try to read the text and it's all over the screen instead of predictably in order. i can take in alot more information on every page scrolled through because i have to look at less of the screen, i can go through the code much faster. if you don't get it, think of it this way.
JASS:
i
    m
        a
            g
                  i
                      n
                          e

                               t
                                   h
                                        a
                                            t

                                        t
                                        h
                                        i
                                        s
could be written...like
imagine that this
isn't it much faster to type what i just typed?
i know it's an exaggeration, but sometimes you have to exaggerate to make a point.

isn't
    it 
    much 
        faster 
            to 
                type 
            what
            i 
        just 
   typed?

i 
    know
    it's 
        an 
            exaggeration, 
            but 
            sometimes 
        you 
        have 
    to 
exaggerate 

to 
    make 
    a 
point.

was the way indented code looked to me. i find it incredibly annoying.
the thing is...what i put in that jass box was just english. i'm sure all of us were able to read it ok. but i'm pretty sure everyone found the normal english strings easier to read, if only minimally.

what we're talking about is what someone would prefer.

i prefer code without whitespace. or at least, minimal whitespace. others, prefer huge ammounts of whitespace so that they can have different parts of the code separated from eachother. whereas i want to read the entire code as fast as possible.

that's why indenting jass style of 4 spaces is ridiculous for me. it slows down the reading process.

one more thing...(this last bit directed at purplepoot)...i would never have learned as little programming as i have if i didn't decide to do things my own way when it came to learning it...and i would never have gotten this far if i had just tried to read others' code the way they wrote it, without modifying their documents...

maybe it makes me the mentally handicapped person... but i don't recognize that you are right when you call learning how to do something a different way counterproductive.

i dislike Dr Super Good's posts in this thread. he's really annoying. he keeps calling out, you this, and you that, when what he's saying is completely false.
 
Last edited:
Level 13
Joined
May 11, 2008
Messages
1,198
another thing, dr super good...i looked at assembly code examples and i see indents...what're you going on about?

Your analogy fails because English is linear, while code is not. It works all fine and good until you add control structures, but then it falls apart.

blizzard or vexorian or whoever...the master programmers who coded my editor made allowance for no indents...so i don't know what you mean about my code falling apart.
 
Level 7
Joined
Jul 18, 2009
Messages
272
blizzard or vexorian or whoever...the master programmers who coded my editor made allowance for no indents...so i don't know what you mean about my code falling apart.
He meant your analogy is falling apart, not your code.

But the thing is: You seem to be able to read code like it was a normal language. The only problem is: most people aren't able to do that.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,287
SanKakU, I advise learning python. That language has indents are part of the syntax and you will see a use of them other than athetic.

Assembly code is not intented cause there is no need to. The only times it is indented is for syntax reasons. Just run a bytecode decompiler on an opensource .exe file and see how it just appears as a list of instructions. Ofcourse you can get relationships generated via analisis but sure as hell, there will be no indentation as there are no structures which will be easier to understand with it.

You obviously have not done graph analisis in primary school. I start by asking, why are graphs easier to do certain opperations on (like compairing) than a table of numbers? The answer is because you can visually analise it instead of having to compare values which you extract from it.

With indentation you imediatly know where a if statmenet or loop statment ends its code. Without you actually have to read until you find the exit for the structure which is slower. Additionally because a visual pattern is generated by the line indentation, it is easier to keep track of where you are in the code as the pattern seldom repeats itself exactly so you can easilly tell if you were recently at a piece of code (even line numbers are slower as you have to keep reading them until you find the exact number and they require lossless memorization (a pattern is easier to remember than a number). These are pretty much the reasons behind code indentation next to if the language syntax requires it.

To recap, it makes telling the scope of structures more easy. It also breaks the code down into more managable and easier to farmiliarise chunks so you waste less time finding where you are or are after being.

I am aware that in JASS that certain end strucutres like endif and endloop have such a noticable length that you can guide yourself from them. It still is not as good as just using the indented code.

Honestly, if a tab or delete here and there is too much work for you, why are you programming? JNGP will automatically indent your code to that of the previous line for you and converts tabs into 4 spaces.

If you are having problems, write a converter. The rules behind jass indentation are so logical you could pretty much auto indent whole map scripts just by looking for lines containing endif, endloop, *then, loop and function*. (vJASS will need additional things to recognize)
Removing indentation for your personal reasons is also as easy. You just remove spaces in groups of 4 from the start of every line until no more can be removed.
 
Level 2
Joined
May 11, 2010
Messages
7
Indentation is more or less required when writing public code.

As for me I find unindented code just as easy to read as indented, although if you're posting code for usage or review you should adapt to what people want and don't want.
And as this thread clearly states, people obviously wants indented code.

Although, I don't see why most people uses 4 spaces for indenting, 2 spaces suffices quite well and writing code where TAB isn't usable goes alot faster as well.

Also, if you at some point want to learn Python, don't bother.
 
Last edited:
Level 4
Joined
May 17, 2005
Messages
94
Not indenting code feels fine when actively building small blocks of code. Indentation is all about being able to get intuition for unfamiliar code quickly. This holds true even for projects that are yours; when i first started using Jass, I didn't indent all that well, but I quickly found that maintaining my old code was a nightmare. The moment code that you built leaves your active memory, you start wishing that you had those indents.

still, i think about things very philosophically, for example:
i think they have a lot of nerve complaining about me not indenting code when a lot of other coders don't even share their code...in fact lots of good coders protect their maps and you can't access their code at all.
Let's then look at this from a likely perspective of a board.

Boards have certain basic posting standards, and they expect the users to be the ones to hold to their formatting standards, since it would be impractical for staff to format everything that comes in.
By disregarding this basic expectation, you're basically telling the board that you don't care. In doing so, you are both offending the board and convincing them that your post is spam and thus obstructive.

So, back to the point about them having the "nerve" to complain...
From this point of view, claiming a moral high ground over non-posters is claiming that posting content which obstructs a forum is better than not posting at all.


Furthermore, you're using relative standards when you point out this "nerve" that a forum has: you're claiming that the "evil" (posting icky code) that you commit is acceptable because, supposedly, greater "evil"s (not posting at all) are being commited. A similar sort of fallacious argument could be used to justify theft because, after all, people have done worse, such as murdering people.
 
Level 4
Joined
May 17, 2005
Messages
94
wow. so basically you're telling me i'm a forum criminal?
No. I'm telling you that, rule or not (it's true that it's not a written rule, yes, but it is a community expectation, as evidenced by the complaints), people using or managing a forum are likely to not take code submissions seriously until they are indented. Furthermore, that there are arguments which, in the eyes of said forum users or managers, are quite valid for not taking such submissions as seriously.
The word spam is unfortunately connotated in such a way that it was probably stronger than I intended.


Furthermore, I used the criminal metaphor to demonstrate the invalidity of the form taken by your argument about people having "nerve", not to specifically call you a criminal.



In sum: I'm not calling you anything, merely pointing out what seems to be going on.
 
Sankaku, I get the feeling like you're totally trolling. The reason so, is because you took personal offense to what uberfoop was saying even though what he said has nothing to do with why people indent scripts.

If you don't see why we indent scripts for the purpose of syntactical continuity, then you're trolling. This is not a debatable subject, especially based on the clear descriptions you have been given - especially from the good knowledge bank of Dr. SuperGood.

You feel offended by what SuperGood said, even though he's been the most helpful person in this thread and has given some extremely good information. Why? Read what he wrote again. Notice the utter lack of hostility in what he's written.

i dislike Dr Super Good's posts in this thread. he's really annoying. he keeps calling out, you this, and you that, when what he's saying is completely false.

I take that back. You are a troll. I request this thread be closed.
 
LOL-I-TROLL-YOU.png


I think that about sums up this thread.
 
Level 6
Joined
Oct 10, 2009
Messages
1,426
^^^epic drawing bro

edit: and while im here, let me give you a line from the Triggers&Scripts Forum Rules
PurplePoot said:
Questions related to the fixing (and ONLY fixing) of GUI triggers, JASS scripts and AI go here. Threads regarding the creation of a trigger, how-to-do-this-type, go on the World Editor Help Zone, as do general World Editor-related questions.

it doesnt even mention Threads about people whining... so this thread really has no place in the modding section:)
'nuff said
 
Status
Not open for further replies.
Top