Skip to main content
GameDev.net gamedev.net
🔒 Locked

Yiddish indentation

Started by Waterlimon Oct 1, 2013 at 12:40 PM 29 replies 10.2k views
Original Post
Waterlimon
Waterlimon

                int foo(float durr)
                {
            if (durr < 1.0f)
            {
        int resolt=0;
    for (int i=0; i<10; ++i)
    {
resolt += durr;
    }
            }
            return resolt;
                }

This is the best thing since hungarian notation!

As you can see it highlights the algorithms and hides the completely useless structural code.

No nobody has probably ever used this and i just made it up.

o3o
Bacterius
Bacterius

Woah, that is incredibly difficult to scan. I am tempted to write a script to align source code to "Yiddish" reverse indentation and run it on a teammate's projects folder.

“If I understand the standard right it is legal and safe to do this but the resulting value could be anything.”
21st Century Moose
21st Century Moose

This is one of my favourites, mainly because it's totally possible to see someone coming out with it as a valid reason for justifying an annoying indentation style.

Direct3D has need of instancing, but we do not. We have plenty of glVertexAttrib calls. 
samoth
samoth

Oi, I'm Yiddish! No, I'm kidding, but surprisingly I don't find it too hard to read at all.

Only downside I see is that you have to know how many scopes you'll have inside a function before you start writing it. Or, you must re-indent the whole function all the time. That'd be a nightmare to use with a revision control system, which typically diffs and highlights all changed lines.

Paradigm Shifter
Paradigm Shifter

Indentation schmindentation. *shrugs*

"Most people think, great God will come from the sky, take away everything, and make everybody feel high" - Bob Marley
unbird
unbird
It does look funny. But let's look at it from the other point of view. I wonder how easy it is for people used to right-to-left writing to read and write source code in "established" style, which is left-to-right and as far as I encountered mainly English (language keywords, identifiers). Could someone using right-to-left languages please comment on that ?

(To take it further: Imagine a world where all programming languages are written in Kanji or something wink.png )
Paradigm Shifter
Paradigm Shifter

?ykcirt etiuq ylbaborP

"Most people think, great God will come from the sky, take away everything, and make everybody feel high" - Bob Marley
l0calh05t
l0calh05t

It does look funny. But let's look at it from the other point of view. I wonder how easy it is for people used to right-to-left writing to read and write source code in "established" style, which is left-to-right and as far as I encountered mainly English (language keywords, identifiers). Could someone using right-to-left languages please comment on that ?

(To take it further: Imagine a world where all programming languages are written in Kanji or something wink.png )

I'd be interested in the answer to that as well. Especially considering that some languages are adding unicode support, which means that suddenly there might be changes in direction because an identifier is in a right to left script (which can then also affect punctuation characters surrounding it!). Yikes.

samoth
samoth

?ykcirt etiuq ylbaborP

??u??? ????? no? s? ?????? s? ?ou

unbird
unbird

I'd be interested in the answer to that as well. Especially considering that some languages are adding unicode support, which means that suddenly there might be changes in direction because an identifier is in a right to left script (which can then also affect punctuation characters surrounding it!). Yikes.

Yikes indeed: Multicultural programming


foreach(var ??? in ??????)

Preemptive apology. I just used Google translate, so I hope I did not Insult anybody's mother here
cr88192
cr88192

I'd be interested in the answer to that as well. Especially considering that some languages are adding unicode support, which means that suddenly there might be changes in direction because an identifier is in a right to left script (which can then also affect punctuation characters surrounding it!). Yikes.

Yikes indeed: Multicultural programming


foreach(var ??? in ??????)
Preemptive apology. I just used Google translate, so I hope I did not Insult anybody's mother here

IME, at least in code I have seen, usually people seem to use ASCII characters for the code proper, but use non-ASCII characters mostly in comments and string literals, even with a lot of the common languages supporting non-ASCII identifier names.

otherwise, yeah, reminds me a few times in dealing with code written by a newbie, and trying to explain the merits of keeping things properly indented (not any specific style, just having the indentation of contained code being greater than that of surrounding code would be a start, stuff was generally indented by fairly random amounts, ...).

like, they couldn't find some bugs because their braces were messed up, which is something which is generally a lot more obvious if things use a sensible indentation style.

l0calh05t
l0calh05t

I'd be interested in the answer to that as well. Especially considering that some languages are adding unicode support, which means that suddenly there might be changes in direction because an identifier is in a right to left script (which can then also affect punctuation characters surrounding it!). Yikes.

Yikes indeed: Multicultural programming


foreach(var ??? in ??????)
Preemptive apology. I just used Google translate, so I hope I did not Insult anybody's mother here

Also very fun:

int ??? = 0;

unbird
unbird

I first thought it was some cabbalistic pun, but now I get it. Yeah, try to write a parser which figures out reading direction dynamically :P

unbird
unbird

*gosh*. I really feel embarrassed now about my ignorance of the complexity, so thanks for that link.

Still would be glad to hear some answers to my question: Nobody had any troubles learning programming because of clashing reading directions ?

Datamancer
Datamancer

This + Hungarian notation...

"The code you write when you learn a new language is shit.
You either already know that and you are wise, or you don’t realize it for many years and you are an idiot. Either way, your learning code is ob
Hodgman
Hodgman
Mandatory rant:
This is Hungarian notation:
int numWidgets;
uint rowOffset, colOffset;
float xPos, yPos;
long sizeBytes;
This is not Hungarian notation; this is a MS bastardisation known as "systems Hungarian":
int iWidgets;
uint uiRow, uiCol;
float fx, fy;
long dwSize;
Hungarian is good. MS Systems Hungarian is the one that is oft derided.
TheChubu
TheChubu

First, what Hodgman said (I'm a fan of xPos and yPos, and tmpSomething) , second, waiting for related link on xyz study that found that Yiddish notation is x% easier to read than Allman style in zyx cases.

"I AM ZE EMPRAH OPENGL 3.3 THE CORE, I DEMAND FROM THEE ZE SHADERZ AND MATRIXEZ"   My journals: dustArtemis ECS framework and 
JohnnyCode
JohnnyCode

m_pCurrNode (a member variable of a class pointer datatype- current node), that is the notation I use in my hobby projects. wub.png If you tell me name of any not local variable of my project to me, I will tell you everything about it.

Servant of the Lord
Servant of the Lord


                int foo(float durr)
                {
            if (durr < 1.0f)
            {
        int resolt=0;
    for (int i=0; i<10; ++i)
    {
resolt += durr;
    }
            }
            return resolt;
                }



Oh, you must use the waterfall model of development! biggrin.png

Mandatory rant:
This is Hungarian notation:

int numWidgets;
uint rowOffset, colOffset;
float xPos, yPos;
long sizeBytes;
This is not Hungarian notation; this is a MS bastardisation known as "systems Hungarian":
int iWidgets;
uint uiRow, uiCol;
float fx, fy;
long dwSize;
Hungarian is good. MS Systems Hungarian is the one that is oft derided.


Oh good, you saved me the trouble of leaping to the real hungarian-notation's defense!

As an aside, both the original proper hungarian notation (also known as "Apps Hungarian") and the butchered version that stole the lime-light ("Systems Hungarian") were popularized at Microsoft - they deserve credit for both, not just the bad version.

Apps Hungarian, the good one, was used to good effect by the Microsoft application development team who worked on Microsoft Excel and Word.
Later, it spread and got confused in the Microsoft operating system development team, (hence, "Systems" Hungarian), where it later spread out via the API's documentation as the "good practice" that isn't.

At least, that's what I've heard.

Wikipedia says that the 'hungarian' part of the name comes from the skilled engineer who created it (while at Xerox) and promoted it in the application team when he worked at Microsoft.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.