Bluemner
Bluemner

Reputation: 39

Learning C / C++ and Java

I'm a Java guy doing mostly Android stuff.

I want to get into game programming for Android and was wondering if there is any point learning C (not for android obviously as there you can only write in C++). What do people still use C for? Isn't it a bit old and overrun by Java and Objective-C?

I will definitely learn C++ as everybody says you need it for game programming. Would you learn it simultaneous to Java (I'm still learning) or should I learn Java first?

Upvotes: 3

Views: 2310

Answers (7)

coding_pleasures
coding_pleasures

Reputation: 879

C is one of the most powerful languages available. And as they say with great power comes great responsibility. Due to its immense flexibility it is very easy to make mistakes and drive programmers crazy while programming/debugging in C. Anyhow I feel that to be a 'great' programmer, you need to learn the nuts and bolts of how memory and pointers are allocated/deallocated, garbage collection.. from C which is never exposed to programmers in Java. And for your game programming ambitions it will definitely help too as you use it to optimize performance.

I'd recommend you learn C along with Java, so that you better appreciate their differences and similarities or you would become too dependent on Java and the transition to C becomes more hard.

To learn any language, the best way is to program. Here http://cslibrary.stanford.edu/, you would get the best exercises to get you started.Have fun!

Upvotes: 3

Arjan Tijms
Arjan Tijms

Reputation: 38163

Despite being quite an old language, C is in fact still one of the most frequently used languages. According to the well known Tiobe language index, it only trails behind Java: http://www.tiobe.com/index.php/content/paperinfo/tpci/index.html

C is still being used a lot in many environments, among which embedded systems but also regular desktop applications. Especially on Linux, C has a strong following even for work outside systems/kernel development.

The Java / C++ connection is legendary though. It's clear the Java syntax heavily leans on the C++ one, but in concepts the language is actually much closer to Objective-C. Patrick Naughton (one of the early Java language designers) has recently posted about this: Java Was Strongly Influenced by Objective-C

So to better understand Java it definitely pays off to learn C++ and Objective-C at some time, but it absolutely isn't a requirement. If you've learned any of those two, you have automatically learned (large) parts of C.

In general, better learn one language reasonably well before hopping on to the next one.

Upvotes: 7

Stephen C
Stephen C

Reputation: 718788

If you learn C++, learning C is only a small step. As a first approximation, C is more or less a subset of C++.

I'd thoroughly learn Java together O-O design skills and design patterns, before taking on C / C++. Once you start with C / C++ you have to deal with issues like pointers and explicit memory management ... and language specifications that say "the behavior of X is undefined" a lot more.

It is easy for the complexity of languages like C and C++ to get in the way of learning design skills.

Upvotes: 2

Benjamin Fedder Jensen
Benjamin Fedder Jensen

Reputation: 136

I learned C as my first language. The focus was on memory allocation and deallocation, and simple datatypes such as dynamicly allocated arrays, variable sized dynamic allocated arrays, pointers et cetera.

This was enough to do a fully fledged application of course, but looking back at it now, it was much harder to do things in; I was limited to arrays, dynamic or static, so the complexity of it was horrible.

Anyway, it meant that later on I could focus on object oriented programming and efficient data structures, algorithms et cetera in C++ and Java without worrying at all about programming.

All methods work, but I'm very glad that I understand how memory works. Most of the people I meet at my University that learned programming through Java, do not understand this. And I think it's quite important :)

Upvotes: 4

Frunsi
Frunsi

Reputation: 7147

C is used for many things. Most of (PC) applications you use are still written in C or C++. You can read about the details here for example ;-)

Java is different, and it is not really that evolutionary step that many advocates try to suggest.

Upvotes: 1

xappymah
xappymah

Reputation: 1634

C is used for system programming in particular in Linux kernel. But in fact, learning programming languages != learning programming.

So, its best for you to learn Java first as your primary programming language AND read some books listed here: What is the single most influential book every programmer should read?

After that expanding your knowledge would be easier.

Upvotes: 1

liamzebedee
liamzebedee

Reputation: 14490

Firstly Objective-C is basically only for development on Apple technologies so it is definitely not as powerful in its compatibility/portability aspect as opposed to C. C++ was actually only created as a library to add classes to C. When developing in C++ you are really developing in a massively updated C. Java has not overrun C rather provided another approach to programming. Java does not have the low level power of C(editing memory...).

Upvotes: 1

Related Questions