Transition from C++ to Java
Posted by Anki_t812@reddit | learnprogramming | View on Reddit | 9 comments
I have been doing dsa and programming in cpp. Now I have to switch to java for specific placements opportunities.
I am in 4 Semester and have to choose between java and python although I have cpp as my first language I need the other for placement opportunities.
Do share resources for fast and easy transaction.
You can also recommend java or python
Personally python's OOP feel a bit alien to me
Note:I have but experience with python more than java but the only reason I don't want to opt python is for its OOP thing
liquidanimosity@reddit
Java is OOP as well. It was taught in my university if first year for procedural, OOP and SOLID principles.
Objects appear more often than you think and are less complicated than it may appear. There are some very useful features such as encapsulation.
I know another paradigm to learn may be daunting but both languages have objects. If I was in your position, I would take the language I have the most experience with so that if you have to explore object you already have a point of reference and understanding.
PalpitationOk839@reddit
Go with Java. Python is great, but if you’re uncomfortable with its OOP style, it’ll slow you down. Java aligns better with your background.
Dull_Report3236@reddit
A few years back I would have said Java. But with everything AI/ML going on these days, it does seem like Python will get more valuable in the coming years.
Besides, the real programming language with AI coding is English anyway. The syntactical differences between Java/Python or any other languages are now made redundant with AI. What really matters is the actual logic, and what you want to achieve operationally.
edwbuck@reddit
Java has a relatively small set of object methods, and uses a lot of classes outside of the object to handle items like sorting, etc. Python has a ton of object methods, so you can then directly implement in the object sorting order, etc.
Java has much better multithreading support, which helps greatly when building programs that need to scale. Python originally lacked any kind of multithreading support, but it has improved recently.
Java was there when people were trying to figure out how to migrate from Procedural programming patterns into Object Oriented patterns. This means that a lot of solutions exist for many specific problems. Only a few of those solutions are likely to be relevant in modern programming. Python has fewer ways to do many things. This can mean it's easier to find the right toolkit or approach in Python, as there is less noise in the search for relevant libraries.
Each programming language has a set of tasks that were popular to perform around the time the programming language was a popular choice. If you want to do data processing, Python is better at the data science / exploration, but if you want to process data in bulk at speed, Java is the better choice. There is value in learning both, so you can translate one to the other as a corporation takes ideas from prototyping / small scale implementation into production.
Past-Gift-201@reddit
made the jump from c++ to java about 3 years back when i started my current gig and it's honestly way smoother than you'd expect. java's oop is actually more straightforward than python's since it forces you into proper class structures from day one
since you already know c++ syntax, the main hurdles are gonna be memory management (garbage collection handles everything), no pointers (references instead), and getting used to the jvm ecosystem. oracle's official java tutorials are solid for the basics, then i'd recommend diving straight into spring framework stuff since most enterprise jobs use it heavily
for placement prep specifically, java's probably your better bet over python - way more backend opportunities and the interview questions tend to focus on multithreading, collections framework, and design patterns which translate well from your c++ background. leetcode in java will feel familiar syntax-wise but you'll need to learn the built-in data structures like arraylist, hashmap, etc
Anki_t812@reddit (OP)
So should I just use oracle's official java tutorial or should I watch from a yt course?
faulty-segment@reddit
I am from the C++ gang and am fine here. No way I'd transition to Java haha.
BUT: If you are like me, and like books, pick Paul Deitel's latest Java book. It's just the best. Period.
The-Oldest-Dream1@reddit
If you prefer reading, go for the official docs. If you prefer watching videos, go for courses on youtube
whichever path you choose, do not forget to actually apply what you're learning in your code editor since it's very easy to get stuck into tutorial hell
auronedge@reddit
Take a c++ program you wrote and write it in java