Tell me what's wrong with Java why it's/what makes it a bad language Jow Forums

Tell me what's wrong with Java why it's/what makes it a bad language Jow Forums

Attached: Java.png (512x512, 33K)

Other urls found in this thread:

docs.microsoft.com/en-us/dotnet/csharp/programming-guide/unsafe-code-pointers/arithmetic-operations-on-pointers
oracle.com/technetwork/java/javase/eol-135779.html
github.com/cstancu/netty-native-demo
excelsiorjet.com/
cvedetails.com/cve/CVE-2016-0264/
insights.sei.cmu.edu/sei_blog/2014/12/java-zero-day-vulnerabilities.html
stackoverflow.com/a/43431878/840315
twitter.com/SFWRedditImages

it's less that it's a bad language (it does have its flaws, but everything does) and more that because it became so widely used in industry and schools that a lot of retards learned it and write a lot of really shitty code in it.

hiding pointers, no RAII, no sane functional programming, everything is an object, standard library has some fucking retarded stuff they won't remove for backwards compatibility, to do even simple """OOP""" stuff you have to do hacks like casting, a lot of boilerplate, the boilerplate is LONG, pushing OOP hard is also a minus seeing as how OOP is annoying and doesn't work on a large scale

exceptions
>hiding pointers
im genuinely curious on how you would expose pointers in a typesafe languagd

I did not word myself well, I wanted to say that they want to hide pointers and pretend they are not there while in reality you still have to learn that they are there and how they work, because otherwise you will fuck up ("""reference"""(aka pointer) passing)

about the exposing part:
you might want to have the ability to drop down to a very low level and do stuff there (haskell), which is more performant/otherwise impossible

+1 for the exception system, forgot about that

It's users seem to think they need every damn enterprise framework to get anything done

Why do we need library X?
>It's got dependency injection
Why do we need dependency injection?
>It's what enterprise applications crave

Dependency injection is a useful pattern, but most of the time you don't need it.

>no RAII
RAII is a resource management pattern, not a language feature. You can do RAII in any language including Java. In fact you should do so whenever you have some external resource that can't be collected.

As for OOP, yes, it's going to suck when people treat objects as glorified structs.

It's easy to write code in it, so it doesn't show off your 1337 h4x00r skillz and that is why Jow Forums doesn't like it. In the past a real argument was that it's slow and uses more memory, but these days this argument is not so strong, Java go optimized a lot and 16GB of RAM is common PC hardware along with multicore multithread fast CPUs. There's also no operator overloading but most programmers don't give a fuck anyway - rarely they implement linear algebra operations in the code.

It's the equivalent of getting a cross compiler for the N64, programming your shit for it and then using Project 64 to run your program, and saying that it has the huge advantage of being portable because there's N64 emulators for the android and mac/linux etc..
But it's even worse because you program on a terrible language instead of C, as you would for the N64.
Of course, you also could be a complete shitlord and port a JVM for the N64, but i think the devil himself would collect your soul by them.

Slow and memory usage are still valid arguments. Never settle for inferior efficiency if you do not have to.

This is exactly what I didn't get in the past - it's a tradeof for being able to write more code easier and faster, which is important in the IT industry as a whole. Java programmers (mostly) are aware of that.

They didn't hide anything, knowing a few basic things about Java, its quite obvious

>Java is garbage collected
>Everything in Java is pass by value

Because Java is a GC language, objects cannot live on the stack. Otherwise, the GC couldn't manage them, they'd just go out of scope. Even when your compiler does escape analysis, there is never an "object" on the stack, but a struct-like collection of primitives. If you REALLY think, it should be apparent that these "objects" you're dealing with are actually references because 1. All objects live on the heap, and 2. You can return an object from a method.

Remember, no matter how many quotes you put on it, references aren't pointers. The reason many books and tutorials treat object references as the actual object is because references are more like alias, wheras a pointer is literally just an address. All references refer to a valid object or null, the same isn't the case for pointers.

Btw, just wanted to add, I didn't know these concepts when I just started learning Java. I'd place the blame poor education rather than any fault of the language.

Textbooks, tutorials and various profs seem to skip over how important basic concepts like garbage collection, primitives, values, reference variables, stack and heap allocation really are. They just skip to making fancy OO taxonomies, without explaing how Java really works.

>Because Java is a GC language, objects cannot live on the stack. Otherwise, the GC couldn't manage them, they'd just go out of scope.
Isn't that the point of a stack? I haven't read the Java specs, but surely your implementation can keep objects where it damn pleases.

>All references refer to a valid object or null, the same isn't the case for pointers.
When is a pointer not pointing to a valid object or null part of a correct program? That makes absolutely no sense, whether the compiler enforces it or not.

Where r u from r u american

Exactly, that's the point. All objects must be managed by the GC. Every. Single. One. Thus, no stack objects. You don't need a GC is your object lives on the stack.

A pointer can point to any arbitrary memory location. It's quite easy to make your int *ptr point to an address that doesn't contain an int.

>what is c#

how exactly do you differentiate between "containing an int" and not containing an int? all memory locations "contain" an int if you just treat that memory location as an int, and the same is true for ALL objects. ? ? ?

it may really be possible, and I might just not know, but how can you make your objects self-destruct when they go out of scope (like in C++?) and how can you tell the destruction what to clean-up (without writing everything manually everywhere)

obviously you can do RAII by hand, but this is the same argument as saying "you can write a C++ compiler in java and do RAII there"
(it's also relies on the programmer)

Type erasure mainly. Everything else is acceptable.

try (Resource res = new Resource())
{

} //Automatically closed here

It's terribly verbose.

Java is all about getters/setters, yet they are a real pain in the rear in Java (see C# or Ruby for how to do getters/setters right).

The whole mindset about "multiple inheritance is bad" is stupid and outdaten. Every modern langue has something like mixins.

Java tried to add some functional features, but they are terribly verbose, complicated and also feel really awkward.


This and so much more..

>Java is all about getters/setters, yet they are a real pain in the rear in Java (see C# or Ruby for how to do getters/setters right).
There's nothing wrong with keeping it simple. When I see something as basic as this.myvar it's helpful to know that an exception won't be thrown or it won't spend an hour computing the value. A little more verbosity is a fair price to pay for clarity.
>The whole mindset about "multiple inheritance is bad" is stupid and outdaten. Every modern langue has something like mixins.
How are mixins distinct from interfaces with default methods?
>Java tried to add some functional features, but they are terribly verbose, complicated and also feel really awkward.
I don't see how they're complicated. It's about on par with C#.

c# looks like it has unsafe pointer access and arithmetic to me: docs.microsoft.com/en-us/dotnet/csharp/programming-guide/unsafe-code-pointers/arithmetic-operations-on-pointers
i dont know c# though so if you know any example that proves me wrong, do share

>hiding pointers
Java doesn't hide pointers, nor the heap and stack, it has different syntax.
To get Java you must get C pointers.
>no RAII
Java is garbage collected, design decision
>no sane functional programming
It's an imperative language but the new functional constructs work well
Also you can use Clojure which is fully functional
>everything is an object
Wrong
Primitives aren't objects
In my opinion this pragmatic attitude is one of the good things about Java
>standard library has some fucking retarded stuff
Java standard library is good
>they won't remove for backwards compatibility,
This is excellent!
Are you nuts?
>to do even simple """OOP""" stuff you have to do hacks like casting,
Wrong
Generics with type erasure work good
Another good pragmatic decision of Java
>a lot of boilerplate, the boilerplate is LONG,
It's kinda verbose but a) there are IDEs, b) Java is getting less verbose c) verboseness makes the intent more clear
If you know your Java and use lambdas and streams Java isn't verbose
>pushing OOP hard is also a minus seeing as how OOP is annoying and doesn't work on a large scale
Wrong
OOP is a good and well tested paradigm

I don't give a fuck what Jow Forums says, it is by far the most universally applicable language there is. It's not the best language for every application there is but it's suitable to anything and excels in large scale applications due to its robustness.

No one likes it because it is verbose and boring, but those aren't really critical of the language itself

It's not javascript.

This user gets it. Java is great. Op don't listen to Jow Forums first year comp sci students that only write FizzBuzz type shit in C.

It's not a bad language

posted this multiple times on Jow Forums and never got a response:

var listOfWhat = new ArrayList();

in java 10 why did they choose to allow this to compile?

I don't have Java 10 to test it now
But I suppose the variable is declared as an arraylist of objects which is consistent with pre-generic Java

>Absolutely everything in an object, functions have to be static methods
>Most basic functionality is in libraries rather than built-in
>Long VM spin-up times

The only reason to use Java or the JVM is for Clojure. I'd say D is a proper successor to what Java was attempting to accomplish.

Legitimately have no idea.
Not that there's any fundamental reason why you wouldn't allow it either.
You don't specify anything so it's an ArrayList of Objects. Not really surprising behavior either, just a bit pointless.

>>Java is all about getters/setters
Not necessarily, we use an immutable library called org.immutables. I define immutable data objects with builder objects faster and in less code than any C# fag ever.

>Absolutely everything in an object, functions have to be static methods
So functions behave exactly like functions? You say that like that's a bad thing?
>Most basic functionality is in libraries rather than built-in
Such as? The standard library is actually pretty extensive for a non-scripting language.
>Long VM spin-up times
True. Java is only really used on servers nowadays. So the goal is more to be able to run for years unattended, not really to boot in < 10ms, though both are important.

>Java 10
I tried out Java 10 last week. Every build we had broke on it. Also, It has a very limited lifespan, so I think many developers will wait for Java 11 until switching (next long term supported release).

I agree with Java being used only in servers and thus startup time in production environments does not matter.
But, as I work with Spring Boot every day, I can say that waiting for this fucker to build and startup every time I change something critical can be really time consuming. Sometimes I wish I were a PHP programmer.()

anything in particular that broke? i thought java was all about dat backwards compatibility

No, I think the strict backwards compatibility was really dropped when they introduced Java 9. Core Java components were removed from the runtime and made optional (you can only build using them If you start the javac with extra arguments). Also the new *modularity* means you will have to define your imports a effectively a second time using the `module-info.java` . Until common IDEs catch up with the module info generation, it will be a pain to use it.

I will just stay with Java 8 until 11 anyway, 9 and 10 will not receive security updates until 2018 sep.

oracle.com/technetwork/java/javase/eol-135779.html

*will not receive security updates after 2018 sep.

If it breaks on Java 9-10 it will break on Java 11 as well. You'd better fix it now since they're going to drop free support for Java 8 shortly after 11 comes out.

it doesn't compile to native, machine language (binary)
it is transpiled to bytecode and then the JVM JIT compiles it
that extra layer is a security concern, a performance conern, etc. that alone is reason to dislike Java

Attached: 45k.png (194x233, 53K)

Play Framework has hot code reloading which works pretty well.
I guess you don't get to pick your own stack but at least you know.

I will follow the Spring boot team. 2.0.2-RELEASE kind of works on 10, but the things I mentioned are still not mature.
Also, nothing guarantees I will have a working build when I update from 10 to 11. So I will just save the headache for now.

How is running code on the JVM a more serious security concern than running native binaries?

Spring also has it, but it only works if you change minor thing. If I introduce a new endpoint, it will have to start again (it does automatically, but still takes time).

meanwhile with C# you can compile to native machine language for tons of different architectures
the JVM has vulnerabilities,

Neckbeards are upset that it's the language with the highest remuneration.

>the JVM has vulnerabilities,
the JVM has vulnerabilities, zero days, and is basically just an entirely new attack vector for systems that doesn't need to exist **

>meanwhile with C# you can compile to native machine language for tons of different architectures
You should read up on that.

>what is .net core

What vulnerabilities in the JVM cannot be reproduced in native instructions?

The only real criticism of java is boilerplate and some bad design in the standard libraries all of which is fixed by other jvm languages like kotlin and scala. Muh no pointers is not an argument.

>.NET Core Runtime ARM32 builds now available
>August 2017
think of it this way
java stack:
>-native instruction vulnerabiltiies
>-jvm vulnerabiltiies
>-jdk vulnerabilities
literally every other stack:
>-native instruction vulnerabiltiies

>it doesn't compile to native, machine language (binary)

That is wrong. First off, the hotspot part of the JVM compiles frequently run code down to machine language. Second there's graalVM github.com/cstancu/netty-native-demo

>java stack
>native instruction vulnerabilties
Ok kid, show me how to trigger a buffer overflow in Java.

did you even read the rest of my post
>it is transpiled to bytecode and then the JVM JIT compiles it

Also before Graal there's excelsiorjet.com/

cvedetails.com/cve/CVE-2016-0264/

Its literally not. Its not even a question that java programs are more secure than c or c++

>Its not even a question that java programs are more secure than c or c++
thats retarded
insights.sei.cmu.edu/sei_blog/2014/12/java-zero-day-vulnerabilities.html

Not bad exactly but it's idiot proof. It's extremely easy to make things so idiots can't fuck it up easy while at the same time easy to understand what idiots are trying to do. This is nice in large enterprises but it's a pain in the ass when you know what you want to do and you don't need to deal with all the verbosity and forced protection.

Wow it's fucking nothing and you have to use a 2 year old version of Java. Meanwhile any C code you write will always be vulnerable.

>IBM sdk

the point is they exist
>and linux enterprise
>and redhat

This.

but not official JDK

Attached: primary-badge.gif (420x210, 5K)

And you have to go out of your way to make yourself vulnerable. If you show me a 2000+ line program in C writtenn by a hobbyist I can easily find much worse.

Too much unnecessary syntax imo
let's say you want to read text input from the console.. jesus, even C has an easier syntax for doing that.
if your language is harder than C while being less powerful, you really should re-think your design decisions

Except java isn't slow or inefficient. In most cases Java will actually be faster than c++ because it is easier to write good code.

no just the JDKs that actual professionals in the enterprise world use
there are far more vulnerabilities to the java stack than just that 1 example of a buffer overflow
i was only providing an example of a buffer overflow, not a particularly deadly vulnerability
if you want a history lesson of java zero days read this
insights.sei.cmu.edu/sei_blog/2014/12/java-zero-day-vulnerabilities.html

But its idiot proof because programmers like you are too stupid to understand that they cant create secure software.

This my ass.

People just need to stop dealing with questions like this as a religion kind of thing.
Programming languages are tools, if you have a valid reason to use C in a project, do it, but please try to force a webdev who is working on nodejs or anything to ten times as much work.

The point I'm trying to get at is that is that running a JVM in userspace itself running malicious Java code is inherently safer than running malicious code in userspace directly, even if there are JVM vulnerabilities.
That's like saying it's safer to install malware directly that in a VM in virtualbox because virtualbox has vulnerabilities.
You're not stacking up your attack vectors, you're reducing it.

>literally every other stack:
>-native instruction vulnerabiltiies
So only the Java runtime is fucked, python, CLR, PHP... are magically safe? Sounds like massive delusion to me.

And there are far more vulnerabilties using native code compared to Java. Kill yourself.

If you want a high level GC language use C#

C# is better in every aspect.
>Syntax
>Lamdas
>IDE
>Threading
>Memory Managment

These

Okay, stackoverflow.com/a/43431878/840315

Yeah but it just feels safer because I can use pointers and stuff besides im not pajeet.

if there is a zero-day vulnerability in the JVM or JDK there is absolutely nothing you as a programmer or as a team of developers can do to prevent it. that is the ultimate point.

>So only the Java runtime is fucked, python, CLR, PHP... are magically safe? Sounds like massive delusion to me.
in other environments there wouldn't be a vulnerability that automatically applies to you because there are no "C++ vulnerabiltiies", just architecture-specific vulnerabilities that would have to have resulted from the developer's own lapse in security
literally what the fuck are you even talking about
>66093550
>These
nice argument retard

C# isn't ranked in the top at techempower benchmarks, C# doesn't have hadoop, spark or kafka

C# only good for simple CRUD webshit and unity

Yea you are fuckimg retarded. Go write more FizzBuzzs in C. I bet even your FizzBuzzes have security vulnerabilties.

Exactly what I think when people drop the .net core bomb. It is interesting, but will need some serious years until I can start using it in a project.

actually i'm a c# developer making $80/hour
but i was an enterprise java developer for 3 years
don't you have a java quiz to study for?

Nice larp. If you were actually employed you would know that C# is just as insecure as Java.

>jvm vulnerabilities apply to all java software
>But I can write secure C software if I try real hard
Imagine being this retarded

okay actually i'm jobless right now, but so what? i have a master's degree in computer science while you're probably some 14 year old high school student

i never said c# was better
>tfw he thinks im larping
>tfw someone else accused me of larping in another thread so i prepared this image showing my $12k/month deposits to my business and transfers to my personal chequing account

Attached: shiiithomie.png (963x1133, 71K)

see
faggot

>Not using F# in 2018

Attached: 1496412712943.jpg (520x600, 97K)

>if there is a zero-day vulnerability in the JVM or JDK there is absolutely nothing you as a programmer or as a team of developers can do to prevent it. that is the ultimate point.
If you run malicious software in userspace you're vulnerable 100% of the time. If you run malicious software in the JVM you're vulnerable until a hotfix is published. You refuse to understand this so this is the last time I write this out.

>>in other environments there wouldn't be a vulnerability that automatically applies to you because there are no "C++ vulnerabiltiies", just architecture-specific vulnerabilities that would have to have resulted from the developer's own lapse in security
I said python, CLR and PHP, and you tell me about C++. You seem to willfully ignore than 90% of modern languages run in some sort of managed environment.

>hiding pointers
The issue isn't that the pointers are hidden, it's that the idea behind hiding pointers is to make sure the value of a variable is not changed by a method it is passed in to. This sounds good on paper but the problem is you run into the exact same problem with mutable objects.
>everything is an object
But that's not true. Primitives aren't objects. It's not like Python where there truly are no primitive types and everything is in fact an object.

The generics system is shit in some regards, way too much boilerplate for simple stuff.

>I said python, CLR and PHP, and you tell me about C++. You seem to willfully ignore than 90% of modern languages run in some sort of managed environment.
first of all what the fuck is CLR. pretty sure i used that to clean my shower the other day
secondly i don't give a shit about python or PHP.
thirdly PHP isn't even a "modern language" i don't know why you're using it as an example
forthly this discussion is exhausting. don't mistake my silence for victory. i'm just leaving.

Wow what a poorfag.
Keep on thinking you'll be able to write "secure" C code.

Attached: 1527348010.png (1787x453, 69K)

lmao you're adorable

But how can you complain about no pointers and in the same sentence complain about lack of functional programming. Its like you want to design retarded spaghetti code that makes no sense

>claim to be a c# developer
>doesn't know what CLR is
ok

i know c# is translated to an intermediary language
i was making fun of you for calling it CLR. CLR is the runtime not the language
the language is MSIL
anyway peace

you need a little bit of whom this
im a java machine
i dislike apples
TOO many object

lol right

And you don't get that anyone can photoshop up a bank statement. Niw fuck off and LARP elsewhere faggot.