Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Java or C?

  • Java

    Votes: 22 34.9%
  • C

    Votes: 41 65.1%

  • Total voters
    63
Status
Not open for further replies.
This is why VB is easy to code but lacks power and why C++ is difficult to code but has more power.

As long as both languages are turing complete (which they are) then they are equally powerful. This argument about one language being more powerful than the other is rubbish. Maybe more elegant or precise but more powerful? No.
 
As long as both languages are turing complete (which they are) then they are equally powerful. This argument about one language being more powerful than the other is rubbish. Maybe more elegant or precise but more powerful? No.

Well, one car can be more powerful than another, but as long as they can go down the road they are both touring complete (pun intended).

An old friend of mine back in college (talking about 1970 here) wrote the Tower of Hanoi puzzle in SNOBOL and made the claim it was a superior language because only SNOBOL could do it. Turns out he meant to say "in a single line" but for over a decade, every time I came up against a new language I wrote the puzzle and sent him the program listing. I'm sure a couple dozen in all.
 
Well, one car can be more powerful than another, but as long as they can go down the road they are both touring complete (pun intended).

This is a poor argument. A car does not have to exactly simulate another car for it to be considered complete.

A turing machine on the other hand is only considered turing complete if it is capable of simulating any other turing complete machine. Thus two turing complete languages can simulate one another exactly. Hence the argument that a turing complete language is more powerful than another turing complete language is rubbish.
 
Thus two turing complete languages can simulate one another exactly.

Just like the vehicle comparison, the usual definition of "power" doesn't just mean function, but includes some measure of efficiency.

A Ferrari, semi-trailer truck and Smart car will all get you from point A to point B. One has an advantage in raw speed, one has a benefit in transporting cargo and one may just be easier to park when you get there. Functionally they are equivalent.

Which is more "powerful" in the end will have a lot to do with what it will actually be asked to do and will be interfacing with.

B
 
^^

Depends, if A is "in the city" and B is "in the woods" then it's likely that only one will get you to point B.

Turing completeness only considers computability, real world constraints can still limit what a turing complete language can do, access to hardware, enforced permission restrictions and so on.

To add to the above, SQL is not turing complete, but it's much more powerful than both C or Java if the objective is database queries.

http://shebang.ws/turing-completeness-********.html
http://en.wikipedia.org/wiki/Turing_tarpit

Edit: The first link should end with büll$h1t (fill it in for yourselves)
 
Last edited:
Just like the vehicle comparison, the usual definition of "power" doesn't just mean function, but includes some measure of efficiency.

A Ferrari, semi-trailer truck and Smart car will all get you from point A to point B. One has an advantage in raw speed, one has a benefit in transporting cargo and one may just be easier to park when you get there. Functionally they are equivalent.

Which is more "powerful" in the end will have a lot to do with what it will actually be asked to do and will be interfacing with.

B

Different levels of skill or different skill sets may be involved in driving each of these vehicles quickly and efficiently to their destination. The ability to drive a Ferrari well may not translate readily to the semi. So it is with programming tools.
 
Depends, if A is "in the city" and B is "in the woods" then it's likely that only one will get you to point B.

Different levels of skill or different skill sets may be involved in driving each of these vehicles quickly and efficiently to their destination. The ability to drive a Ferrari well may not translate readily to the semi. So it is with programming tools.

Both valid points, which reinforce the argument that neither Java, nor C, are intrinsically superior.

It all depends what you want to do with them and in what environment.

B
 
Hehe.

OP: "Should I learn to drive on an ATV or a Formula 1 racecar?"

MacRumors: "ATVs are useless, drive the F1 car, it'll teach you more about driving." "Yeah, but you can't take the F1 off-road." "You can if you really want to, plus it's faster on the highway." "But ATVs are better for beginners because you can get one with automatic transmission."

Sensible answer: "Take your dad's auto-transmission Camry out to the mall parking lot on a Sunday. Learn to use your steering wheel, brakes and accelerator, and mirrors. Drive it on the back roads and then the highway. Learn to change a flat tire. THEN worry about ATVs and racecars or how to build a custom suspension or repair your own engine."

MacRumors probable response: "Camrys are totally overrated, learn on a Civic instead." "Civics break down all the time, you should drive an Accord instead."
 
Java is for learning

Which language is better at solving your problems depends on what problems you have. Java is better for learning because it is more recently created, and the syntax is cleaner and more defined.

C has so much heritage that the syntax is almost infinite. Also, pointers. Yuck. So I agree with those who said that learning the concept of programming is more important than the language you first pick; but that being said, Java provides you an easier platform on which to learn the concepts. If you start with C, you'll spend more time first learning the language before you get to understanding the concepts.
 
I've been reluctant to post here because these discussions are always a bit awkward, especially because they often radically shift away from language and concepts the OP will understand. I will try to keep my reply here understandable to someone without any programming experience, for the benefit of the OP and anyone else who may find this in the future in a similar situation.

In this particular case, I think C makes more sense because the OP's primary goal is to learn Cocoa programming. Objective-C is the goal, and Objective-C is an extension of C. Given this, the OP will need to learn C eventually (and may never have a need to learn Java). Based on these facts I think C is the obvious choice.

The exception to this is that some people struggle with C, and do better learning higher level languages to start. If the OP finds himself in this situation, I think Python is a great higher-level first language choice. The syntax is clean and simple, and it can be used for a wide variety of tasks, including interfacing with Cocoa via PyObj-C way down the road once they have a solid understanding of Cocoa, Objective-C and Python.
 
Also, pointers. Yuck.
Pointers are an important concept. Once you understand them, they make sense. Perhaps the OP will just get them. In a way, you have made a stronger case for C over Java.

"Camrys are totally overrated, learn on a Civic instead." "Civics break down all the time, you should drive an Accord instead."
No way, not a Honda, those encourage bad driving habits. All the most obnoxious traffic moves I have ever seen were by Honda drivers.
 
MacRumors probable response: "Camrys are totally overrated, learn on a Civic instead." "Civics break down all the time, you should drive an Accord instead."

No way! Learn to drive a motorcycle. It will also make you more aware of the skills necessary to ride a horse, a camel, or a tauntaun.
 
Which language is better at solving your problems depends on what problems you have. Java is better for learning because it is more recently created, and the syntax is cleaner and more defined.

C has so much heritage that the syntax is almost infinite. Also, pointers. Yuck. So I agree with those who said that learning the concept of programming is more important than the language you first pick; but that being said, Java provides you an easier platform on which to learn the concepts. If you start with C, you'll spend more time first learning the language before you get to understanding the concepts.

Best post so far.

Both languages are valid depending on which direction you are coming from. To learn OOP concepts, which is a requirement these days IMO, it's Java. To learn the basics of programming - structures, functions, etc. - it's C. It boils down to which you want to start with.
 
It depends on how you define powerful :)

As long as both languages are turing complete (which they are) then they are equally powerful. This argument about one language being more powerful than the other is rubbish. Maybe more elegant or precise but more powerful? No.
 
As long as both languages are turing complete (which they are) then they are equally powerful. This argument about one language being more powerful than the other is rubbish. Maybe more elegant or precise but more powerful? No.

yeah and theoretically you can use a turing tape machine and wait N > 10000 years to get the answer. In the real world time matters.
 
As long as both languages are turing complete (which they are) then they are equally powerful.

If you are talking about Turing completeness, neither has an infinite tape, but C reveals a bit more of the underlying physical Turing machine (addressable virtual memory as the finite tape) than does Java. One less level of indirection.
 
If you are talking about Turing completeness, neither has an infinite tape, but C reveals a bit more of the underlying physical Turing machine (addressable virtual memory as the finite tape) than does Java. One less level of indirection.
Code:
asm
{
// some assembly code
}

I would say that C, in most or all of its flavours, can reveal effectively all of the underlying machine, to a much greater extent than Java ever could.
 
Although many compilers and IDEs will allow a programmer to mix C and assembly language, 68k, ppc, x86, ia32, armv7, etc. assembly languages themselves are not part of the official ANSI C language.
 
Kind of odd thing, really. I seem to recall a conference recently where they adjusted the official specification of C (ANSI or I-triple-E or somesuch) to encompass strings and threads and such. Now, I am sort of a rube, I see those things as extensions.h, things that are kind of optional, whereas asm is literally part of the language. And yet, what is between the braces of an asm block is usually unportable, possibly not even compiler-supported, so asm is kind of both a part of C and at the same time, pragmatically, not a part of C.
 
Start with Java. There's a reason why most Computer Science/Information Technology majors start with it. It's a great programming language for new programmers. Once you become familiar with Java, general OOP, and general programming techniques and processes, C will be a breeze and definitely useful.
 
Start with C. Mobile device programming is getting more and more popular. And programmers with experience at a lower level of abstraction from the hardware (which C provides much better than Java) have a better feel for developing apps that can use a smaller memory footprint, a more predictable UI latency, and use up less battery life.
 
Start with C. Mobile device programming is getting more and more popular. And programmers with experience at a lower level of abstraction from the hardware (which C provides much better than Java) have a better feel for developing apps that can use a smaller memory footprint, a more predictable UI latency, and use up less battery life.

this.

C is a good foundation for computer programming in general and is far closer to the metal than Java - C was designed as a language for writing operating systems.

It may be harder, and more difficult to create complex applications with, but in the long term you will appreciate how easy modern languages and their frameworks make it nowadays (such as java, c#/.net, jsNode, ObjectiveC/XCode).

Most important of all, using modern frameworks/languages are an absolute breeze once you understand the disciplines of coding in C.
 
I was confused weather to Learn C or Objective-C as so many people gave me conflicting answers what to learn. what i did do is buy C for Dummies which i'm thoroughly enjoying and i also purchased Programming in Objective-C 4th Edition. The author of the Objective book says his book will teach you all you need to know basically if this is going to be your first programming language, here is a few paragraphs that he says that you might be interested in:

What You Will Learn from This Book


When I contemplated writing a tutorial on Objective-C, I had to make a fundamental decision. As with other texts on Objective-C, I could write mine to assume that the reader already knew how to write C programs. I could also teach the language from the perspective of using the rich library of routines, such as the Foundation and UIKit frameworks. Some texts also take the approach of teaching how to use the development tools, such as the Mac’s Xcode and the tool formerly known as Interface Builder to design the UI.

I had several problems adopting this approach. First, learning the entire C language before learning Objective-C is wrong. C is a procedural language containing many features that are not necessary for programming in Objective-C, especially at the novice level. In fact, resorting to some of these features goes against the grain of adhering to a good object-oriented programming methodology. It’s also not a good idea to learn all the details of a procedural language before learning an object-oriented one. This starts the programmer in the wrong direction, and gives the wrong orientation and mindset for fostering a good object-oriented programming style. Just because Objective-C is an extension to the C language doesn’t mean you have to learn C first.

So I decided neither to teach C first nor to assume prior knowledge of the language. Instead, I decided to take the unconventional approach of teaching Objective-C and the underlying C language as a single integrated language, from an object-oriented programming perspective. The purpose of this book is as its name implies: to teach you how to program in Objective-C. It does not profess to teach you in detail how to use the development tools that are available for entering and debugging programs, or to provide in-depth instructions on how to develop interactive graphical applications. You can learn all that material in greater detail elsewhere, after you’ve learned how to write programs in Objective-C. In fact, mastering that material will be much easier when you have a solid foundation of how to program in Objective-C. This book does not assume much, if any, previous programming experience. In fact, if you’re a novice programmer, with some dedication and hard work you should be able to learn Objective-C as your first programming language. Other readers have been successful at this, based on the feedback I’ve received from the previous editions of this book.

This book teaches Objective-C by example. As I present each new feature of the language, I usually provide a small complete program example to illustrate the feature. Just as a picture is worth a thousand words, so is a properly chosen program example. You are strongly encouraged to run each program (all of which are available online) and compare the results obtained on your system to those shown in the text. By doing so, you will learn the language and its syntax, but you will also become familiar with the process of compiling and running Objective-C programs.
 
I was confused weather to Learn C or Objective-C...

You really need to learn both. Objective C may be a pure superset of C, but the typical usage of the 2 languages (object messaging versus procedural routines) is moderately different.

If you learn both high level and low level programming ideas, you'll know what level of abstraction you're coding with, and what level of attack might be more or less appropriate for the programming problem at hand.
 
Status
Not open for further replies.
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.