Jump to content

  • Log In with Google      Sign In   
  • Create Account


Yiddish indentation

  • You cannot reply to this topic
32 replies to this topic

#1 Waterlimon   Crossbones+   -  Reputation: 2465

Like
15Likes
Like

Posted 01 October 2013 - 06:40 AM

                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


Sponsor:

#2 Bacterius   Crossbones+   -  Reputation: 8530

Like
7Likes
Like

Posted 01 October 2013 - 07:20 AM

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.


The slowsort algorithm is a perfect illustration of the multiply and surrender paradigm, which is perhaps the single most important paradigm in the development of reluctant algorithms. The basic multiply and surrender strategy consists in replacing the problem at hand by two or more subproblems, each slightly simpler than the original, and continue multiplying subproblems and subsubproblems recursively in this fashion as long as possible. At some point the subproblems will all become so simple that their solution can no longer be postponed, and we will have to surrender. Experience shows that, in most cases, by the time this point is reached the total work will be substantially higher than what could have been wasted by a more direct approach.

 

- Pessimal Algorithms and Simplexity Analysis


#3 mhagain   Crossbones+   -  Reputation: 7823

Like
0Likes
Like

Posted 01 October 2013 - 08:01 AM

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.


It appears that the gentleman thought C++ was extremely difficult and he was overjoyed that the machine was absorbing it; he understood that good C++ is difficult but the best C++ is well-nigh unintelligible.


#4 samoth   Crossbones+   -  Reputation: 4684

Like
0Likes
Like

Posted 01 October 2013 - 08:46 AM

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.



#5 Paradigm Shifter   Crossbones+   -  Reputation: 5255

Like
3Likes
Like

Posted 01 October 2013 - 08:50 AM

Indentation schmindentation. *shrugs*


Edited by Paradigm Shifter, 01 October 2013 - 08:51 AM.

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

#6 unbird   Crossbones+   -  Reputation: 4973

Like
0Likes
Like

Posted 01 October 2013 - 08:51 AM

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, 01 October 2013 - 08:57 AM.


#7 Paradigm Shifter   Crossbones+   -  Reputation: 5255

Like
7Likes
Like

Posted 01 October 2013 - 08:54 AM

?ykcirt etiuq ylbaborP


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

#8 l0calh05t   Members   -  Reputation: 690

Like
0Likes
Like

Posted 01 October 2013 - 09:09 AM

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.



#9 samoth   Crossbones+   -  Reputation: 4684

Like
5Likes
Like

Posted 01 October 2013 - 09:20 AM

 

?ykcirt etiuq ylbaborP

 

˙ʞuıɥʇ ʇɥƃıɯ noʎ sɐ ʎʞɔıɹʇ sɐ ʇou



#10 unbird   Crossbones+   -  Reputation: 4973

Like
3Likes
Like

Posted 01 October 2013 - 09:35 AM

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

#11 BGB   Crossbones+   -  Reputation: 1554

Like
0Likes
Like

Posted 01 October 2013 - 11:02 AM

 

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.



#12 l0calh05t   Members   -  Reputation: 690

Like
0Likes
Like

Posted 01 October 2013 - 11:48 AM

 

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;



#13 unbird   Crossbones+   -  Reputation: 4973

Like
0Likes
Like

Posted 01 October 2013 - 12:57 PM

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



#14 l0calh05t   Members   -  Reputation: 690

Like
1Likes
Like

Posted 01 October 2013 - 01:40 PM

If you are interested in the topic, this is one of the better (and simpler) explanations: http://www.iamcal.com/understanding-bidirectional-text/

 

And there's an xkcd comic about it http://xkcd.com/1137/ :D


Edited by l0calh05t, 01 October 2013 - 01:54 PM.


#15 unbird   Crossbones+   -  Reputation: 4973

Like
0Likes
Like

Posted 01 October 2013 - 02:39 PM

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



#16 ByteTroll   Crossbones+   -  Reputation: 1316

Like
0Likes
Like

Posted 01 October 2013 - 08:04 PM

This + Hungarian notation...


▬▬▬▬▬▬▬▬▬▬▬ஜ۩۞۩ஜ▬▬▬▬▬▬▬▬▬▬▬▬▬
I see the future in 1's and 0's
▬▬▬▬▬▬▬▬▬▬▬ஜ۩۞۩ஜ▬▬▬▬▬▬▬▬▬▬▬▬▬

"This is called programming. The art of typing shit into an editor/IDE is not programming, it's basically data entry. The part that makes a programmer a programmer is their problem solving skills." - Serapth

#17 Hodgman   Moderators   -  Reputation: 29497

Like
6Likes
Like

Posted 01 October 2013 - 08:20 PM

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.

#18 TheChubu   Crossbones+   -  Reputation: 4100

Like
0Likes
Like

Posted 01 October 2013 - 08:50 PM

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, 01 October 2013 - 08:51 PM.

"I AM ZE EMPRAH OPENGL 3.3 THE CORE, I DEMAND FROM THEE ZE SHADERZ AND MATRIXEZ"

 

My journals: dustArtemis ECS framework and Making a Terrain Generator


#19 JohnnyCode   Members   -  Reputation: 229

Like
0Likes
Like

Posted 03 October 2013 - 12:36 PM

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.



#20 Servant of the Lord   Crossbones+   -  Reputation: 18498

Like
3Likes
Like

Posted 03 October 2013 - 02:18 PM

                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.
It's perfectly fine to abbreviate my username to 'Servant' rather than copy+pasting it all the time.
All glory be to the Man at the right hand... On David's throne the King will reign, and the Government will rest upon His shoulders. All the earth will see the salvation of God.
Of Stranger Flames - [indie turn-based rpg set in a para-historical French colony] | Indie RPG development journal

[Fly with me on Twitter] [Google+] [My broken website]

[Need web hosting? I personally like A Small Orange]






PARTNERS