C/C++ Transitioning from Java to C/C++: Navigating the Challenges

  • Thread starter Thread starter Red_CCF
  • Start date Start date
  • Tags Tags
    Java
AI Thread Summary
When selecting a computer programming course, two options are available: two beginner classes (one in fall and one in winter) or an accelerated class that combines both into one semester. Both options start with C programming and transition to C++, but the accelerated course is faster-paced. Transitioning from Java to C++ may present challenges due to C++'s complexity, including the need to manage memory manually and understand code structuring to avoid circular dependencies. Unlike Java, C++ does not enforce object-oriented programming and has a less comprehensive standard library, which can lead to inefficiencies for beginners. The freedom C++ provides can result in both simple and highly complex programs, with mastery requiring significant time and experience. The lack of automatic garbage collection in C and C++ can lead to frustration for those accustomed to Java, as errors may occur silently. It is advisable to take the slower-paced course and consider a foundational class in computer architecture to better grasp the concepts in C programming.
Red_CCF
Messages
530
Reaction score
0
Hi

I'm selecting courses for University right now. I have two options for my computer programming course. I can selected either two programming classes (one fall, one winter) that is designed for beginners with no prior programming experience or I can selected just one class (which is an accelerated class that combines the two) and have one less class during my winter semester. Both choices begin with the C programming language and moves onto C++ language except one does everything faster. I've taken Java for a year and a half so I'm wondering if the transition to C++ would be difficult.

Thanks for any help that you can provide
 
Technology news on Phys.org
The higher level features of C++ are not as user-friendly as in Java -- in particular you will need to learn how to structure your code so that it does not contain circular dependencies, and learn how to manage your own memory without garbage collection. There are also some more complexities with inheritance.

C++ does not pressure you to use object oriented concepts, but you can if you want. The standard library provided by C++ is not nearly as comprehensive as Java, and there are usually a multitude of alternative options for doing anything...or sometimes there is no built in way to do commonly needed things. This can cause a beginner to waste a lot of time early on by trying to re-implement things or not choosing the best tool for the job.

Because C++ offers so much freedom, a C++ program could be as simple as a C program...lacking in high level features, or with template meta programming it can get extremely complicated. Template meta programming is the primary advantage of C++, and will take many years of experimentation and frustration to master.

As a result of the complexity of C++, you will be hard pressed to find a program written by anyone that cannot be criticized in a million different ways. This is because it does take many years to fully master, and everyone has their own opinions about what is the right way to do something.

On the one hand it can be frustrating because you have to continually look back on code you previously wrote in disgust in light of the new revelations you will have invariably learned since you wrote the old code, but on the other hand this means your code is always improving in terms of style and efficiency...and the only limits to your program's performance are your machine and your knowledge, unlike Java where you don't have so much control and your code is executed through the JVM.
 
Even if you are a very good Java programmer, most folks can expect the transition to C or C++ to be rough. So I would take the course that go slower. C and C++ have pointers and no automatic garbage collection; this causes much more difficulty than one has in Java. People who have only seen Java before often get really frustrated when they find out what it's like. I like to say, it's like walking on a tightrope with no net (in C or C++) because it is quite easy and common for programs to fail silently, apparently intermittently, or with little realistic indication of what went wrong. So unless you have a very firm understanding of what is going on in the computer's memory, programming in C or C++ will take a while to master.

I would recommend that you take a beginning computer architecture class before taking C programming if at all possible. Things may make a lot more sense if you do.
 
Dear Peeps I have posted a few questions about programing on this sectio of the PF forum. I want to ask you veterans how you folks learn program in assembly and about computer architecture for the x86 family. In addition to finish learning C, I am also reading the book From bits to Gates to C and Beyond. In the book, it uses the mini LC3 assembly language. I also have books on assembly programming and computer architecture. The few famous ones i have are Computer Organization and...
I had a Microsoft Technical interview this past Friday, the question I was asked was this : How do you find the middle value for a dataset that is too big to fit in RAM? I was not able to figure this out during the interview, but I have been look in this all weekend and I read something online that said it can be done at O(N) using something called the counting sort histogram algorithm ( I did not learn that in my advanced data structures and algorithms class). I have watched some youtube...
Back
Top