SRL Archive - News and General

C++ or java?


rj

2013-01-14 21:40:14

Recently tried picking up java but it is so annoying to code in and i Get tons if errors… Also c++ seems more useful in the long run in terms of uses/game development/speed….

Any way I don't want to waste time on java because I always end up getting poised off at it :)

Brandon

2013-01-14 21:53:55

From: rjj95
Recently tried picking up java but it is so annoying to code in and i Get tons if errors… Also c++ seems more useful in the long run in terms of uses/game development/speed….

Any way I don't want to waste time on java because I always end up getting poised off at it :)



Well, I don't want to burst any bubbles here or change your mind.. But, here's my opinion and my view:

IF, for whatever reason you think any language is hard, you need a bit more confidence, time, and practice. Practice makes perfect, but that can never be said for languages like C++ or ASM or any language. You can be good though.

IF you think Java is hard, well you probably will dislike C++ as it is both procedural and object oriented whereas java is just object oriented..

IF, for some reason, you hate Java errors and stack traces.. You haven't met C++ Templates yet.. The longest error I've gotten was 13 lines long and made no sense, pointed to one line, and online forums was of no help :l

I think my profile picture explains pretty much sums up what every C++ programmer experiences when beginning.. The same can be said for Java, but it is no where near as hard and at least comes with quite a large amount of already made functions/packages/libraries.

If you like DIY stuff, C++ is definitely the language for you. If you like stuff where you just need a little push, want to develop quickly and don't care much for speed, Java/C# is for you.. I must say though, Java is pretty fast for some things though..


Why not learn both? They're different experiences.. Anyway, if I seriously have to choose, C++ all the way. LOL. If you can program in C, C++, or ASM, you can adapt to any other language with ease. Transition is fairly easy from C-style to any other but I'm not so sure about the other way around..

rj

2013-01-14 21:59:12

From: Brandon
Well, I don't want to burst any bubbles here or change your mind.. But, here's my opinion and my view:

IF, for whatever reason you think any language is hard, you need a bit more confidence, time, and practice. Practice makes perfect, but that can never be said for languages like C++ or ASM or any language. You can be good though.

IF you think Java is hard, well you probably will dislike C++ as it is both procedural and object oriented whereas java is just object oriented..

IF, for some reason, you hate Java errors and stack traces.. You haven't met C++ Templates yet.. The longest error I've gotten was 13 lines long and made no sense, pointed to one line, and online forums was of no help :l

I think my profile picture explains pretty much sums up what every C++ programmer experiences when beginning.. The same can be said for Java, but it is no where near as hard and at least comes with quite a large amount of already made functions/packages/libraries.

If you like DIY stuff, C++ is definitely the language for you. If you like stuff where you just need a little push, want to develop quickly and don't care much for speed, Java/C# is for you.. I must say though, Java is pretty fast for some things though..


Why not learn both? They're different experiences.. Anyway, if I seriously have to choose, C++ all the way. LOL. If you can program in C, C++, or ASM, you can adapt to any other language with ease. Transition is fairly easy from C-style to any other but I'm not so sure about the other way around..


Java looks more easy to learn c++ looks to me just more easy to pick up the basics but harder to learn. Example: looking at a c++ tut already have a basic idea how to input a value "cin >> var;" and java… No idea…

Brandon

2013-01-14 22:19:12

From: rjj95
Java looks more easy to learn c++ looks to me just more easy to pick up the basics but harder to learn. Example: looking at a c++ tut already have a basic idea how to input a value "cin >> var;" and java… No idea…



Java:
System.Console Cin = new System.Console();
String Input = Cin.ReadLine();

Hint: Judge them both by what you need.. Not by what they look like.

For me, C++ was way way way easier than learning Java.. My transition to java was uncomfortable as its more restricted.. Benland helped me a bit with that. Same with editing smart.

For my buddies, they think I'm stupid when I say C++ is easier as they find it ridiculously tedious and hard.

It's a do it yourself language with no restrictions. By that, it means that when you want to do something, you write all your own code whereas Java/C# have built in libraries and functions ready for use.

I don't consider these advantages as I love having control over everything:

Java/C# advantages:

Garbage cleanup
No pointers
No ?ber long template errors
Not much to worry about for Cross platform stuffs.


C++ advantages:

Delete objects and stuff when you want them cleaned. No need for garbage cleanup if you don't produce garbage in the first place.
Pointers for direct memory access and speed
Templates are better than C#\Java generics.
Experience with all platforms and low level stuff.


IMO, there are more restrictions and disadvantages in Java whereas when I use C++ I feel free and have none.

That's debatable though. J-programmers will argue differently.

Anyway, choose a language for what you need, not how it looks. Syntax can be part of the choice too but look at the abilities first.

x[Warrior]x3500

2013-01-14 22:19:31

From: rjj95
Java looks more easy to learn c++ looks to me just more easy to pick up the basics but harder to learn. Example: looking at a c++ tut already have a basic idea how to input a value "cin >> var;" and java… No idea…


but but but… i already gave u a link that described how to "cin" something into java in like 3 lines (on ur other thread).

java is way easier than c++ in my opinion. what i did was that i learned c++ first. and after a few years of that, i learned java w/o any issues. it was a breeze. so i would recommend doing c++ first. just start off with procedural programming and work up to oop.

rj

2013-01-14 22:25:32

From: x[Warrior]x3500
but but but… i already gave u a link that described how to "cin" something into java in like 3 lines (on ur other thread).

java is way easier than c++ in my opinion. what i did was that i learned c++ first. and after a few years of that, i learned java w/o any issues. it was a breeze. so i would recommend doing c++ first. just start off with procedural programming and work up to oop.


Stil don't know how to make it edit a variable and I can never run older java examples off the web because I have a different java version therefor making the language harder to learn when I don't have a working example. Also the documents from docs.oracle ( java website ) are veerryyy painful to read… It's like reading somebody's code when they don't use code tags

x[Warrior]x3500

2013-01-14 23:06:37

http://www.youtube.com/watch?v=KXuQQh6AynQ&list=PLFE2CE09D83EE3E28

this is a basic grade average tutorial (using scanner - the thing i suggested on ur other thread)

also, if you want to learn java, watch all his beginner and intermediate tuts. they will give u a decent foundation.

Fatigue

2013-01-15 07:43:00

From: rjj95
Recently tried picking up java but it is so annoying to code in and i Get tons if errors… Also c++ seems more useful in the long run in terms of uses/game development/speed….


Wait, I thought people used C# now. 0_o

Sin

2013-01-15 07:53:15

For Programming? Hardly, C# is for form/program design.

Kyle Undefined

2013-01-15 09:28:01

C++ is universal, as is Java. C# is a good Microsoft language to use.

Shatterhand

2013-01-15 11:06:13

I learnt both of the languages for half years at uni.

I dont like C++, it is a lot harder (pointers/referencies). I have to take care of evertything, like freeing up all the stuff (java has garbage collector). And as Brandod said its harder to do debug.

Java is so much simplier to me, there is everything you need in the includes, while C++ needs external stuff.

If you want to make a heavy resource program, like a game, then C++, cause java is slow (virtual machine).

But for anything else java is my suggestion. :)

mcbain

2013-01-15 17:12:48

From: Shatterhand
I learnt both of the languages for half years at uni.

I dont like C++, it is a lot harder (pointers/referencies). I have to take care of evertything, like freeing up all the stuff (java has garbage collector). And as Brandod said its harder to do debug.

Java is so much simplier to me, there is everything you need in the includes, while C++ needs external stuff.

If you want to make a heavy resource program, like a game, then C++, cause java is slow (virtual machine).

But for anything else java is my suggestion. :)

You don't have to use pointers if you don't like them. They aren't mandatory lol. I kind of like having control of freeing up memory after dynamically allocating memory to pointers, then i know exactly whats happening. To me, its really easy to debug! sounds like you didn't try very hard to learn it :(


Anyway,


This is exactly with I prefer C++ to Java. C++ is very useful if you want to persue game development or programming in general. Like you, Java only gives me errors and doesn't seem to make a lot of sense to me. If you enjoy programming in a very Object oriented mindset then you will love C++ and for those reasons, I say go for C++ :D

Brandon

2013-01-15 19:57:04

From: mcbain
You don't have to use pointers if you don't like them. They aren't mandatory lol. I kind of like having control of freeing up memory after dynamically allocating memory to pointers, then i know exactly whats happening. To me, its really easy to debug! sounds like you didn't try very hard to learn it :(


Anyway,


This is exactly with I prefer C++ to Java. C++ is very useful if you want to persue game development or programming in general. Like you, Java only gives me errors and doesn't seem to make a lot of sense to me. If you enjoy programming in a very Object oriented mindset then you will love C++ and for those reasons, I say go for C++ :D



What? Pointers in C++ is definitely unavoidable.. There is no way any C++ programmer would get far without using pointers or dynamic memory allocations. RAII is good but it's not meant to replace everything that needs to require resources. The furthest anyone gets without pointers is considered helloworld afaik..


Vectors, Lists, RAII classes are good but pointers are irreplaceable and unavoidable. Smart Pointers is what C++x11 recommends but there are times when raw pointers are still necessary. Especially for Legacy code. They're pretty much mandatory to get anything useful done..

mcbain

2013-01-15 22:56:59

From: Brandon
What? Pointers in C++ is definitely unavoidable.. There is no way any C++ programmer would get far without using pointers or dynamic memory allocations. RAII is good but it's not meant to replace everything that needs to require resources. The furthest anyone gets without pointers is considered helloworld afaik..


Vectors, Lists, RAII classes are good but pointers are irreplaceable and unavoidable. Smart Pointers is what C++x11 recommends but there are times when raw pointers are still necessary. Especially for Legacy code. They're pretty much mandatory to get anything useful done..


Definitely agree on the fact that they are an extremely useful tool to getting many things done and dynamically allocated memory is a must in further advanced programming. I used the wrong word when i said "mandatory", there are times when you have to and a lot of times when its better to stay away from them. All depends on what you are doing with your program and what you want done :)

CynicRus

2013-01-16 02:35:41

I do not like C++. I find it a monster. But I like the classic C for low level tasks. I will use C++ only if task requires it. For graphics applications, I prefer Lazarus/Delphi. Java, Java is good for servers with high load. But for other tasks, in my opinion … he's too clumsy and slow. I mean Java Gui.

rj

2013-01-16 16:16:18

From: CynicRus
I do not like C++. I find it a monster. But I like the classic C for low level tasks. I will use C++ only if task requires it. For graphics applications, I prefer Lazarus/Delphi. Java, Java is good for servers with high load. But for other tasks, in my opinion … he's too clumsy and slow. I mean Java Gui.


Adding buttons with java is TERRIBLE.

Get errors to easily, and theres no useful guides on the internet. kind of turns me away from it

CynicRus

2013-01-17 03:11:39

Haha, then choose between C# or Delphi. It is very easy to create any GUI.

J J

2013-01-17 04:52:38

From: CynicRus
Haha, then choose between C# or Delphi. It is very easy to create any GUI.

There are also GUI Builders for Java, but OP shouldn't expect to get everything working at first attempt.