[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y ] [Home]
4chanarchives logo
Why is a bad language like Java so widely used?
Images are sometimes not shown due to bandwidth/network limitations. Refreshing the page usually helps.

You are currently reading a thread in /g/ - Technology

Thread replies: 225
Thread images: 9
File: Java_logo.png (7 KB, 259x259) Image search: [Google]
Java_logo.png
7 KB, 259x259
Why is a bad language like Java so widely used?
>>
Because it's easy
>>
Android keeping it alive
>>
>>54257370
Why is worse language (C) still used?
>>
>>54257370
1 billion indians

endless streets
>>
I really don't get why it's used instead of C++/C#.
>>
>>54257441
Because C++ is dogshit. And C# is not cross-platform enough
>>
>>54257410
Because C is good at what it wants to do. Java is not: It wants to be a safe language, but it has null, it uses a 16 bit char type which makes no sense, it stores strings as UCS-2 which is asine. It has value types for "speed" but doesn't allow the user to define value types themselves.
>>
>>54257483
That doesn't explain why C is used in all the wrong places. Java is good enough that it's used everywhere. It is still a pretty good language at what it wants to do.
>>
>>54257533
Because you've never used C, and your opinion of it was formed through the shitposts of other people who either never used it or never took time to learn it. C is even more flexible than Java since it had higher-order functions, lets you explicitly define whether something is passed by value or parameter and gives you tighter control over your resources
>>
>>54257533
Java doesn't even have immutable variables/references. Thread-safety is opt-in.

It's a shit.
>>
>>54257632
>passed by value or parameter
was not even concentrating, meant passed by value, or reference
>>
>>54257370
Portability
>>
>>54257688
everything nowadays is portable you numpty, this isn't 2005 anymore
>>
>>54257688
Scala
>>
>>54257632
Are you stupid?
Please, be joking.
>C is even more flexible than Java since it had higher-order functions
Using "higher-order" functions in C results in cancerous code and should be avoided, so no.

>lets you explicitly define whether something is passed by value or parameter and gives you tighter control over your resources
Yeah nice, except that I don't need to know if a parameter is passed by value or reference unless I am in embedded world or coding an OS.
>>
>>54257721
Yep, you definitely don't know shit about C

>Using "higher-order" functions in C results in cancerous code and should be avoided, so no.
Literally a cornerstone of any complex program. SDL, the standard in gamedev, uses it extensively for callbacks. Graphics programming requires even heavier use of it.

>Yeah nice, except that I don't need to know if a parameter is passed by value or reference unless I am in embedded world or coding an OS.
Nope. Even basic functionality requires that you understand what you're passing, what you're manipulating and what comes out.
>>
>>54257370
mediocre language with a great vm and a huge amount of libraries and tools
>>
>>54257721
Please leave my thread.
>>
>>54257779
>SDL, the standard in gamedev, uses it extensively for callbacks. Graphics programming requires even heavier use of it.
Just because a hack is used somewhere, doesn't mean it's good. If you want higher order functions, go with Scala
>Even basic functionality requires that you understand what you're passing, what you're manipulating and what comes out.
understanding doesn't mean you should care about it. The fact is, 99% of the applications don't need to care about it. Passing everything by reference in a safe manner can do the job.
>>
>>54257795
Continue masterbaiting to ugly written C dogshit.
>>
>>54257668
>Java doesn't even have immutable variables/references.
umm, yes it has. they're called constants
>>
>>54257823
>Just because a hack is used somewhere, doesn't mean it's good. If you want higher order functions, go with Scala
How is it a hack? It is literally an important feature of the language, and is necessary in various areas in gamedev. Java has to compensate with 'design patterns' lel

>understanding doesn't mean you should care about it. The fact is, 99% of the applications don't need to care about it. Passing everything by reference in a safe manner can do the job.
And relying on it is cancerous. You are literally admitting to sucking dick because Java's got its dick so far up your ass
>>
>>54257846
How do I pass a class from package A to package B without allowing B to modify it?
>>
File: whogives.jpg (38 KB, 429x398) Image search: [Google]
whogives.jpg
38 KB, 429x398
>>54257370
Why is a bad language like English so widely used?
>>
>>54257863
>And relying on it is cancerous.
yes relying on JVM is better than relying on Pajeets writing buggy C code.
I am not saying Java is the best language every. No, it's bad but C is worse.
>>
This is a serious thread, lads. Everyone who hasn't read at least one book about type systems should leave.
>>
>>54257890
>yes relying on JVM is better than relying on Pajeets writing buggy C code.
JVM has nothing to do with it. And buggy code comes with any language

>I am not saying Java is the best language every. No, it's bad but C is worse.
Nah, C is not worse
>>
>>54257877
what?
>>
>>54257940
check and mate faggot
>>
>>54257483

Object Pascal is better than both at what both do, yet it's seldom used. But meme SJW pseudo-languages like JavaScript and Python are super popular. It's more political than anything.
>>
>>54257940
Pseudocode:

f() {
ClassA a = new ClassA();
g(a);
h(a);
}


How to make sure that g doesn't modify a?
>>
>>54257927
We were talking about memory management, so it has everything to do with it.
>>
>>54257954
Object Pascal is shit.
Use Ada
>>
>>54257954
>JavaScript and Python
They're popular because people know not to use it with super-intensive software, and with everything else, their dynamic typing, reflective and functional paradigms, as well as huge interpreter support means the package ecosystem grows faster and you can make more money due to all those packages, the fast nature of those programs and anything else that adds to the languages' expressiveness.

Denying it is futile
>>
File: image.gif (32 KB, 282x200) Image search: [Google]
image.gif
32 KB, 282x200
>>54257823
>Passing everything by reference in a safe manner can do the job.

Get out.
>>
>>54257972
Language features have nothing to do with the JVM. JVM manages your memory, sure, but it doesn't define how information is passed through functions, that's a language spec choice
>>
>>54257985

Use what?
>>
>>54257990
>I can do pointers
>I am low level haxor
come back when you actually get a job and encounter bigger than fizzbuzz programs. Whatever you are doing can be done by Rajeshes.
>>
>>54257963
java passes object references by value
re-assigning "a" to a different object in g() would not modify it outside of scope of g()
>>
>>54258029
>pointers are low-level
nice meme
>>
>>54258007
>JVM manages your memory, sure
which is my point. And if you are even trying to claim that Java is less reliable than C in memory management perspective, you should commit suicide.
>>
>>54258048
g(a) {
a.x = 1;
}
>>
>>54257370
Because it's platform agnostic
>>
>>54258058
Your point is that it manages your memory? Everyone knows that. The original point that it's shit because you can't explicitly pass by value or reference still stands
>>
>>54258059
class ClassA {
final int a;
ClassA(int a){
this.a = a;
}
}
>>
>>54258095
But I want to modify x in h.
>>
>>54258075
>The original point that it's shit because you can't explicitly pass by value or reference still stands
That point is weak and stupid. The problems you solve with Java don't need that control. Messing around with that stuff will do nothing useful in 99% of the problems.
>>
>>54258103
use setters and getters to control field access.
wrap a in another class that overrides the setter with a no op and pass it to g. pass the original object to h.
>>
>>54258139
Then why have `int` on top of `Integer`? Wouldn't just `Integer` suffice?
>>
>>54258139
>That point is weak and stupid. The problems you solve with Java don't need that control. Messing around with that stuff will do nothing useful in 99% of the problems.
Yeah, you don't need that control because you can't do anything worth a shit in Java anyway. If it weren't for Spring, Java wouldn't mean shit.

>>54258166
lmao look at the hoops you have to jump for basic functionality
>>
>>54258166
So I have to create a whole new class just to emulate what C does with the const keyword? Wasn't the claim that Java is simpler than C?
>>
>>54258174
Because Java is stupid. Is that what you wanted to hear? My point is that C is worse. Not that Java is good.
>>
>>54257669
>>54257632
everything is passed by value in C, you dumbass. if you're gonna shill C, at least learn the basics. you can only simulate passing by reference by dereferencing pointers, but the actual argument, e.g. a pointer, is always passed by value.
>>
>>54258186
>Yeah, you don't need that control because you can't do anything worth a shit in Java anyway.
You are talking about the language that handles the most complex problems.
>>
>>54257707
Tell that to companies.

And usually they don't want to change just so
>It just werks
And being using it for a long time, so they don't care changing.

Reason sometimes i still see old Oracle servers.
And they don't do it only cause they will safe on training or new servers.
>>
>>54258203
You are the dumbass if you don't know everything is passed by value at the lowest level, and pass-by-reference is just a convenient means of describing something
>>
>>54258191
You see, I just read "Java: The complete reference", a book by Oracle. It's a very bad book which nobody should read but anyway: In there it says that one should use the value type `int` because it's much faster than using the reference type `Integer`.

And then when it introduces the `>>` operator it tells us to write `>> 2` instead of `/ 2` because the first one is faster. That's quite interesting, wouldn't you say?
>>
>>54258225
>You are talking about the language that handles the most complex problems.
Like?

>>54258228
Enterprise Java is not used for complex things lmao
>>
>>54258190
>Wasn't the claim that Java is simpler than C?
No, C as a language, is as simple as you can get.
On the other hand, programs written in C are as complicated as you can get, which is what really matter.s
>>
>>54258252
Like Hadoop.
>>54258252
What do they use for complex stuff then? C? lol
>>
>>54257370
Because the JVM is pretty comfy
>>
>>54258309
Then use Scala.
>>
>>54258299
>Hadoop
>complex
shiggy

>What do they use for complex stuff then? C?
Yep
>>
>>54258234
it doesn't matter what happens at the lowest level, we're talking about language constructs. there aren't any loops at the lowest level either, but that doesn't mean high level languages don't have loops
>>
Ms. Mathara won't pick up the poo from the streets for free
>>
>>54258323
shitpost more.
>>
>>54258326
>it doesn't matter what happens at the lowest level,
It does, because by your definition, no language has the capability to pass by reference. The term is used for convenience, and C has that functionality
>>
>>54258319
I use clojure.
>>
>>54258186
>>54258190
you said java does not have immutable variables. it obviously does. don't try to move the goalposts.
>>
>>54258398
I actually said "immutable variables/references".
>>
>>54258398
>don't try to move the goalposts.
I, the first guy you quoted, am not moving any goalposts, considering I never made any. I just happened to see that you have to jump so many hoops just to get basic functionality
>>
>>54258417
that's what the final keyword does
>>
>>54258434
He means not class level but variable level.
>>
>>54258341
>because by your definition, no language has the capability to pass by reference.
only if you can't read. implementation details are irrelevant. C++ has the capability to pass by reference, C doesn't.
>>
>>54257877
By making read-only interfaces. If something takes an object, which exposes a mutating method, that something has every right to mutate it. That's just basic OO.
Also, you can always do it the way list does with immutable list. Just have a separate decorator implementation, which would delegate read-only methods and throw unsupportedoperationexception when a mutating method is invoked.
>>
>>54258462
>C++ has the capability to pass by reference
Nope
>>
>>54258493
If by "basic OO" you mean that Java's type system is so primitive that it only allows for basic OO. A language with a better type system that has immutable and mutable references wouldn't have to jump through those hoops because, when you have an immutable reference, then you can only call methods defined on the immutable reference. And such methods naturally don't modify the object.
>>
>>54258103
Frankly, why would you want to modify that in h, but block g from modifying it? Are you trying to implement some sort of security layer, but hard-coded? If a call declares public interface, any other class should be able to call it, otherwise all you're going to get is spaghetti clusterfuck.
>>
>>54258552
>A language with a better type system that has immutable and mutable references wouldn't have to jump through those hoops because
Those hoops are there to indicate that your design is poor. If your objects had proper synergy, they wouldn't be exposed to unnecessary interfaces. Objects aren't just data structures, with some algorithms bundled together. Instead, they are representations of actual things and concepts. Decompose your problem properly, and all will fall into place.
>>
>>54258693
I take it you've never heard of the concept of ownership?
>>
>>54258693
Not even him, but you barely refuted him. Java's type system is still so primitive.
>>
>>54258849
Ability or inability to modify the class has little to do with ownership. Maybe, just maybe, if H doesn't need to modify class A, it should be exposed to its public interface at all.
>>
>>54258939
You did not answer my question. It would make sense if you hadn't heard of the concept since it doesn't exist in Java.
>>
>>54257632
C is also unsafe which is why so there are so many bugs in server software.
>>
>>54259036
Java is also unsafe because it doesn't protect you from unsynchronized parallel modifications.
>>
>>54259036
>C is also unsafe which is why so there are so many bugs in server software.
So is Java
>>
>>54259054
Nope.
>>
>>54258999
I'm not him, just saying as it is. The concept of ownership is deeply connected with resource management and who gets to clean up. As you just wrote, it doesn't exist in Java and if you want to apply C concepts to Java, you should rethink your architecture first, just as >>54258693 wrote.
>>
>>54259071
Yep
>>
>>54259097
No, retard. C doesn't have a virtual machine it runs within, Java protects you from doing stupid shit like buffer overflows and pointer forging by eliminating pointers altogether. C can only be used to maintain legacy code, if you want a stable piece of software you use C#/Java or at least C++.
>>
>>54257370
It's not actually a bad language, it just has more shit-tier programmers because it's easier to use.
>>
>>54257411
"American roads found to be leading cause of hyperventilation in Indians."
>>
>>54259148
Good coding practices protect you from shitty code
>>
>>54257370
It was a language at the time that was open source, cross-platform and easy. This lead to its rapid and widespread adoption, and implementation in many large projects.

Now, it's being kept alive by a billion indian code-monkeys, Android and Minecraft.
>>
>>54259196
You go head and tell that to all the coders who write shitty C code ridden with bugs and memory leaks.
>>
>>54259257
If I can find any lmao

Maybe you should tell these imaginary people since you're so close to them
>>
>>54257881
>english
>bad
nigger what? its ez, expressive, and everyone uses it. Its better than dutch at least.
>>
>>54257370
It's decent for GUIs. Also it's widely accepted. Imagine trying to phase out USBs.
>>
>>54259275
Exactly the point being, no body writes C any more unless they're maintaining old shit.
>>
>>54259315
Just like Java, you have to jump hoops to even think you have a point lel
>>
>>54259333
Nice bait, but no. Java isn't going anywhere, because it's great for business logic and business is all about getting shit done, not fucking around with pointer arithmetic.
>>
>>54259390
>Java isn't going anywhere
Like I said, hoops, mentioning new, irrelevant things to think you have a point, trying to deter from the fact that you start mentioning all this imaginary buggy C code, and all these issues about pointers that you think you've experienced
>>
>>54259440
Imaginary buggy C code? Holy shit, you're fucking clueless, aren't you? I guess I need to stop replying now, because I can't tell if you're being retarded or merely pretending.
>>
>>54259488
You should definitely stop replying, because you are even awful at jumping hoops
>>
File: 1450736753700.jpg (74 KB, 707x682) Image search: [Google]
1450736753700.jpg
74 KB, 707x682
Hey look it's another rektal ravaged c "programmer"* angrily moving goalposts to prove something that is irrelevant to anyone else - thread

*only ever wrote a fizzbuzz
>>
>>54259586
You really are awful at this lmao
>>
>>54259594
>lmao
facebook is the other way
>>
>>54259619
Well I hope you have fun on the way back
>>
>>54259586
stupid cat poster
>>
File: 1452367354985.png (258 KB, 493x324) Image search: [Google]
1452367354985.png
258 KB, 493x324
>>54259631
cats > dogs

>>54259628
you want to hold hands on the way?
>>
>>54259661
>you want to hold hands on the way?
Only if you post more cats
>>
>>54257370

Java is widepread because it's a good language.

It's almost as fast as C/C++ (look up benchmarks) but much safer.

C with it's memory leaks is a walking nightmare and something like the challenger exploding wouldn't have happend with Java.


>>54259586

This.
>>
>>54259972
>something like the challenger exploding wouldn't have happend with Java.
It would. All that poo is asking for an explosion
>>
>>54257461
>>54258542
>>54259148
>all these people shitting on C++ while knowing nothing about it

hurts that you faggots push your stupid memes desu
>>
>>54259972
>It's almost as fast as C/C++ (look up benchmarks) but much safer.
Please, let's stop this meme. Java is LESS safe than C or C++ because every object is nullable.

>inb4 buffer overflows!
C is not less safe than Java in that respect, as long as you use an implementation that cares for that. Example bellow is GCC with the address sanitiser.

$ ./a.out
test.c:7:26: runtime error: index 4 out of bounds for type 'int [4]'
test.c:7:3: runtime error: load of address 0x7fff413e03b0 with insufficient space for an object of type 'int'
0x7fff413e03b0: note: pointer points here
03 00 00 00 c0 03 3e 41 ff 7f 00 00 c2 0a 40 00 00 00 00 00 02 00 00 00 00 00 00 00 1d 0b 40 00
^
=================================================================
==8992==ERROR: AddressSanitizer: stack-buffer-overflow on address 0x7fff413e03b0 at pc 0x000000400a2c bp 0x7fff413e0370 sp 0x7fff413e0368
READ of size 4 at 0x7fff413e03b0 thread T0
#0 0x400a2b in main /home/john/test.c:7
#1 0x7f77206e860f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2060f)
#2 0x400888 in _start (/home/john/a.out+0x400888)

Address 0x7fff413e03b0 is located in stack of thread T0 at offset 48 in frame
#0 0x400965 in main /home/john/test.c:5

This frame has 1 object(s):
[32, 48) 'niggers' <== Memory access at offset 48 overflows this variable
HINT: this may be a false positive if your program uses some custom stack unwind mechanism or swapcontext
(longjmp and C++ exceptions *are* supported)
SUMMARY: AddressSanitizer: stack-buffer-overflow /home/john/test.c:7 main
Shadow bytes around the buggy address:
[some more things here that I deleted due to character limit]
==8992==ABORTING


>C with it's memory leaks
Memory leaks are easy to solve, not to mention that the warn about memory leaks too.
>>
>>54260026
>not to mention that the warn about memory leaks too.
*not to mention that the sanitizers warn about memory leaks too.
>>
>>54257779
>SDL
cancer
>>
>>54260026
>Please, let's stop this meme. Java is LESS safe than C or C++ because every object is nullable.
what does that have to do with anything? how is it worse from C or C++ where every pointer is nullable and, what's worse, can point to everything in the program's memory and lets you dereference it without warning
>>
>>54260173
>what does that have to do with anything?
NullPointerException - lack of safety

>how is it worse from C or C++ where every pointer is nullable
Every pointer being nullable is better than every object being nullable.

>can point to everything in the program's memory and lets you dereference it without warning
This is wrong. Try doing
char x; int *iptr = &x;

You will clearly get some form of diagnostics.
>>
Because it was easy to pick up, the VM allowed for massive portability of programs, and Oracle was backing it. Now IT'S A SHITTY mess because has way too many libraries, JAR addons, Maven integrations, plugins, etc. It's all a jumbled fucking mess and picking up legacy code and configuring your system to program with it is a nightmare nowadays. Then there are design patterns and object hierarchies that people pull out of their ass on a whim. People make interfaces and abstract classes when there don't need to be any and don't make them when they should be there.

Java is best used for group projects in house where everyone can sitdown face to face and explain what the fuck an AbstractAnalFissureInspector is and how it relates to the project at hand.
Java has no place in open source programs which are shared with the world unless the dev makes damn sure to include very expansive, specific and detail documentation.
>>
>>54260203
>every object being nullable.
no, only references to objects are nullable in java. and accessing an empty reference throws a NullPointerException
>>
>>54260203
>NullPointerException - lack of safety
how on earth is it lack of safety? it enforces the safety of the program by stopping the current flow after you tried to dereference a null pointer
>Every pointer being nullable is better than every object being nullable.
java object variables are really just pointers to objects in memory. again, how is it better?
>>
>>54257370
because you don't have to bother with memory management and can focus on the logic
>>
>>54260326
Just use a functional programming language then.
>>
>>54260353
java 8 has functional interfaces
>>
>>54260386
Oh am I lafin.
>>
>>54260353
good luck writing anything more complex than fizz buzz. see how much of a chore is writing even a simple pacman game without mutable state:
http://prog21.dadgum.com/23.html
>>
>>54260026

>Hoglund and McGraw (2004) assert that buffer overflows – in the classic sense – do not happen in Java because "falling off the end of an object and spilling elsewhere is not possible". However, external code that interacts with Java – such as code
written in C – is an exception
(Hoglund & McGraw, 2004)

Kekk'd

>http://www.aabri.com/manuscripts/131731.pdf
>>
>>54260313
>again, how is it better?
That not every variable is a pointer. In fact the majority are not.

>it enforces the safety of the program by stopping the current flow after you tried to dereference a null pointer
At runtime, lol.
>>
>>54260745
>falling off the end of an object and spilling elsewhere is not possible
Wrong, try with arrays, you can still write after or before their end.
>>
>>54260774

No, it's not possible.
There is a fucking scientific paper that says it's not possible.

Java has automatic bound checking, meaning checking indexes at runtime before accessing arrays. You will always get an "Array Out Of Bounds Exception".
>>
>>54260760
>That not every variable is a pointer. In fact the majority are not.
and non-pointer variables cannot be null in Java.
>At runtime, lol.
what the fuck? when do you even want it to appear? it's literally not possible because the program may depend on some values that are supplied at runtime. you are really grasping at straws and can't even pretend to explain why C is better in that aspect.
>>
>>54260827
>There is a fucking scientific paper that says it's not possible.
Your paper is wrong then.

>Java has automatic bound checking
*My specific implementation of java has bound checking.
C does too >>54260026

>>54260926
>and non-pointer variables cannot be null in Java.
Except that you can't have that for most objects.

>what the fuck? when do you even want it to appear?
At compile time like proper languages (I am not talking about C)

>it's literally not possible because the program may depend on some values that are supplied at runtime
It would force the programmer to make the necessary checks for values supplied in runtime to confirm that they match the desired type.
>>
>>54260926
>it's literally not possible because the program may depend on some values that are supplied at runtime
babby's first run in with dependent types
>>
>>54260964

What?

>The Java and .NET Framework bytecode environments also require bounds checking on all arrays. Nearly every interpreted language will protect against buffer overflows, signaling a well-defined error condition.

>The problem of buffer overflows is common in the C and C++ languages because they expose low level representational details of buffers as containers for data types.


>https://en.wikipedia.org/wiki/Buffer_overflow
>>
>>54261044

So you are telling me you can corrupt the JVM, the interpreter or the JIT compiler itself?
>>
>>54260964
>Except that you can't have that for most objects.
every object variable is a pointer in Java
>At compile time like proper languages (I am not talking about C)
>It would force the programmer to make the necessary checks for values supplied in runtime to confirm that they match the desired type.
so you basically want checked null pointer exceptions, lol? and java already prevents from assigning the wrong type unless you explicitly cast instead of using polymorphism
>>
>>54261126
>null
>1970 + x
What idiot that skipped his type theory classes thought that it was a good idea to have null in Java?
>>
>>54261050
Yes, what?

>Nearly every interpreted language will protect against buffer overflows
*implementation

>The problem of buffer overflows is common in the C and C++ languages because they expose low level representational details of buffers as containers for data types
*Implementations

>>54261098
Not him but what does this has to do with anything?

>>54261126
>so you basically want checked null pointer exceptions, lol?
No, I didn't say anything about that. You are reading things that weren't said.

>and java already prevents from assigning the wrong type
This is not the kind of "type" I am talking about.
>>
>>54258240
>tells us to write `>> 2` instead of `/ 2` because the first one is faster.
x >> 2 == x / 4
x >> 1 == x / 2
>>
>>54261160
>type theory classes
Does any uni actually has that?
>>
>>54261234
Don't they have programming language courses anymore?
>>
>>54261126
>every object variable is a pointer in Java
java does not have pointers.
>>
>>54261168
>No, I didn't say anything about that. You are reading things that weren't said.
it's really hard to tell what you are talking about. you're constantly moving goalposts and haven't event explained yet what makes nulls in Java more dangerous than nulls in C
>>
>>54261280
>you're constantly moving goalposts
I haven't, my position was stable and clear from the start.

>haven't event explained yet what makes nulls in Java more dangerous than nulls in C
I have, in java most variables can be nulled, in C only pointer variables can. Simple as that.
>>
>>54261253
object variables in java are basically safe self-dereferenciing pointers. they don't hold the value of an object, just a memory address
>>
>>54261309
>I have, in java most variables can be nulled, in C only pointer variables can. Simple as that.
in java only object variables, which hold the memory address of the object, not the value, can be nulled
>>
>>54261361
>which hold the memory address of the object
Depends on the implementation.

>only object variables
Yes, just as I said, "most variables". What are you on about?
>>
>>54257370
Android, compile once run anywhere, easy to get started with, graphics without a hassle.
>>
>>54261381
>Depends on the implementation.
no, it doesn't. an object variable cannot hold the object's value, like it's possible e.g. in C++. it's in the language specification
>Yes, just as I said, "most variables". What are you on about?
no, it's literally one type of variable, all inheriting from Object, while you have non-nullable booleans, ints, etc. you can just as well say that most C variables are pointers
>>
Java was initially designed to run on micro controllers. Imagine that. Instead it now runs the web via applets.
>>
>>54261522
One might very well ignore the existence of those primitive types as they exist merely as a leaking optimization.
>>
>>54261522
>an object variable cannot hold the object's value
Nothing with what I said (I talked about holding the memory address).
However, I would be interested on a proof on "it's in the language specification".

>it's literally one type of variable
That "one" type of variable sadly is most variables in Java.
>>
>>54261381
if you care that much about objects being nullable, just wrap them in Optional
>>
File: 1.png (447 KB, 605x532) Image search: [Google]
1.png
447 KB, 605x532
>>54261554
>>
>>54261579
What's Optional?
>>
>>54257483
>doesn't allow the user to define value types
Doesn't It have enums?
>>
>>54261612
https://docs.oracle.com/javase/8/docs/api/java/util/Optional.html
>>
>>54261160
Null is about revoking objects. You're still thinking of the Fortran/C/Haskell punch card mechanism of separate compilation instead of interacting objects.
>>
>>54261579
What does this have to do with anything?

>>54261589
He is correct.
>>
>>54261620
Enums are value types?
>>
>>54261576
>Nothing with what I said (I talked about holding the memory address).
>However, I would be interested on a proof on "it's in the language specification".
4.3.1
>An object is a class instance or an array.
>The reference values (often just references) are pointers to these objects, and a special null reference, which refers to no object.
>>
What's your take on Rust from Mozilla? Their new browser engine Servo will be written in it and it's supposedly as fast as C/C++ while not having their memory problems. There's even a unix-based os called Redox written in it.
>>
>>54261630
Now you're defending null? Amazing. Even the "inventor" of null realized that it was his biggest mistake. Languages whose designers haven't been out of the game for 50 years use algebraic data types.
>>
>>54261706
The best new language of the last 20 years that I know of. Not that it doesn't have serious problems.
>>
>>54261624
That doesn't seem to solve anything because I can simply pass null in place of Optional.
>>
>>54261694
Pointer does not necessary mean "memory address" in any proper language (yes, this includes C).
>>
>>54261706
It's shit. They advertise it as the next big thing but it doesn't solve anything it hasn't been already solved while ignoring tons of research. Not to mention that ruby hipsters and sjws like it.
>>
>>54261786
What research does it ignore?
>>
>>54261786
I forgot to mention the hideous syntax.

>>54261813
Dependent types for example.
>>
When you write good code, it doesn't matter which language it is.

Java is portable and let's you concentrate on programming rather than worrying if someone has some library installed on their system.
I wouldn't write HPC code in Java, but I don't see a problem writing some nice, useful application for users with different OS.
>>
>>54261828
Dependent types are quite exciting. Can't wait to see them in a real(ly useful) language.
>>
>>54261725
>"inventor" of null
He didn't invent it. There was already nil in Lisp and null in PL/I.

>algebraic data types
They don't solve the problem of revoking objects. A wrapper around each revocable object solves the problem, but in reality, all objects are revocable. You can't assume that any object will last forever.
>>
>>54259278
The irony when you can say those exact three things about Java as well.
>>
>>54257688
anal sex etc.
>>
>>54257954
Blame Borland for their bad decision at that time.
>>
>>54261706
horrible syntax + naming sense. I almost puked seeing their IO examples
>>
>>54257877
>>54257940
>>54258493
>have never heard of the keyword 'final'
>>
>>54257954
I wish languages like Ada or Pascal weren't dead. programming is fucking boring nowadays and you can't just learn a new language to try something new and switch jobs because there aren't any except for the most popular languages. it's basically only Java/C# or hipster languages, maybe some C++ if you look hard enough.
>>
>>54257842
Confirmed for sanjeet
>>
>>54258356
mein nigger
>>
>>54262326
confirmed for moaning sanjeet
>>
>>54257441
Because oop concepts are haaaaaaaard
>>
>>54257370
When you think Java, you're thinking of swing, Enterprise Software Solutions (TM), and CS301 assignments.

I used to think it was just okay, until I saw how Google does it. It's so goddamn beautiful, it's hard to believe it's the same language.
>>
>>54262610
Link some of that beautiful code.
>>
>>54262610
This

Java codemonkey here: the contrast between java code written by people who just want to make something that works vs Le Enterprise is just disgusting. Enterprise projects are absolute cancer, I couldn't believe my eyes at first, everything about projects in enterprise is just completely wrong, counterproductive, unpredictable, unsafe, incoherent, platform-dependent, tightly coupled, etc
>>
>>54262583
confirmed for americuck that's surrounded with all kinds of brown people in his big melting pot of a country, can't even compete with them and feels threatened enough to bring them out in every /g/ thread. I literally haven't seen an indian in my life
>>
>>54262627
Guava is open source and has some neat stuff.

They also use protocol buffers instead of pojos for their models, at least internally. That gets you
>immutable state
>a schema
>fluid builders
>a wire format
All for free, in a more robust way than if Dave in the cube next to you tried to roll it himself.
>>
>>54258174
Collections can only store objects, hence the need for boxing/unboxing int <-> Integer

>>54261756
But for the client to use Optional<T> they must first unwrap it (i.e. check for null).
>>
>>54262927
>But for the client to use Optional<T> they must first unwrap it (i.e. check for null).
Now they have to check for null twice instead of once.
>>
>>54258240
>And then when it introduces the `>>` operator it tells us to write `>> 2` instead of `/ 2` because the first one is faster. That's quite interesting, wouldn't you say?
it doesn't matter. modern Java compilers do that behind the scenes
>>
>>54262969
Who am I to believe? After all, that book was written by the "foremost Java expert" and published by Oracle Press.
>>
>>54257379
Sad truths here
>>
Why can't we just migrate to python???

>muh simplicity
>muh intuitiveness
>muh "define"
>>
>>54257370
because
>muh J2EE
>muh beans
>muh giant SDK
>muh eclipse
>muh JVM even on coffee maker
>muh college introduction to OOP
>>
>>54261706
I went through about a third of Rust By Example last night. I know it's because I hate learning new things, but it felt like Perl syntax with go's rigidity.

>println!("Pi is roughly {:.*}", 2i32, 22.0f64/7.0f64);
>>
>>54263011
>muh slowness
>muh lack of static typing
>much lack of braces which makes the program hard to read
>>
>>54261637
>not manually defining every valid integer value in your enums
>>
>ITT
>Shillers shilling about how their fav lang is > java
>>
>>54263893
there's literally nothing wrong with liking java and it's the language for getting shit done nowadays
>>
>>54257483
How do 16 bit char types make no sense? Unicode characters are 16 bits.
>>
>>54263975
There are more than 2^16 unicode characters.
>>
>>54257877
Just don't put any code that attempts to modify package B. Are you afraid of code fairies fucking with your classes?
>>
>>54264015
Let me tell you, Pajeet is no fairy.
>>
>>54257483
>but it has nul
nulls don't make the language unsafe
>but doesn't allow the user to define value types themselves
nothing wrong with that. typedefiing makes you look like a microsoft programmer from india
>>
>>54264056
C# let's the user define value types.
>>
>>54264066
what's the syntax?
>>
>>54264105
Write struct instead of class.
>>
>>54262262
Final still allows you to mutate the object. You just cant change it to a different object. It isn't the same thing as constant.
>>
EPIC MEMEING /b/ro BAZINGA BAZINGA BAZINGAAAAAAAAAAAAAAAAA ZIMBABWE is this a le new epic meme? screen kapped for dat sweet karma xD.
>>
>>54264156
good shit go౦ԁ sHit thats some goodshit rightthere rightthere if i do ƽaү so my self i say so thats what im talking about right there right there (chorus: ʳᶦᵍʰᵗ ᵗʰᵉʳᵉ) mMMMMᎷM HO0OଠOOOOOOଠଠOoooᵒᵒᵒᵒᵒᵒᵒᵒᵒ Good shit
>>
File: image.jpg (52 KB, 349x300) Image search: [Google]
image.jpg
52 KB, 349x300
>>54264156
>>54264178
>>
File: 1451201712524.jpg (139 KB, 666x666) Image search: [Google]
1451201712524.jpg
139 KB, 666x666
>Maven
>Gradle
>Eclipse
>All those meme frameworks that fall apart
Java was a mistake
>>
>>54264368
>maven
>falls apart
>>
File: image.jpg (33 KB, 265x259) Image search: [Google]
image.jpg
33 KB, 265x259
>>54264368
>not using ./gradlew GetDressed to put on your undies in the morning

Get a load of this pleb
>>
>>54264377
>>54264415
pajeets with brain damage
>>
>>54264420
Enjoy your millions of platform dependent shell scripts
>>
>>54264460
>not writing your shell script in portable assembly
indian education at work
>>
>>54264420
>blames the language for third-party frameworks
literal retardation
>>
>>54264498
you reap what you sow
>>
>>54264420
>>54264472
you seem to be very obsessed with indians. do they fuck your mom or something? I haven't even seen one IRL and couldn't care less
>>
>>54264544
I went to India once. Here's my story: https://www.youtube.com/watch?v=mPne-q4ynts
>>
>>54264544
>do they fuck your mom or something?
I don't know how that would be possible. They're considered one of the least attractive races, second only to blacks.
>>
>>54264472
>portable assembly

Nigga you drunk?
Thread replies: 225
Thread images: 9

banner
banner
[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y] [Home]

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
If a post contains personal/copyrighted/illegal content you can contact me at [email protected] with that post and thread number and it will be removed as soon as possible.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com, send takedown notices to them.
This is a 4chan archive - all of the content originated from them. If you need IP information for a Poster - you need to contact them. This website shows only archived content.