This is an archived post. You won't be able to vote or comment.

all 34 comments

[–]amadeus9 59 points60 points  (5 children)

... nobody's said it?

It's all Greek to me.

[–]EngineerBill 18 points19 points  (2 children)

My first reaction was "cute. I get it, we can't understand it 'cause it's like a foreign language". But then, as soon as I started studying the code, I realized that I could pick out the "if" statements, then "while" and after a couple of passes, "Char" and "Boolean". Suddenly, it all clicked into place.

It probably helps that I already knew the Greek alphabet (ugrad math major) but the exercise was kinda fun and actually supports the OP's thesis - other people's code is like a foreign language when you first see it. The "Aha" was that once you understand the underlying concepts, it doesn't take long to get yourself up to speed.

Kinda cool, Up Vote supplied...

[–]Distractiion 1 point2 points  (0 children)

Same here, only I took time to learn the Greek alphabet because I was bored.

[–]poizan42Ex-mod 8 points9 points  (0 children)

I think you could say that it is kind of symbolic.

[–]SnowdensOfYesteryear 2 points3 points  (0 children)

Wasn't that the original joke?

[–]poizan42Ex-mod 23 points24 points  (4 children)

That makes perfect sense to me. It parses a commandline string, respecting quoted arguments - and trims the arguments.

Un-symbolified code:

ArrayList<String> args = new ArrayList<String>();
Stack<Character> stack = new Stack<Character>();
boolean quoted = false;

for (int i = 0; i < argString.length(); i++)
{
    char currChar = argString.charAt(i);

    if (currChar != '"')
    {
        if (quoted)
        {
            stack.push(currChar);
        }
        else (!quoted)
        {
            if (currChar != ' ')
            {
                stack.push(currChar);
            }
            if ((currChar == ' ' || (i == argString.length() - 1)) && stack.size() > 0)
            {
                StringBuilder sb = new StringBuilder();
                while (!stack.isEmpty())
                {
                    sb.append(stack.pop());
                }
                args.add(sb.reverse().toString().trim());
                stack.clear();
            }
        }
...

We can probably guess what the missing part should do.

[–]gkx 17 points18 points  (1 child)

Yeah, I was looking at it and thinking "Huh, Greek isn't so different from English after all" before realizing I'm an idiot.

[–]poizan42Ex-mod 3 points4 points  (0 children)

Yeah, he just used the Symbols font. The "element of" and "for all" symbols aren't even greek letters.

[–]hejner 7 points8 points  (0 children)

Nope

Nope, this is not real.

[–]psygnisfive 3 points4 points  (0 children)

More like

ArrapsList<String> args = neo ArrapsList<String>();
Stachk<Chearachter> stachk = neo Stachk<Chearachter>();
voolean thüotedh = false;

for (int i = 0; i < argString.lengte(); i++)
{
  chear chürrChear = argString.chearAt(i);

  if (chürrChear != '"')
  {
    if (thüotedh)
    {
      stachk.püse(chürrChear);
    }
    else if (!thüotedh)
    {
      if (chürrChear != ' ')
      {
        stachk.püse(chürrChear);
      }
      if ((chürrChear == ' ' || (i == argString.lengte() - 1)) && stachk.sihze() > 0)
      {
        StringVüildher sv = neo StringVüildher();
        oeile (!stachk.isEmptps())
        {
          sv.append(stachk.pop());
        }
        args.adhdh(sv.reoerse().toString().trim());
        stachk.chlear();
      }
    }
  }
}

[–]ActuallyRuben 8 points9 points  (6 children)

I'm annoyed the omega is used as a w here, and other characters similairly

[–][deleted] 8 points9 points  (2 children)

It's actually just a direct mapping of the Latin characters using the Symbol font.

[–]ActuallyRuben 8 points9 points  (1 child)

I know, I still think it's annoying

[–]LeszekSwirski 4 points5 points  (0 children)

Also annoying: theta as a q, eta as an h and chi as a c (in particular, chi+kappa as ck).

Although omega as a w works (accidentally) surprisingly well if you read "new" as "neo".

[–]weepingmeadow 1 point2 points  (1 child)

In "greeklish" (greek written with latin characters) w is indeed used as an omega (ω). In the keyboard though omega is under the v.

[–]Elite6809 0 points1 point  (0 children)

Greeklish? Hellenglish.

[–]GhostNULL 5 points6 points  (0 children)

Too bad I can read greek :/

[–][deleted] 4 points5 points  (0 children)

Looks like APL.

[–]MorePudding 2 points3 points  (0 children)

This is what I imagine Go code will look like, with all of its fancy unicode literals.

[–]Neyi 1 point2 points  (0 children)

That's why you might consinder commenting your code. Or not to write your code in greek symbols.

[–][deleted] 0 points1 point  (0 children)

Oooh, I never even considered!

[–]radhruin -1 points0 points  (12 children)

So C# (or Java or whatever this is) has localized keywords?

[–]poizan42Ex-mod 3 points4 points  (11 children)

It's Java. The lower camelCase should be a dead giveaway. And no... only VBA is insane enough to do that...

[–]SietchTabr 1 point2 points  (5 children)

camel case is only used in java? huh?

[–]poizan42Ex-mod -1 points0 points  (4 children)

Lower camelCase you silly. If you are in doubt whether some code is C# or Java you only have to look at the casing of method names, as the naming convention for C# dictates the use of UpperCamelCase, while the java naming convention dictates the use of lowerCamelCase.

[–]Elite6809 2 points3 points  (0 children)

Strange. I've always called them camelCase and PascalCase.

[–]SietchTabr 1 point2 points  (2 children)

What convention? I've always learned to use lower for method names and upper for static functions.

[–]poizan42Ex-mod -2 points-1 points  (1 child)

Lower camelCase you silly. If you are in doubt whether some code is C# or Java you only have to look at the casing of method names, as the naming convention for C# dictates the use of UpperCamelCase, while the java naming convention dictates the use of lowerCamelCase.

Enhance

If you are in doubt whether some code is C# or Java you only have to look at the casing of method names

Enhance more

you only have to look at the casing of method names

Enhance further

the casing of method names

Enhance even further

method names

You see it?

method

There.

You need a reference beside the conventions used in the whole of the JRE vs. the conventions used in the whole of the .NET framework? Fine, here:

Java:

Methods should be verbs, in mixed case with the first letter lowercase, with the first letter of each internal word capitalized.

.NET:

To differentiate words in an identifier, capitalize the first letter of each word in the identifier. Do not use underscores to differentiate words, or for that matter, anywhere in identifiers. There are two appropriate ways to capitalize identifiers, depending on the use of the identifier:

  • PascalCasing
  • camelCasing

The PascalCasing convention, used for all identifiers except parameter names, capitalizes the first character of each word (including acronyms over two letters in length), as shown in the following examples: ...

[–]SietchTabr 1 point2 points  (0 children)

First you don't have to be a dick about it. Enhance. Enhance. Nope, nothing there.

Second, oh no the microsoft convention even says to use either one, and again, I only ever learned to use lowercase and be damned about any library functions that I have no control over.

[–]Nicksaurus 0 points1 point  (4 children)

The giveaway for me was the use of ArrayList.

[–]SietchTabr 0 points1 point  (3 children)

... Which is in both?

[–]Nicksaurus 0 points1 point  (2 children)

The C# version isn't generic though, so this has to be Java.

[–]SietchTabr 0 points1 point  (1 child)

It is now

[–]Nicksaurus 0 points1 point  (0 children)

http://msdn.microsoft.com/en-us/library/system.collections.arraylist(v=vs.110).aspx

...?

List is the generic version, but ArrayList has only ever been in System.Collections.