• 0

Which Is Best C++ or Java?


Question

19 answers to this question

Recommended Posts

  • 0

If it is only a choice between the two and you are having a cold start from absolutely no code experience. Java.

 

Use something like BlueJ - https://www.bluej.org/ - as a learning aid and it will teach you basics plus object orientation concepts. There is a textbook you can use with it too

https://www.amazon.com/Objects-First-Java-Practical-Introduction-dp-1292159049/dp/1292159049?&linkCode=ll1&tag=camie06-20&linkId=0683199be58fe4b45e129ef3d84cc291&language=en_US&ref_=as_li_ss_tl

 

If you already understand O-O or have some language experience, BlueJ will be too basic for you, but in general Java will allow you to progress to C++, C# and others fairly easily if that is where you want to go. If you want to wind up as a web developer though, neither especially good starting points really.

  • Like 2
  • 0
On 18/07/2023 at 11:04, Ravikant said:

If you ask beginners to learn a programming language then what would you suggest?

C#, PowerShell, Python, Rust, or Julia... definitely not C++ or Java.

C# looks like Java but has real-world contextual uses.

Rust has been made to replace C and C++.

Edited by Fleet Command
  • 0
On 19/07/2023 at 04:56, Fleet Command said:

C#, PowerShell, Python, Rust, or Julia... definitely not C++ or Java.

C# looks like Java but has real-world contextual uses.

Rust has been made to replace C and C++.

But rust will never replace c and c++, specially in embedded devices. It can coexist though but I doubt it will ever replace it.

  • 0

Guys, come on, I think we can be a little bit more friendly with someone beginning the path.

 

On 18/07/2023 at 09:34, Ravikant said:

Hello,

If you ask beginners to learn a programming language then what would you suggest Java or C++?

 

Thanks

Ravikant, we would love to know what is your ultimate goal with learning a programming language:

  1. Is it to build a web app?
  2. Is it to work in AI, Data Science and Machine Learning?
  3. Is it to do some game development?
  4. Is it to make a desktop application?
  5. Is it to work on Internet of Things (IoT)
  6. Is it to work on hardware

 

Depending on what you want to do, there will be a programming language suited for the task.

Even though all of the most well-known will let you work on those things.

  • 0
On 19/07/2023 at 17:20, Arceles said:

But rust will never replace c and c++, specially in embedded devices. It can coexist though but I doubt it will ever replace it.

Device drivers and embedded devices are primary targets of Rust. It certainly can replace C and C++ there. Whether it does depends on our adoption.

  • 0
On 19/07/2023 at 10:37, Fleet Command said:

Device drivers and embedded devices are primary targets of Rust. It certainly can replace C and C++ there. Whether it does depends on our adoption.

Yeeaaaah no. I work a a very big comany regarding all sort of embedded and safety critical devices in automotive. They are not going to throw away years of testing and certification (ASIL) because of a languaje that at best is equal to c.

  • 0
On 19/07/2023 at 20:26, Arceles said:

Yeeaaaah no. I work a a very big comany regarding all sort of embedded and safety critical devices in automotive. They are not going to throw away years of testing and certification (ASIL) because of a languaje that at best is equal to c.

I worked in the auto industry too. That means I know that large company of yours if you name it. I know their procedures too. It's not up to them. They'll use whatever programming language IATF  mandates. IATF already has a migration plan to Rust, albeit their target is 2030. ASIL is the main reason for the move. C is not memory-safe. Rust is safe. ASIL concerns itself with safety.

Rust isn't equal to C; it is orders of magnitude superior.

  • 0
On 19/07/2023 at 12:28, Fleet Command said:

I worked in the auto industry too. That means I know that large company of yours if you name it. I know their procedures too. It's not up to them. They'll use whatever programming language IATF  mandates. IATF already has a migration plan to Rust, albeit their target is 2030. ASIL is the main reason for the move. C is not memory-safe. Rust is safe. ASIL concerns itself with safety.

Rust isn't equal to C; it is orders of magnitude superior.

Well that is for us to see in 2030 as you mention. Even if it is the case ASIL is just one example. 2023 and there are nowhere near the plans you menton on sight, not even for the 2029 projects already contemplated here. And I would like for you to point a document in which the IATF says that, as I cannot find one in the first google page at least using "IATF rust 2030".

  • 0
On 19/07/2023 at 22:04, Arceles said:

Well that is for us to see in 2030 as you mention. Even if it is the case ASIL is just one example. 2023 and there are nowhere near the plans you menton on sight, not even for the 2029 projects already contemplated here. And I would like for you to point a document in which the IATF says that, as I cannot find one in the first google page at least using "IATF rust 2030".

If you work in the auto industry, you must know the correct place to search is the LOC document system. I'm not surprised it didn't show on a Google search, though. It's not newsworthy. Barely any of our accords appear in the news.

Be that as it may, I answered the question, "What programming language do you suggest the beginners to learn?", not "What programming language pays the most in the auto industry."

  • 0
On 19/07/2023 at 12:51, Fleet Command said:

If you work in the auto industry, you must know the correct place to search is the LOC document system. I'm not surprised it didn't show on a Google search, though. It's not newsworthy. Barely any of our accords appear in the news.

Be that as it may, I answered the question, "What programming language do you suggest the beginners to learn?", not "What programming language pays the most in the auto industry."

Rust would be a big news and so much that it would appear on google. Even autosar results (albeit not for classic) appear. So no, there is no indication of rust being targetted for 2030.

  • 0
On 19/07/2023 at 23:14, Arceles said:

Rust would be a big news and so much that it would appear on google. Even autosar results (albeit not for classic) appear. So no, there is no indication of rust being targetted for 2030.

You claim to work for a large auto parts supplier but you don't even query our native LOC. What could possibly be the reason? I wonder...

What large company did you say you work for?

Edited by Fleet Command
  • 0
On 19/07/2023 at 13:56, Fleet Command said:

You claim to work for a large auto parts supplier but you don't even query our native LOC. What could possibly be the reason? I wonder...

What large company did you say you work for?

I do not have to tell you my credentials here, I however can tell you that I work for one of the IATF associate company. I do not have credentials to check said document but I can ask for them. Still, directly loking ant our product portfolio for 2029 and asking also my managers I can tell that there is no rust on sight.

  • 0

I think for super small apps C++ can be competitive with Java. But once the app gets bigger and starts using many threads you see that C++ apps usually cannot compete with Java apps in terms of performance and stability (bugs). So you see that Cassandra is many times faster, in realistic cases more than 25x faster than mongoDB. Cassandra is Java and mongoDB is mainly C++

Of all the languages I know, I notice that C++ apps often have the most bugs, usually significantly worse than C and Python apps. I think this has to do with the design and syntax of the language, which is one of the worst in existence. But further, it is also true that C++ programmers are often not the best programmers which exacerbates the problem.

If you want to know what are the best languages purely in terms of developer productivity, design of the language, features and performance, I would recommend the following languages

1. Haskell

2. Common Lisp (and similar languages like Clojure and Scheme)

3. Scala

4. Nim

5. Pascal

6. Zig

7. Julia

The reasons why Haskell is better than most other languages:
1. much higher productivity than e.g. Python and most other languages
2. far fewer bugs on average than e.g. Python and C
3. perfect for parallel processes and multi core processors
4. in reality Haskell apps often have similar performance to C apps, since you are usually limited in time. with Haskell you have many times more time to optimize performance
5. very powerful capabilities. for example, Julia's multiple dispatch is one of the best out there. But Haskell has something that is actually even more powerful than Julia's multiple dispatch. From a purely technical (not including libraries) point of view, there is nothing better suited for Data Science than Haskell.

  • 0

When I was in college the first programming course I took was c++ followed by java. C++ was significantly easier for me to learn although that was probably due to my Java professor not speaking any english.

Frankly I wouldn't recommend either of these languages to someone new to programming, I would recommend they take a look at https://codecademy.com and start with whatever looks like it does what you want it to.

 

I highly doubt the nuances of performance, memory management, etc. would be important to a new programmer who is still getting the hang of programming logic and syntax.

  • 0

When I was in engineering school (a little over 10 years ago), I spent a lot of time writing Java code.   I guess it's good for learning the depths of coding, but I don't use it in my professional life.  I also had a lot of embedded C classes, and I absolutely use that.  I highly recommend C, if you're interested in the embedded hardware route.
My software engineer colleagues use Python for scripting and also for simple PC apps.  Colleges seem to be focusing on Python more, which is great.  For more complex PC applications, C# and .NET are good choices.  For mobile app development, I guess you'll use whatever is convenient for iOS and/or Android.

Overall, it depends on what applications you want to get good at, whether it's hardware, software apps, mobile apps, etc.  I definitely don't recommend just focusing on Java though, if you even bother with Java at all.

If I was just beginning, here's what I'd start with:

https://www.coursera.org/specializations/coding-for-everyone
https://www.coursera.org/specializations/python

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now