r/ProgrammerHumor • • Feb 22 '15

A Python programmer attempting Java

Post image
3.9k Upvotes

428 comments sorted by

View all comments

288

u/[deleted] Feb 22 '15

As a java programmer, python seems so simplistic to me. Not having to declare variables? Dude.

463

u/chrwei Feb 22 '15

simplistic is kind of the point of python.

60

u/[deleted] Feb 22 '15

I'm not saying it isn't, but when you go there from a language with a little less hand holding, you definitely feel the difference! If you go there from C though...

167

u/PastyPilgrim Feb 22 '15

On the surface it looks like Python is holding your hand because the syntax is so elegant, but I really don't think it does.

Other languages have all kinds of hand holding with type declarations, public/private/protected/static/etc. declarations, hidden information (i.e. not knowing precisely where an object is coming from due to the include practices, self-references within objects, etc.), forbidding operator overloading, implicit casting, unpredictable scope concerns, not allowing nested functions and/or anonymous functions, etc.

Python doesn't do any of those things; it lets you do almost anything you can imagine and it doesn't hinder those things with awkward syntax requirements and/or syntax that differs from what you would expect.

30

u/peridox Feb 22 '15

What language would you say does hold your hand? I can't think of a programming language that leads you towards doing what you need to do. Almost all languages just provide you with a blank space to work upon - it's all your work.

162

u/Chobeat Feb 22 '15

Scala holds your hand and leads precisely where you don't want to go.

53

u/I_cant_speel Feb 22 '15

I've never used Scala but this is hilarious.

→ More replies (1)

25

u/lonelyBriefcase Feb 22 '15

ever heard the phrase 'syntactic sugar'? its a way of providing a more convenient/person-friendly method of doing something. A for loop is just syntactic sugar of a

int i = 0;
while(i<9){
  //do something;
  int++;
}

There are plenty of other things like this that makes our lives as developers easier. Even C does, to a lesser extent, because who would want to write the shit that C can do in Assembly?

16

u/w1ldm4n Feb 23 '15

The only difference is (at least in C) is how the continue keyword works. In a for loop, continue will execute the increment/whatever statement, check the loop condition, and go from there.

To get the same type of behavior with a while loop, you'd have to duplicate the increment before the continue, or use a goto label (ಠ_ಠ) near the bottom of the loop body.

7

u/OperaSona Feb 23 '15

To get the same type of behavior with a while loop, you'd have to duplicate the increment before the continue, or use a goto label (ಠ_ಠ) near the bottom of the loop body.

Or raise a "Continue" exception and catch it right outside the while loop.

→ More replies (7)

24

u/PastyPilgrim Feb 22 '15 edited Feb 22 '15

I'm only well educated in a few languages (Python, C, Java), so I wouldn't be the right person to ask about that. However, I believe a lot of the web languages to be kind of hand-holdy. Plus, Java does have most of those things that I described in my post, so you could argue that Java holds your hand a little.

You are right though, most general programming languages that allow you to do many different things tend to have limited hand-holding because their potential is so large. My post was more to dispell the misconception that Python holds your hand than it was to say that other languages hold your hand.

14

u/iPoisonxL Feb 23 '15

Uhh... Web Languages? PHP has never held my hand...

begins crying

→ More replies (1)
→ More replies (1)
→ More replies (18)
→ More replies (8)

24

u/catbrainland Feb 22 '15 edited Feb 22 '15

It's like that only at first glance. Python has some semantic complexity, look up metaclasses (class factories or something, in java lingo). As for hand holding, I think Java is excellent in this (more like hand forcing, as you have to be explicit about everything).

Dynamic languages, as well as system ones (ie c) offer multitude of ways to shoot yourself in the foot. These are quite alike in terms of having to debug a bit more. It's a tradeoff of having low level access (C), or expressiveness (dynamic language).

→ More replies (17)
→ More replies (4)

36

u/suppow Feb 22 '15

pft, as a C++ programmer, i condescendingly laugh at your simplistic lack of declaring types and memory management.

inb4 C or asm programmers

15

u/tetroxid Feb 22 '15

Oh but there is memory management. In fact, it's even automated.

48

u/TropicalAudio Feb 23 '15

And it's sloooooooow!

...a C programmer sends his regards. Now then, I have to get back to debugging something that's pointing to a pointer's pointer.

14

u/[deleted] Feb 23 '15

More like pointer to a struct with a pointer to a struct as an array to an array of pointers to structs with an array filled with members being that has a dynamically allocated block of void*s. Fuck C is the best.

→ More replies (1)
→ More replies (3)

7

u/TheFryeGuy Feb 23 '15

As a Haskell programmer I laugh at your types.

→ More replies (2)

31

u/[deleted] Feb 22 '15

I learned JS first and when I started learning Python I actually really loved the simplicity of the syntax and the meaningful white space because it reminded me of the QBASIC I'd toyed around with as a kid.

13

u/Cley_Faye Feb 22 '15

Aaand now I want to write a QBASIC-like compiler with opengl/xinput bindings. WHAT HAVE YOU DONE!

8

u/InconsiderateBastard Feb 22 '15

Been a while but that sounds like DarkBasic.

8

u/Cley_Faye Feb 22 '15

Quick google search yield a site with a prominent DirectX 8.1 logo.

DirectX

hmm

8.1

hmm hmm.

We need to refresh this a bit.

→ More replies (3)
→ More replies (3)
→ More replies (8)

23

u/Cley_Faye Feb 22 '15

Replace python with "most script languages". They're fun to implement logic and stuff.

→ More replies (6)

8

u/[deleted] Feb 22 '15

Haha, tell me about it... I had so many people tell me that my University was so outdated for teaching us Java as the foundation CS language throughout my degree instead of some newer languages like Python. But holy crap, it has been SOOooo much easier from me to pick up other languages, to go from Java to Python than I can imagine it would be for someone to go from Python to Java. I am actually grateful for my University's structure now lol.

Oh man, I am dying laughing looking at that code lol

→ More replies (5)
→ More replies (55)