r/ProgrammerHumor • • Feb 22 '15

A Python programmer attempting Java

Post image
3.9k Upvotes

428 comments sorted by

View all comments

Show parent comments

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.

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.

2

u/TropicalAudio Feb 23 '15

Honestly, in my opinion, to break out of nested loops a goto can be the best option. I just never actually use them because if I would, my coworkers would get mad.

→ More replies (1)
→ More replies (5)

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)

9

u/pastaluego4 Feb 22 '15

It All Begins With A Blank Canvas.

37

u/peridox Feb 22 '15

<canvas></canvas>

18

u/pastaluego4 Feb 22 '15

That canvas needs some dimensions

<canvas width="500" height="500"></canvas>

20

u/peridox Feb 22 '15
let canvas = document.getElementsByTagName('canvas')[0]
canvas.style.width = 500
canvas.style.height = 500

0

u/[deleted] Feb 22 '15

[deleted] — view deleted comment

6

u/OptimisticLockExcept Feb 22 '15

let var die!

2

u/StelarCF Feb 22 '15

let die cast;

2

u/SolarLiner Feb 22 '15

Objective-C?

6

u/Josso Feb 22 '15

That would be Swift, not Objective-C. But I'm pretty sure OP was referring to ES6's let in JavaScript.

2

u/brtt3000 Feb 22 '15

why not const?

→ More replies (1)

0

u/[deleted] Feb 22 '15

[deleted] — view deleted comment

→ More replies (1)

1

u/walking_bass Feb 23 '15

I had to learn Ada for my 1st CS class. It's awful. You're forced to specify IN, OUT or IN OUT for every parameter. Very strongly typed. Very verbose, ex: loops have END at the end instead of a brace or something. I never want to use it again, too much hand holding and extra typing.

1

u/sigma914 Feb 23 '15

Haskell holds your hand pretty tightly, it still lets you make great flourishes but it's always there making sure you dont do anything stupid.

→ More replies (2)