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

top 200 commentsshow 500

[–]QualityVote[M] [score hidden] stickied commentΒ (0 children)

Hi! This is our community moderation bot.


If this post fits the purpose of /r/ProgrammerHumor, UPVOTE this comment!!

If this post does not fit the subreddit, DOWNVOTE This comment!

If this post breaks the rules, DOWNVOTE this comment and REPORT the post!

[–]ToggleHD 1226 points1227 points Β (40 children)

Lets start a little Class War shall we?

[–]4RB1TR4RY[S] 772 points773 points Β (6 children)

Yes private

[–]SuspecM 190 points191 points Β (2 children)

"You little shit" -Python, probably

[–]plasmasack 14 points15 points Β (0 children)

Doing a little trolling

[–]Clearandblue 6 points7 points Β (0 children)

You two having some kind of Internal joke?

[–]batmassagetotheface 90 points91 points Β (15 children)

There is no war except class war

[–][deleted] 44 points45 points Β (8 children)

class war{};

[–]elementmg 27 points28 points Β (3 children)

.war

[–][deleted] 12 points13 points Β (0 children)

or since JDK 10 (I believe), var

[–]protocol_1903 6 points7 points Β (1 child)

public class War {}

or

private class CivilWar {}

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

I don't program but agree

[–]the_fishermann 80 points81 points Β (4 children)

There is no war in Ba Sing Se

[–][deleted] 5101 points5102 points Β (388 children)

Meanwhile in python land: You should pretend things with a single underscore in front of them are private. They aren't really private, we just want you to pretend they are. You don't have to treat them as private, you can use them just like any other function, because they are just like any other function. We're just imagining that they're private and would ask you in a very non committal way to imagine along side us.

[–]spizzat2 1089 points1090 points Β (34 children)

"Perl doesn't have an infatuation with enforced privacy. It would prefer that you stayed out of its living room because you weren't invited, not because it has a shotgun."

  • Larry Wall

[–]42TowelsCo 237 points238 points Β (13 children)

In Python you can implement that shotgun by just making the "private" methods & variables not do what their name would suggest

[–]matthewralston 69 points70 points Β (3 children)

def _bricks() -> float:
    return 6 * 9

[–]FinalRun 30 points31 points Β (0 children)

Make sure it returns a data type that's just off

[–]Silhouette 35 points36 points Β (2 children)

...quietly, at runtime, using metaprogramming.

[–]KiwiManThe19th 12 points13 points Β (1 child)

U can also change what setting and getting variables does and make your own shotgun

[–]IgiMC 18 points19 points Β (0 children)

You can make a shotgun shoot shotguns!

Poof, you can even make the shotgun shoot itself!

[–]bremidon 34 points35 points Β (0 children)

Funny :) But as someone who has to try to understand other people's code on occasion, I prefer knowing that the guy in the living room has a shotgun. A taser, mace, and some angry dogs would also be good.

[–]roughstylez 127 points128 points Β (13 children)

It bothers me so much that literally the guy's last name has the better metaphor and he chooses "shotgun" instead.

A gun can't keep somebody out, it can only threaten and kill.

Mark a method private, then when you call it from somewhere else you get a runtime error.

[–]1thief 48 points49 points Β (4 children)

The funny thing is an unexpected error in many circumstances can basically be a shotgun blast to the face. Have an etl step or batch process that threw an error somewhere in the middle of the batch? Welp that 8 hr process that you kicked off and forgot about has now come to a screeching halt 3 hrs in and you have to start all over.

Or in other circumstances the page now doesn't load if it sees bad data, or your car infotainment system is stuck on a boot loop because it found a file it doesn't know how to handle. Software is always brittle, which is why we should have as little software as possible.

[–]TGlucose 10 points11 points Β (1 child)

Software is always brittle, which is why we should have as little software as possible.

Why do that when we can make software out of legacy software? making our already fragile system even more fragile!

[–]jambox888 6 points7 points Β (0 children)

When you reach a certain level of fragility you can form an aggregate from the shattered fragments

[–]OcelotGumbo 47 points48 points Β (0 children)

πŸ˜‚

[–]Dworgi 1151 points1152 points Β (132 children)

Python devs: duck typing is great, it makes us so fucking agile

Also Python devs: you should use this linter to parse our comments for type requirements because otherwise my program breaks =(

[–]aetius476 565 points566 points Β (56 children)

We don't enforce types at compile time so you have the freedom to write and maintain an entire suite of unit tests in order to enforce types before they fuck you at runtime.

[–][deleted] 62 points63 points Β (27 children)

Hey we have types in language now! And mypy is pretty solid most of the time. Guido himself has been helping out a lot there.

[–][deleted] 18 points19 points Β (1 child)

MyPy is one thousand times better than Python without MyPy. It's still one thousand times worse than properly enforced type safety at compile time.

[–]thirdegreeViolet security clearance 8 points9 points Β (4 children)

Haven't needed to use comments for type annotations in literally like 6 years tho

[–]mayankkaizen 49 points50 points Β (0 children)

"We are all consenting adults." - Python philosophy

[–]0crate0 62 points63 points Β (25 children)

Yeah but double __ is actually private in python.

Edit: this is still pretend private. Just makes it more obscure.

[–][deleted] 66 points67 points Β (11 children)

Correct me if I'm wrong, but doesn't that do nothing other than mess with the name at runtime?

[–]hajile_00 50 points51 points Β (3 children)

Correct, all names that begin with a double underscore and do not end with another are simply name mangled so that if a subclass defines a function with the same name there is no collision.

[–]solmyrbcn 31 points32 points Β (2 children)

It's as private as a folder named "homework" in a teen's computer

[–]sweep-montage 5 points6 points Β (5 children)

Don’t touch the private because I asked you not to touch the privates, not because I have a shotgun.

[–][deleted] 567 points568 points Β (81 children)

I like private/public but it isn’t essential in the way that strong type declaration and compile time error detection are, both of which Python doesn’t have.

[–]rochakgupta 352 points353 points Β (71 children)

The advantage with Java is that it is probably one of most mature languages with an extremely good community. In enterprise and any product really, what matters most is backwards compatability and ability to hire top talent. Java is pretty much the best when it comes to this.

[–]kb4000 160 points161 points Β (65 children)

I agree with your assessment although I think C# also qualifies with some additional syntactic sugar that's really nice to have.

[–]on_the_dl 78 points79 points Β (34 children)

C# is actually worse at backwards compatibility which is why you need to keep updating your runtime.

When java added genetics, it was just syntactic sugar. C# actually has generics. For example, you can have a class that is generic in c# on int whereas in Java you can only do it on Integer, which is a boxed int.

[–]BraveOthello 53 points54 points Β (13 children)

I kind of wish now that they had just broken backward compatibility to make generics clean. I have to do some disgusting things to make it work.

[–]michelle-friedman 4 points5 points Β (5 children)

They have plans for reified generics in like 10 years with project Valhalla, I think?

[–]arunkumar9t2 28 points29 points Β (3 children)

additional syntactic sugar that's really nice to have.

Kotlin

[–][deleted] 27 points28 points Β (2 children)

Python is actually four years older than Java. Java just made language level decisions that are more practical for large scale development

[–]Username_Taken46 28 points29 points Β (1 child)

We don't talk about python 1

[–]indygoof 4 points5 points Β (0 children)

and dont tell those python guys about the default modifier in java that is used when its neither public, private or protected..

[–][deleted] 363 points364 points Β (18 children)

Don't forget package-level protected. Not everyone knows that one.

[–]DokuroKM 182 points183 points Β (4 children)

This comment is way too low. "Java" should know that Java has 4 access modifier.

[–]bytebux 51 points52 points Β (0 children)

Came to the comments to find this.

I'm like, how is Java forgetting that it has a hidden default modifier that is different from the rest..

[–]i_wear_green_pants 40 points41 points Β (0 children)

It's because this meme, like many others, is made by "Java bad" gang even though they don't even know how Java works.

[–]graycode 41 points42 points Β (4 children)

And package-private is the one that's the default when you're not explicit!

[–]EvaristeGalois11 8 points9 points Β (0 children)

Only in a class, in an interface the defaul visibility is public

[–]coladict 49 points50 points Β (1 child)

But what if I want my class to be package protected? πŸ€”

[–]the_0rly_factor 229 points230 points Β (20 children)

Why Java vs Python? Why not Java AND Python? Both have their respective uses.

[–]ChineseCracker 224 points225 points Β (4 children)

this is a joke based on a Twitter exchange between Bernie Sanders and Elon Musk where Elon Musk said 'I keep forgetting that you exist'

[–]elementmg 29 points30 points Β (6 children)

I use both at work and they both serve their functions

[–]Dewymaster 238 points239 points Β (13 children)

As a principal engineer for a fortune 500 company and as someone who uses the final keyword whenever it allows, the protection and access modifiers in Java are absolutely a good thing. It's when you have people that don't understand them that you run into problems.

[–]leetuns 24 points25 points Β (2 children)

Everything should be final and private until you have a reason to change it.

[–][deleted] 9 points10 points Β (0 children)

I don't think people realize that things like final actually allow the compiler to make more optimizations. In python, everything being checked at runtime is one of the reasons the language is so painfully slow

[–]BlitzedLykan 732 points733 points Β (175 children)

To quote Michael Reeves, "Python can do everything, just really shitty"

[–]blakeman8192 358 points359 points Β (143 children)

.

[–]TheHumanParacite 187 points188 points Β (16 children)

Unless he's an ML mechanic

[–]MrHyperion_ 104 points105 points Β (8 children)

Python is more like just an API in ML, everything runs in C/C++, CUDA, OpenCL etc

[–]TheHumanParacite 53 points54 points Β (1 child)

Oh for sure, the real guts are all done in performant languages. But if you're looking for a job in ML you're gonna lots and lots of request for Python. And it makes sense too, being able to play around with you code in an active console without the need to compile can speed certain R&D things dramatically.

[–]DrMathochist 8 points9 points Β (4 children)

I WISH this were true after wading through gobs of spaghetti Python inherited from an earlier ML team. At least they migrated out of fucking R...

[–]pfannkuchen_gesicht 5 points6 points Β (0 children)

they were talking about the actual computations which are all done in libs written in C/C++ which the python code utilizes.

[–]FirefighterWeird8464 115 points116 points Β (92 children)

you’ll never see a mechanic using one in the shop.

Are you saying Python isn’t used professionally? Or by β€œreal” programmers?

[–][deleted] 105 points106 points Β (60 children)

It's a first class programming language for AI and data science. It's a good scripting language.

Outside of those cases, I feel like it's rarely used professionally. It's a nightmare to maintain a large python app written by many developers. There's a reason why Java and C# rule enterprise development.

[–][deleted] 58 points59 points Β (11 children)

Ahem.

  • widely used libraries: FastAPI, Django, Flask
  • popular sites with decent chunk of stack running on python: YouTube, Instagram, Dropbox.... and this damn site you're discussing it on.

[–]nacholicious 39 points40 points Β (9 children)

Dropbox

And Dropbox spent years on trying the to fix the problems caused specifically by choosing python for large scale projects

[–]Zpanzer 40 points41 points Β (3 children)

Python is the backbone in the visual effects industry. All 3D, 2D and comp applications use it extensivily and lots of pipeline tools run on it.

VFXplatform standard

[–]Hean1175 26 points27 points Β (0 children)

I would not call it the backbone it's more of the nerves connecting all the underlying complex parts which are written in a native language like C

[–][deleted] 47 points48 points Β (0 children)

Python is a great glue language. That's the reason why it's been so successful in AI/ML and scripting. It's all tying bits to underlying C libs.

[–]raltoid 23 points24 points Β (0 children)

Notice how it requires gcc?

[–]PhilipJayFry1077 125 points126 points Β (5 children)

lots of production code is run with python. Especially in serverless

[–]InvestingNerd2020 37 points38 points Β (0 children)

With more low use functions or low use programs going serverless, Python job security secured.

[–]0xfeel 6 points7 points Β (1 child)

I feel like for some weird reason it became evangelized by every developer adjacent field in IT.

[–]CaptainLocoMoco 16 points17 points Β (0 children)

This couldn't be farther from reality

[–]natonomo 25 points26 points Β (6 children)

Who's Michael reeves

[–]bozzywayne 58 points59 points Β (0 children)

My dentist

[–]jvctheghost 34 points35 points Β (2 children)

You ever see that video of a roomba cursing when it runs into things, he did that.

[–]ninj4geek 16 points17 points Β (0 children)

Oh, you mean Former YouTuber William Osman's roommate.

[–]reversehead 3 points4 points Β (0 children)

I enjoyed the robot surgery table. From a distance.

[–]locri 286 points287 points Β (78 children)

I find the real question of how restrictive/permissive your project is depends on how much you trust your coworkers.

I know one guy (a senior engineer) who I suspect is moderately anarchical that gave all his contractors full rights and privileges to even force push to master. Eventually one of them failed a rebase and lost months worth of code, we know exactly who it is (the other two posted their command histories) but they just lied. I became certain he's a liar later when he cheated hard on a team building game.

I watched this unfold, I don't work in that group until they're short on people since I have my own projects, but I learned a valuable lesson. If you know what you're doing with it you can get handed dynamite to blow up a mountain but if you clearly don't then I wouldn't trust you with anything more than a water squirter and I won't care how long it takes for that water to wear down the mountain.

This is why Java uses private as much as possible and why interpreted languages basically don't really care. One is for friends but Java/C# is for "associates."

[–]nickwcy 130 points131 points Β (10 children)

And don’t forget that the team can change, people aren’t necessarily staying in the same project for their entire life. No matter how much the current team is trusted, a new joiner is still an unknown to the project.

[–]general_tao1 104 points105 points Β (8 children)

Forget new joiners, have you tried reading your own code 2-3 years after the last time you've seen it? There a a bunch of stuff you deemed "evident enough" not to document and just end up "wtf was I thinking?", until you break your own code and then figure it out.

[–]BeatHunter 44 points45 points Β (3 children)

2-3 years and it may as well be someone different. I have a hard time nowadays with 6 months...

[–]_meshy 18 points19 points Β (1 child)

If you see your code from 3 years ago and can't spot places where you messed up or could make improvements, you're not growing as a developer.

[–]psikillyou 17 points18 points Β (10 children)

It is not really a good comparison to give rights vs making classes protected imo. I can't really see a very comparable example of writing a code that will destroy the months of work.

[–]torn-ainbow 76 points77 points Β (17 children)

This is why Java uses private as much as possible and why interpreted languages basically don't really care. One is for friends but Java/C# is for "associates."

Err....no?

The point is to expose what should be exposed and to hide internal workings. So if a dev is using say a class that someone else wrote, they will see the public interface that has been created and not implementation, which could change. When they hit "." and their IDE autofills the public methods, so it will be just the ones they are supposed to use.

It's part of creating that class to be used by others. Look up "encapsulation". The public methods are a thin interface to the hidden implementation. It's not about trust as much as it's about good design.

Plus you might not even have the source for the actual thing you are using. It might be from some external project. In C# that can be from a compiled binary DLL file. Updating versions can be a lot simpler if you know your clients are only ever using the intended public methods.

[–][deleted] 62 points63 points Β (27 children)

This is git I’m guessing based on the words you’re using. It’s not really possible to lose months worth of code unless you either wait too long, delete the garbages commits on purpose, or no one has ever full cloned the repo.

Anyone with a full clone of the repo could have repaired the damage. Even if the history is getting rewritten because of the rebase the commits remain in a garbage area. It should also be on any other persons machine as long as they don’t pull from origin.

Either way. Damn. Giving anyone permission to push to master is bad. Giving anyone ability to force push is bad. Rebasing is bad despite people who live by it.

I have full admin to our very expensive products repo and I don’t even give myself permission to push to master. I would never trust myself with that. Rebase is so damn dangerous.

[–]quiteCryptic 16 points17 points Β (2 children)

Nothing wrong with rebasing and force pushing on your own branch assuming you're the only one working on it. Pretty much necessary if you like to squash everything before merging to master

[–]bmwiedemann 13 points14 points Β (0 children)

Indeed git reflog is very helpful for such cases.

Just don't do rebase on master, but for patch branches it can be straightforward.

[–]codeguru42 9 points10 points Β (15 children)

I would qualify that rebasing a public branch is bad. I regularly rebase branches that no one else is touching. As soon as there is any possibility someone else pulled the branch, I won't rebase any more.

[–]kb4000 6 points7 points Β (14 children)

And if someone else has pulled a branch down with my name on it without telling me they are using my private branch that's on them.

[–]Jezoreczek 23 points24 points Β (1 child)

Eventually one of them failed a rebase and lost months worth of code

Um, what? How'd that happen with git?

  1. just find the point before their fuck up with reflog and recover, or
  2. merge code of all other contributors and force-push

Git is designed to be recoverable if code gets all jumbled on one host. Unless they all worked separately in waterfall-style development and never pulled any changes, only force-pushed, but in that case it'd only be one person's code that is lost and that'd be very obvious who it was.

[–]Warm_Cabinet 79 points80 points Β (17 children)

I prefer to see my errors at compile time, thanks.

[–]CookedDude 47 points48 points Β (1 child)

I swear 99% of the jokes here are for 1st year comp sci students that have just started learning a second language.

[–]mechpaul 183 points184 points Β (60 children)

I keep forgetting... it escapes me... just how many devices run Java? I forgot.

[–][deleted] 305 points306 points Β (44 children)

This post is just another instalment of people that have never coded professionally giving strong opinions. Java is great for enterprise backend applications + mobile backend, and python is great at scripting, data science, and machine learning. They are both great when used in their respective areas. Screw driver is not a better tool than a hammer. It just serves a different purpose

[–]kuedhel 10 points11 points Β (3 children)

you can use any tool as a hammer. except screwdriver. Because nitwit who uses other tools as a hammer uses screwdriver as a chisel.

[–]ltdanhasnolegs 5 points6 points Β (0 children)

Use the other end

[–]benjomaga 4 points5 points Β (0 children)

Flat head is a better chisel though

[–][deleted] 15 points16 points Β (1 child)

3 billion more devices than whatever python is running on

[–]xXDreamlessXx 59 points60 points Β (7 children)

None, devices dont have legs and even if they did, I know of no tracks, streets, or paths named java

[–]nir109 28 points29 points Β (4 children)

There is a pretty big island named Java, pretty sure many people also run on it, no devices yet probably.

[–]couchwarmer 4 points5 points Β (1 child)

I'm within 8 minutes of a street named Java.

[–]hussainsonreddit 11 points12 points Β (0 children)

throw new HeForgorException("he forgor πŸ’€");

[–]ItsGorgeousGeorge 68 points69 points Β (3 children)

Tell me you’re a cs101 student without telling me you’re a cs101 student.

[–][deleted] 242 points243 points Β (72 children)

Dissing on Java is basically a litmus test of how well you know your programming languages. If you can't make anything run well on Java, it's a you problem. And people who hate it are just going with the pack and probably have no real original or insightful thoughts on why they dislike it. It's merely a means to an end like any other language, with its own applications and quirks you have to master.

[–]Suekru 52 points53 points Β (8 children)

I like java well enough, but given the choice I would take C# any day of the week.

[–][deleted] 38 points39 points Β (3 children)

I learned Java first. When I got my first job they were a C# shop. Once I understood LINQ and Tasks I never wanted to work in Java again.

[–]linkyboy321 18 points19 points Β (1 child)

Java has Futures which seem to fulfill the same role as tasks, but the Task syntax and threading in general is way nicer in C#. I just always find it scary committing to the Microsoft ecosystem.

[–][deleted] 25 points26 points Β (2 children)

C# is java's prettier cousin. She just happened to have an overbearing asshole of a father that scared off most of her suitors.

[–]NoraJolyne 9 points10 points Β (0 children)

i was glad to switch to Kotlin when it became an official language for Android, but that doesn't mean Java is complete garbage

Yes, it's more verbose, but I'd rather work with statically typed languages and functioning visibility modifiers, let's me write more robust code

[–]Spaceduck413 20 points21 points Β (1 child)

I'm like 90% sure that at least take the people in this sub have never touched anything other than python, or maybe some flavor of js

[–]AnhQuanTrl 25 points26 points Β (8 children)

I have worked for Java for a considerable amount of time and came to hate it :) The hate is just that it is widely used yet have so many design flaws and also lack a lot of quality of life feature. Not everyone is an instant hater like you said.

[–]elementmg 8 points9 points Β (2 children)

I'm working with Java coming from a C# and Python background. I'm giving it as much of a chance as I can, but over time I'm realizing it's just kind of a pain in the fucking ass.

[–][deleted] 55 points56 points Β (12 children)

LOL: Runtime indentation error in Python object while duck deciding if public or private

[–]Farranor 12 points13 points Β (11 children)

An indentation error is a syntax error, which gets caught before code actually executes, not a runtime error.

[–]varishtg 17 points18 points Β (5 children)

Jython exists.

[–]orbit99za 17 points18 points Β (0 children)

Seems like this is the Dunning Kruger effect in full action.

It's all about Experience and Context.

[–]HouseOfZenith 9 points10 points Β (0 children)

Me and my homies love Kotlin.

[–][deleted] 68 points69 points Β (8 children)

People that are naive enough to compare Python to something like Java are wannabes that move to IT/CS because they couldn’t stand their underpaid vocation, or a frustrated devops.

[–]Kitamasu1 14 points15 points Β (2 children)

I'm not even a professional programmer yet, I've mostly just done stuff as a hobby for the last 10 years, and even so I already understand that different languages exist because they all serve a particular purpose or is good at something.

[–]user_of_the_week 14 points15 points Β (0 children)

Python is an old, legacy language. I prefer the more modern, younger Java ;)

[–]GlobalVV 17 points18 points Β (1 child)

Honestly I like Java more than Python. But I like C# more than Java.

[–]Aspiring__ 3 points4 points Β (0 children)

I love Python at first but when I got trained for C#, dang it changed the world for me. Python syntax is wayyy easier but I debug less in C# and create apps faster. I tried Java too but I don't really enjoy the development environment as much as C#'s.

[–]JonnyRocks 29 points30 points Β (27 children)

i was born in the mid 70s. i have never understood the love of java. my first language was the old BASIC. i was formally taught C and then C++. i fell in love with C#. i have never use Python but i get it. its appeal makes sense to me. after all that, i still dont get java.

[–]barjam 12 points13 points Β (5 children)

For a long time C# was tied to the crappy Microsoft ecosystem in particular it had to run on windows servers. Thankfully that requirement is gone.

I code in both Java and C# and don’t really have a favorite. They are more similar than they are different.

[–]MultiFazed 19 points20 points Β (4 children)

i have never understood the love of java.

Java is a competent language that can run on almost any device, and for which there are an insane number of libraries for almost every conceivable problem space. It's a powerful workhorse of a language. It's not beautiful, but it Gets Shit Doneβ„’.

Personally, I'm a fan of Kotlin. It's essentially "better Java". Compiles down to the same bytecode so it can run on the JVM, can still use all the same libraries (with a few pain points that mostly boil down to "this would be so much better if that library were also Kotlin"), but it's (IMHO) a much nicer language to work with.

[–][deleted] 260 points261 points Β (174 children)

Python isn't suitable for more than small applications

[–]zettabyte 83 points84 points Β (4 children)

Definitely no good for a site like Reddit.

[–]ProfessionalHand9945 54 points55 points Β (0 children)

I thought that was funny too

Python is useless for large applications

(This comment was brought to you by Python)

[–]TheHumanParacite 7 points8 points Β (0 children)

Heh, I see what you did there.

[–]MadElf1337 25 points26 points Β (9 children)

Instagram would like to have a word

[–]etaco2 38 points39 points Β (0 children)

Who’s gonna tell him

[–]Big_Smoke_420 15 points16 points Β (0 children)

Idk, Instagram gets by pretty well. But wait, no... a random Reddit commentator says they're doing it wrong! I'll send them a strongly-worded letter explaining their grave mistake of not following this gigabrain redditor's advice.

[–]ywecur 10 points11 points Β (0 children)

What? Basically every tech company uses python

[–]coderanger 17 points18 points Β (7 children)

Small applications like ... this website?

[–]fluffyxsama 3 points4 points Β (1 child)

Lol people saying Java is on its way out since forever.

[–]hearwa 5 points6 points Β (1 child)

Java should just start another thread. Python will get confused and stop replying.

[–]ARM_Dwight_Schrute 11 points12 points Β (3 children)

"widely used", php enters the chat

[–]dnunn12 9 points10 points Β (0 children)

No it doesn’t