Sign in to follow this  
Waterlimon

Yiddish indentation

Recommended Posts

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.

Share this post


Link to post
Share on other sites
unbird    8336
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 ) Edited by unbird

Share this post


Link to post
Share on other sites
l0calh05t    1796

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.

Share this post


Link to post
Share on other sites
unbird    8336

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

Share this post


Link to post
Share on other sites
cr88192    1570

 

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.

Share this post


Link to post
Share on other sites
l0calh05t    1796

 

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;

Share this post


Link to post
Share on other sites
unbird    8336

*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 ?

Share this post


Link to post
Share on other sites
TheChubu    9449

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.

Edited by TheChubu

Share this post


Link to post
Share on other sites
JohnnyCode    1046

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.

Share this post


Link to post
Share on other sites

                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.

Share this post


Link to post
Share on other sites
wintertime    4108

I thought I had read on some MS blog that the hungarian name is not related to where an engineer came from, but that one of the first other engineers who got it shown spoke out that it would look like hungarian.

Share this post


Link to post
Share on other sites
Cornstalks    7030

                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.

 
Pfft. What is this? Allman-Yiddish style? I prefer KY style (K&R-Yiddish):
                int foo(float durr) {
            if (durr < 1.0f) {
        int resolt=0;
    for (int i=0; i<10; ++i) {
resolt += durr;
    }
            } else {
        return 0;
            }
            return resolt;
                }

// Or if you wanted to omit optional braces:

                int foo(float durr) {
            if (durr < 1.0f) {
        int resolt=0;
    for (int i=0; i<10; ++i)
resolt += durr;
            } else
        return 0;
            return resolt;
                }
Also, am I the only one who noticed that resolt goes out of scope before the return statement? And that the for line is inconsistently indented?

Share this post


Link to post
Share on other sites
unbird    8336

Thanks AzureBlaze. And that source snippet looks awesome. Funny how one can still make sense out of it without knowing any Kanji. Chinese puzzle for developers wink.png

 

Hmmm, does that compile ? Looks like the return variable is out of scope.

Edited by unbird

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this