[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
the age old question
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: 88
Thread images: 7
File: Capture.png (42 KB, 754x410) Image search: [Google]
Capture.png
42 KB, 754x410
Well I found another idiot thinking C++ is far superior compared to Java. Not in performance or anything, just that it's "superior". Told me to ask /g/. Might as well. What are your guy's thoughts?
>>
>>51958678
i hope you catch anus cancer
>>
>>51958691
thanks
>>
>>51958678
Java just happened to have shitty compilers until recently. That's why people attribute it as a shitty coding language, even though with modern compilers it's performance approaches C.

Also, normies confuse it with JavaScript, which is indubitably shit.
>>
File: 1446998776461.jpg (32 KB, 479x492) Image search: [Google]
1446998776461.jpg
32 KB, 479x492
>>51958678
Both are shit languages, but Java is more so because it's interpreted instead of compiled to assembly.
Fuck off back to reddit.
>>
>>51958678
>But good java code is faster than bad c++ code
Well duh, but retards should stick with python.
Good c++ is faster than good java code.
>>
>>51958678
Java code is in fact considerably slower than comparable code written in C++. I won't argue the generic superiority thing.
>>
>>51958983
>it's interpreted
It's not. Learn what JIT is. In some cases it cane even give better optimization than static compilers could ever provide.
And java has superior memory model.
And JVM is one of the best pieces of technology out there.
And C++ is fucking terrible
t. java hater
>>
>>51958678
C++ is for niggas who eat bananas in one bite.

Niggas that use C++ pull up to the club in a horse and carriage.

C++ niggas kiss each other while waiting for there code to compile.
>>
>>51959087
>java
>good memory model

>STOP EVERYTHING jvm
>good

>>>india.org
>>
>>51959377
You probably don't know what memory model is.
Have a read.
https://en.wikipedia.org/wiki/Memory_model_(programming)
>>
>reddit
cancer
>>
>>51958678
how do you like using the "===" operator 24/7?
do you like the fact that 1 == "1" is true
and that 0 === false is false?

also
java is not meant for video games
its mostly an educational language
>>
I hate being forced to be OO all the time, but C++'s syntax makes me go cross eyed sometimes.
>>
Java is bad is a meme. It's used to uncover /v/ermin and anyone who takes it seriously should leave /g/.
>>
>>51959568

See

>>51958930

Disclaimer: I hate java
>>
>>51959441
OP and >>51959087 (maybe be op) for sure, possibly others.
>>
>>51958678
>covering leddit usernames
>>
Comparing C++ to Java on non-performance related matters is mostly subjective. With regards to performance, the problem with Java can be summed up as follows:

In Java, all objects live on the heap, and are passed exclusively by pointer. It is not possible to have an array or vector of objects that are contiguous in memory. The logical conclusion of this is that no amount of JIT performance optimizations will be able to outweigh the performance drawback from cache misses, especially where idiomatic Java is used, rather than Java specifically designed to squeeze out every last ounce of performance one can from their application.

Where performance is of any concern, just use a programming language that compiles to native code.
>>
>>51959377
You are aware that your operating system will stop your processes for an undefined time because of scheduling, right?

Also please tell me a better optimized and more sophisticated GC than what the JVM implements.
>>
File: 1443774827910.jpg (164 KB, 800x600) Image search: [Google]
1443774827910.jpg
164 KB, 800x600
>>51958678
>yfw you realize they're talking about minecraft
>>
>>51960129
Woah they learn programing at 7? Thats impressive
>>
>>51958678
They are different tools for different tasks.
But Java is fucking comfy, that's for sure.

If you work on a desktop project, Java is comfier.
There is SWT, JFace, Swing, etc. Maven.
And the meme that Java is slow mainly is about the first-startup of JRE.
Which was true years ago when people had 512MB of ram, and a shit HDD.

Now that people have fast hard drives, SSDs, tons of ram, it takes like 1 second to load up a Java application for me.
Execution time was always top-notch, enterprises have been using Java for a decade now.

With that said, I use Python, C#, C++. Whatever works for the project.
- If I have to whip up something quick: Python
- If it needs to work on Windows + GUI: C#
- It it needs to be cross-platform: Java
- Low-memory/performance intensive/3D: C++
- Linux: C

By the way Java also comes with a crapton of good libraries.
So you don't need to reinvent the wheel. It's comfy.
>>
>>51958678
If you don't need extremely good performance, Java is always the better choice. It removes a whole bunch of unnecessary crap from C++ like memory management and multiple-inheritance and lets you focus on accomplishing whatever you're trying to do.

I still wouldn't code in either of them if I had the choice, I much prefer Obj-C, Swift, Ruby, Python, etc, etc
>>
>>51959049
That's bullshit though.
Write it, compare it, you will see.
It may happen that JVM makes a wrong optimization, which can also happen in C++.
If that happens, in both languages, you resort to the use of hacks and quirks.
>>
>>51960344
Meme language needing meme tech. Wow.
>>
C++ is pretty shit because of loads of reasons. One of them is having a very hard to parse grammar, resulting in long compilation times and unintelligible error messages. Forget a brace or semicolon and it doesn't know what the fuck is going on anymore. Compared to easier parsable languages that tell you exactly what went wrong, where and how you can fix it if you have a decent compiler.
>>
>>51959403
thats only for multi threaded programs, and java code monkeys cant into threads
>>
>>51960462
Threads are pretty damn simple in Java, much harder in C/C++
>>
>>51959403
that actually makes java safer but slower
>>
>>51960460
>claims c++ is shit because it doesn't allow mistakes

does your mommy also wipe your ass?
>>
>Header files
WHY
>Except templates they don't work there lel
WHY
>>
>>51960462
literally takes a few lines to thread in Java

>>51960415
> having a <5 years old hdd is now a meme
> having 2GB of ram is a meme

This is /g/!
>>
>>51960460
that's the compiler, gcc is awful with messages.
clang helped me with all my work/assignments in C and C++.
it worked wonders.

like I fucking KNEW finally what is wrong with my code.
with GCC: "error". THANKS!
>>
>>51960344
gui java applications on linux can't into proper font rendering. it's terrible.
>>
>>51960498
I don't see why you wouldn't want your language to catch your mistakes during development, instead of waiting until your code is in production to realise how you fucked up. Java's errors are annoying, but it's better than Objective-C where you can spend ages trying to track down the nil pointer that silently fails when you call a method against it
>>
>>51960475
>>51960508
they are very similar, you have thread class, it has join member, mutex class, lock and unlock members and guards classes, future classes and all other helper classes
void foo() 
{
// do stuff...
}

void bar(int x)
{
// do stuff...
}

int main()
{
std::thread first (foo); // spawn new thread that calls foo()
std::thread second (bar,0); // spawn new thread that calls bar(0)

std::cout << "main, foo and bar now execute concurrently...\n";

// synchronize threads:
first.join(); // pauses until first finishes
second.join(); // pauses until second finishes

std::cout << "foo and bar completed.\n";

return 0;
}

you cant make this code simpler in java
>>
It's superior for him because he can figure it out unlike C++
>>
>>51960498
>he never had to search for 15 minutes where he forgot a semicolon
Nigger please, everyone makes small mistakes and it's a pain when you have to look for everything manually
>>
>>51960540
Use an IDE or anything that tells you you forgot a semi colon?
>>
>>51960547
I use VS. Doesn't tell me much useful stuff for c++. C# on the other hand is great regarding the compilers error messages
>>
>>51958678
It's true that coding skill is significantly more important than language in terms of performance

Using Java is still stupid though
The installer contains adware and C# does everything better
>>
File: 1431405459597.jpg (36 KB, 396x327) Image search: [Google]
1431405459597.jpg
36 KB, 396x327
>>51958930
>>51959087
>>51960373
there is no question that well-written c++ is faster than well-written java. in addition to the already definitive difference between a native and virtual runtime, c++ doesn't allocate everything on the heap, has templates (metaprogramming, static polymorphism) that can migrate a lot of work to compile time, the standard library is templated, and explicit memory management (done correctly) or even smart pointers will always be faster than a garbage collector. then you have java's all-heap memory, overabstracted standard library, and excessive virtualization. and that's just off the top of my head.

also see
>>51960089
>>
>>51960567
It doesn't? Granted I have limited experience in C++ but I recall code::blocks telling me if i fucked up something as simple as semi colons.

it was pretty cryptic for other things tho
>>
>>51960524
That's AWT.
Swing works.
And if you want a beautiful GUI, you use SWT and JFace anyway.

The only drawback for the latter is that you have to test your application on all platforms.
Because it uses native widgets.
But, on the other hand, it is the fastest, it looks the greatest, etc.

My program was a beauty to the eye on both Windows and OS X (and Linux).
>>
>>51960567
then you are clinically retarded, VS has the best error reports, if you cant work with it then just quit, programming is not for you
>>
>>51960586
Look. Write it, measure it. You will see.
Others already did this, and they have proven it.
I mean, do you hate coding? It's a fun exercise.

>>51960529
Yeah but on the other hand all the IDE for C++ are garbage.
Visual Studio is not that bad, if you have the overpriced addons installed, like VAssist or ReSharper.)
JetBrains said they are working on a proper C++ IDE, but I don't think it ever got released.

> inb4 using IDE
IDE is comfy.
If it works well, if it works for you and not against you.
For Java, all the IDEs are pretty much like this.
>>
>>51960613
for C++ the reports are pure garbage though.
for C#, I agree with anon, it's god-tier.
>>
>>51960586
>well-written c++
Which is a rare thing. And it's harder to well-write large project in c++.
>>
>>51960596
I don't know what is awt or swing. I'm not a java coder.
Fact is that jetbrains IDEs look awful on linux.
>>
>>51960529
void food(){
//do stuff
}

void bar(int x){
//do stuff
}

public static void main(String[] args){
Runnable r1 = () -> foo();
Runnable r2 = () -> bar(0);

Thread t1 = new Thread(r1);
Thread t2 = new Thread(r2);

t1.join();
t2.join();

return;
}
>>
>>51960671
Forgot to start them, but whatever
>>
File: Clipboard01.jpg (102 KB, 1605x670) Image search: [Google]
Clipboard01.jpg
102 KB, 1605x670
>>51960625
>all the IDE for C++ are garbage.
this is qtcreator and mingw, you can click on error and it will move you to the place just so jyou can correct it, vs is probably even better, if you cant read and understand error messages then you are just stupid
>>
>>51960505
Modules are coming.
Clang supports them already, gcc not quite yet. VS is trying to as well.
>>
Is VS better than IntelliJ for C++?
>>
>>51960671
>>51960678
>
  Runnable r1 = () -> foo();
Runnable r2 = () -> bar(0);

>Forgot to start them, but whatever

i dont have to do this in c++ thats more complex :^)
>>
>>51960671
And now groovy:

void foo(){
//whatever
}

void bar(int x){
//whatever
}

public static void main(String[] args){
List threads = []
threads << = new Thread{ foo() }
threads << = new Thread{ bar(0) }
threads.every{ it.start() }
threads.every{ it.join() }
}
>>
>>51960666
AWT is the very old, garbage GUI toolkit.

Swing is the newer one, NetBeans uses it.
It rooks same on all platform.
While it's not native, slow, you don't have to test your code everywhere.

SWT is native. Fast, nice looking.
But then again, Windows controls, Linux controls, etc, they all rook different.
So you have to test your shit on all platforms.
Maybe apply platform specific layout here and there. (Tiny bits only)

And JFace is pre-written SWT widgets.
With JFace it's piss easy to throw together a GUI.

>>51960679
Only used QtCreator for Qt projects.
Can it do _raw_ C++?

>>51960689
VS is much older/mature.
With "C++ Resharper", I think VS wins for now.
>>
>>51960692
C++
    auto t1 = std::thread([]{ foo(); });
auto t2 = std::thread([]{ bar(0); });
>>
>>51960703
Okay, taking C++ course in fall I'll look into VS. Was just comfy with intellij + vim plugin in java
>>
>>51960703
Problem is not with controls/widgets or looks.
Problem is with font rendering.
>>
>>51960709
i dont think you understand, its
auto t1 = std::thread([]{ foo(); });
auto t2 = std::thread([]{ bar(0); });

vs
Runnable r1 = () -> foo();
Runnable r2 = () -> bar(0);
Thread t1 = new Thread(r1);
Thread t2 = new Thread(r2);

in java these thread are not even started, c++ is superior
>>
>>51960625
>You will see
haha okay. i've been a programmer for almost a decade, mostly c++ and c#, both of which are better than java in general, in my opinion. c++ is faster by far, and c# while on-par as far as performance is better in every other sense as far as i'm concerned. but you know you can like java while admitting it's not the best at everything, right? no language is the best at everything. java trades some performance for simplicity and deployability, which is a totally justifiable thing for a language to do (c# does the same thing). but it's not faster than c++. outright denial just makes you look like an idiot
>>
>>51960701
pretty much the same as c++ but with manual start
>>
>>51960734
That's what I meant, I'm on the C++ side.
Although sometimes you don't want to start a thread on construction...
>>
>>51960734
starting threads is not issue in whatever language.
issue is synchronization, locks, memory management, etc.
>>
File: 1511.jpg (9 KB, 229x207) Image search: [Google]
1511.jpg
9 KB, 229x207
>>51960751
i always use them combined with shared_ptr

>>51960754
yes, both java and c++ have similar synchronization mechanisms like mutexes, futures, atomic variables, whatever, the point is c++ code can be shorten than java and run faster then it, kek m8
>>
>>51960703
>>Only used QtCreator for Qt projects.
>Can it do _raw_ C++?
yes, just select non qt project, you can also use cmake for project management
>>
>>51958678
Virtual Machines even with JIT and garbage collection are shit. The reason your ipod still works is because the apps were written in Objective C.
>>
>>51960856
>Objective C
they work because apple forgot to update their api
>>
>>51960586
>there is no question that well-written c++ is faster than well-written java

Yeah, but it is probably also a fact that writing good c++ code is much harder than writing good java code
>>
I can't stand this fucking "bla bla bla no language is better than another because if you write bad code in one it will be worse than good code in another", FUCK YOU.

I hate that argument. That's fucking idiotic. That's like saying flavorless instant noodles taste just as good as a 5 course meal from a world renowned cook, because if you take a shit on said meal, the noodles will taste better.

Oh really, shitlord? But what if you don't? What if you write good code in BOTH languages? Which one will perform faster? Require less memory? Start up faster?
And also, how EASY does the language make it to write good code, and how easy does it make it to write totally fucked up hack-shit that still appears to work (think PHP).
>>
>>51958678
C++ is horse anus to code in but ends up mostly faster (there's a reason all AAA games use it).

Java is a better language and is fast in some very specific scenarios but otherwise slower, plus it always and undeniably uses more memory unless your C++ code is terrible.
>>
>implying monads aren't the perfect answer to multithreading
>>
>>51958678
There's many features Java simply lacks, it literally pained when I tried it after C#. And many design choices hurt performance real bad, like lack of structs and real arrays.
>>
>>51961552
STM can be done with or without monads. But for lanuages with syntactic sugar for expressing monadic computations, it's certainly a nice bonus.
>>
hey faggots,java is getting an offical aot compiler so the programs you write in java will no longer need the jvm to be installed on the users computer and will be much.much more efficient.
>>
File: 1011.png (71 KB, 619x550) Image search: [Google]
1011.png
71 KB, 619x550
>>51961757
>will no longer need the jvm to be installed on the users computer
so it will be compiled with final binary?
>hello world
>230mb
i can see it
>>
>>51960129
Frogposter, report this fag
>>
>>51958678
I mean this with the best of intents: The fact that you are asking this question demonstrates that you are a teenager who has never implemented anything of value in either.

If you want to program, pick ANY language and implement something interesting in it. Release it and support it for a while. You will learn far, far, far, far more by doing this than by endlessly researching and debating the syntax of different languages and the runtime performance of their implementations and blah blah blah.
>>
>>51961796
>>51961779
^ weeb poster, report this fag
>>
>>51960344
when I switch from python to java what will be the biggest change. Before python I dabbled in C and have done memory management programming tasks. I know what a pointer is and have an idea of pointer arithmetic and why it's used.
>>
>>51963993

Using an actual programming language, not a scripting language.

There is a reason companies like Google only use Python for quick scripts and rapid prototyping.

Also, there really isn't any memory management in Java, the JVM does that.
>>
>>51960540

Are you retarded? GCC gives the missing semicolon not on the line you forgot it, but when it hits something that should come after a semicolon (like a brace). Look like 1 line above where GCC said it was missing a semicolon.

Hell, you could also just slap it on the start of line you got the error too.
>>
>>51960902
This pretty much

God I hate it when Javafags start going on about how their language is just as fast as C++ because it's easier to write decent Java code. The reality is that once you get the hang of things writing a decent Java program is about as easy as writing a decent C++ program to do the same job and apart from a few specific tasks the C++ program will be faster.

Sure, it's easier to learn how to make a decent java program, but when you're programming you're generally a beginner for the beginning part of your programming career and most of your career will be spent as an experienced programmer capable of writing good C++ program.
>>
>>51958678
Both are amazing languages, but C++ is better, my opinion
>>
They're both very good, simply better at different things
C++ will generally be better than Java for game development which this seems to be about, but that doesn't mean nothing should ever use Java or that C++ is outright better
It also doesn't mean a game written in C++ will perform better than a game written in Java
>>
>>51959568
that's not that hard because

0==false is true.
Thread replies: 88
Thread images: 7

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.