If people can execute arbitrary code in your app, they can already read your memory, and even if they couldn’t they could use java reflection to just turn off the private modifier
Accessibility modifiers are to do with maintainability. If you have internal implementation logic that should be hidden from a consumer you don’t want that consumer to have to know about things they shouldn’t be changing anyway.
The comic is just about how classnames in java should be in pascal case
When you’re telling a joke to a bunch of computer programmer nerds, you got to tell them what programming language the joke is in, or else it just falls flat.
But also classes? In Java, I normally see camelcase (objects, variables, functions, …) except for class definitions, which are PascalCase.
The package itself often is camelcase though iirc?
I don’t get it
So this looks like it’s based in Java code.
A public class means that any bit of Java code, including that injected by an attacker, can see and mess with the contents of that class.
A private class, in contrast, means that other bits of Java code are restricted to running the class’s predefined functions.
In theory it is supposed to help with the security of the data. In practice if an attacker gets to this point, you’ve got much bigger issues.
Private Vs public has nothing to do with security
If people can execute arbitrary code in your app, they can already read your memory, and even if they couldn’t they could use java reflection to just turn off the private modifier
Accessibility modifiers are to do with maintainability. If you have internal implementation logic that should be hidden from a consumer you don’t want that consumer to have to know about things they shouldn’t be changing anyway.
The comic is just about how classnames in java should be in pascal case
java_devs_when_they_see_snake_case
Imagine using extra characters in your variable names. And they say Java is verbose…
Ah well… Guess I’m lucky that it doesn’t bother me.
I use different languages with different style guides and my IDE autoformats everything properly with the click of a button.
Classes often have camelCase or PascalCase. Snake cases often are for variables or functions.
I don’t remember the java standards, but it’s enough to get it
When you’re telling a joke to a bunch of computer programmer nerds, you got to tell them what programming language the joke is in, or else it just falls flat.
In college and workplace, all java projects I ever worked with used camelCase. Whether that’s the official stance of Java or not, I don’t recall.
But also classes? In Java, I normally see camelcase (objects, variables, functions, …) except for class definitions, which are PascalCase.
The package itself often is camelcase though iirc?
That’s exactly how I was taught Java styling in college. Idk if it was official styling or just professor preference though.
Same I was taught. Think it’s official. Professor was a stickler for following official rules so I doubt he would deviate.
The Java standard is ClassName, variableName, FINAL_VALUE_NAME.
It’s derived from a popular C++ standard. (But C++ has many for you to pick.)
Python is the one that likes snake_case, but it’s for variables, as you said. Classes are still PascalCase.
Rust is like Python, but actually tell you the rules instead of you doing whatever you want