Speed Coding: Pong in C++ AND Java | Which is Better?

preview_player
Показать описание
FOLLOW ME ON TWITTER FOR CODING TWEETS:
["Show More" for full description]
◘▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬◘

For access to the source code, follow my twitter account and send a direct message for request!

Watch my Java Speed Code!

Today I take on the challenge of coding the classic arcade game, Pong, in both C++ and Java continuously. I then conclude an opinion on what I personally think which language is better for simple game programming.

I know the code was very sloppy, as I was just going as fast as possible (kind of). Also, a good portion of the Java code was the setters and getters of the classes, which wasn't added in C++, so the amount of code were similar. However, I felt like coding in C++ was more organized than Java.

C++ Programming starts at 0:28
JAVA Programming starts at 9:44
Final results start at 16:11

_____________________________________________________
C++ w/ SFML Library on Visual Studio 2012

Java using JCL default library on Eclipse

Music :
Ivan B - She Gotta Stay
Hoodie Allen - The Chase is on lyrics
Ivan B - What's The Plan
Ivan B - About You (Prod. Tido Vegas)
Ivan B - You'll Be Alright (Prod. Tido Vegas)
Рекомендации по теме
Комментарии
Автор

Meanwhile, the only thing I can do is pop up "Hello World" on your screen.

Flames
Автор

I stay high all the time to keep C++ off my mind.

Mooselover
Автор

Do pong in assembly now :D
or pure binary, because who need something readable

alkeryn
Автор

So, you code something in C++, then you code the same thing in Java. Why wouldn't it be easier? If you want a fair comparison, make the entire design first on paper (language neutral), and then compare how long/difficult it is to translate the design to a real programming language.

thought
Автор

"if you choose the quick and easy path you become and angent of evil" Joda
so C++ for the win

Foxtrop
Автор

hmm....getters and setters can be generated with eclipse, which saves many of your time

MIO_sh
Автор

I'm more of a C++ Guy, I know NOTHING about java, but I can tell your java code was messy. I saw you pasting your code over and over, I bet there is some sort of way to fix that like in C++ by inserting it into a function and calling it, this is probably why your java code was longer then your C++. Anyways, good job! I liked the C++ version better because it seemed to run smoother

Livermoreking
Автор

BTW, you don't need 'this->" in modern C++. For example "this->y = 5;" can simply be written as "y = 5;"

shadowmil
Автор

I have a knowledge of 11 programming languages.For a successfull comparing C+ with Java, we must set minimal 3 checkpoints. First - a coding text, how many rows of code must be write. Second - highly cpu/gpu intensive process as graphics.Third - block implementation. Input a new code of block to latest project. How its easy or hard to change a code.

Anyway, both languages have a lot of functions, with them you can create a great project. Java was based on C++, and C++ was based on C. Do not forget it. And your future is in your mind. Stay creative and build a better world.

mrstanlez
Автор

Chill guys it’s just programming languages. I don’t understand what’s to argue about. If you have good knowledge of either one you can learn the one in a week. Or any other programming language. data structure and algorithms is core and most important things

dwh
Автор

I don't know about C++, but in Java Eclipse in debugging mode you can make code changes during run time without restarting the program to see the effects. I couldn't tell if you were doing this, but it can increase efficiency massively, particularly if you have a second monitor you can place the program on.

ComputersAreRealCool
Автор

good work. a few notes:
-initialize a class's member variables in the constructor initialization list rather than assigning them to the constructor body.
-you can have a main class, and in your main function create an instance and call the main method of that instance

robinbuster
Автор

Great music choice man and awesome programming dude :) So cool!

LumeoEdits
Автор

In Eclipse, if you hover over your instance variables, you can auto-generate setters and getters for them - just a simple tip. Nice video.

geekybench
Автор

I really liked your speed edit, but the music was also one of the best parts as well. Good pick and great video +CodingBash.

codyw
Автор

I prefer good old fashioned C. For speed it beats both of these. And personally, I find C less of a headache, but that may be personal preference.

NeilRoy
Автор

In the cpp version you messed up the paddle2 spacing for collision as well..

Автор

Nice ! have written pong myself long time ago in C++.

At the moment im using both C++ & java for my stuff.

Made alot of Android games, and PC software.

Java for my Android games, and C++ for my pc software!

Don't know which one i like the most, both have their unique charm.

bytacc
Автор

I'm a C++ fan but I love the portability and mod capabilities of Java. Minecraft, for example, is done entirely in Java and people have been making mods for it for years. I play Feed The Beast which is a heavily modded version of Minecraft with over 100 mods and the frame rate remains high. Java can hold its own in 3D graphics. I like C++ for the vast libraries, support groups, books, tutorials, and hardware advantage on PCs. Thanks!

bjmgraphics
Автор

Nice vid. Wrote a colouring game in java before for one of my uni courses using just java built in library. It was fun. Learned how to create animation, sound fx, background music and levels. It wasn't too hard and took me about 25-30 hours lol. Not sure if it would take me that long if I've done it in c++

damiann
visit shbcf.ru