LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 03-25-2005, 10:40 PM   #1
veeruk101
Member
 
Registered: Mar 2005
Distribution: Ubuntu 12.04 LTS
Posts: 249

Rep: Reputation: 16
WOW, "C" is that crazy!? What about Java and C++?


I read the stuff below on a tutorial someone in a previous post pointed me to. C is that crazy eh!? I had no idea! What about C++ and Java?

It seems Java can do ANYTHING and EVERYTHING when it comes to computers...any computer concept seems to have a parallel in Java. Where does it come into play?

The stuff below makes it seem I should really learn C...what about Java and C++ and other programming languages? Can somebody please comment on Java and C++ specifically? Can I program anything in C that I could in C++ and Java? Is there anything one of these 3 languages can do that another cannot?

Is there any functional reason I should learn more than one of the 3? (i.e. not a reason like "it's obviously better for completeness", but a reason that indicates that one cannot create an application that the others can?)

Thanks!

Quote:
C was invented for the purpose of writing an operating system that could be recompiled (ported) to different hardware platforms (different CPUs). Because the operating system is written in C, this language is the first choice for writing any kind of application that has to communicate efficiently with the operating system.

Many people who don't program in C very well think of C as an arbitrary language out of many. This point should be made at once: C is the fundamental basis of all computing in the world today. UNIX, Microsoft Windows, office suites, web browsers and device drivers are all written in C. Ninety-nine percent of your time spent at a computer is probably spent using an application written in C. About 70% of all ``open source'' software is written in C and the remaining 30% are written in languages whose compilers or interpreters are written in C. [C++ is also quite popular. It is, however, not as fundamental to computing, although it is more suitable in many situations.]

Further, there is no replacement for C. Since it fulfills its purpose almost flawlessly, there will never be a need to replace it. Other languages may fulfill other purposes, but C fulfills its purpose most adequately. For instance, all future operating systems will probably be written in C for a long time to come.

It is for these reasons that your knowledge of UNIX will never be complete until you can program in C. On the other hand, just because you can program in C does not mean that you should. Good C programming is a fine art which many veteran C programmers never manage to master, even after many years. It is essential to join a Free software project to properly master an effective style of C development.
 
Old 03-25-2005, 11:19 PM   #2
foo_bar_foo
Senior Member
 
Registered: Jun 2004
Posts: 2,553

Rep: Reputation: 52
i'm too tired to read all that stuff but higher level object oriented structures like are present in c++
are inapropriate for low level say kernel level programming.
and java ?? well java needs an interpreter and so is slow and unusable generally
java works good as a server back end or something i guess like where you would ordinarily use a scripting language.

programming languages are tools in a tool box
Quote:
Is there any functional reason I should learn more than one of the 3
it's hard to nail the boards in place if you first don't learn how to use the saw.

i mean really you never really "learn" a language anyway
they change so often and a new one comes along or get's new features
it's more like learning the underlying theories

my first functional (i thought) program was written in fortran on punch cards for an old ibm mainframe
don't get stuck in one spot -- just let it evolve
the greatest danger of any journey is thinking you are "there"
 
Old 03-26-2005, 05:24 AM   #3
Komakino
Senior Member
 
Registered: Feb 2004
Location: Somerset, England
Distribution: Slackware 10.2, Slackware 10.0, Ubuntu 9.10
Posts: 1,938

Rep: Reputation: 55
Learn a language as the fancy or need takes you. Java isn't necessarily slow in the usability sense, but it would be unsuitable for device drivers and the like because it has the overhead of needing the virtual machine running to interpret the compiled bytecode. But on the other hand, java apps can run on any system that has a VM without recompiling. It also has libraries for building GUI's as standard, whereas with C or C++ you'd need to choose a GUI toolkit to use. Interestingly, while most apps are written in C, KDE is written in C++ because the Qt toolkit is C++ based.

Personally I'm a fan of Perl.
 
Old 03-26-2005, 07:32 AM   #4
dave_starsky
Member
 
Registered: Oct 2003
Location: UK, Manchester
Distribution: Gentoo (2.6.10-r4) & Ubuntu
Posts: 145

Rep: Reputation: 16
Re: WOW, "C" is that crazy!? What about Java and C++?

Quote:
Originally posted by veeruk101
The stuff below makes it seem I should really learn C...what about Java and C++ and other programming languages? Can somebody please comment on Java and C++ specifically? Can I program anything in C that I could in C++ and Java? Is there anything one of these 3 languages can do that another cannot?
Anything you can do in C you can do in Java or C++ and vice versa. All of those languages are Turing Complete, meaning that you can do anything you could think of with them.

Like the people above said, it's probably better to set out to learn to program than to learn to program C, after playing about for a while you will find the language that you prefer. I like Java myself, but am not adverse to a bit of C, or C++
 
Old 03-26-2005, 08:01 AM   #5
frob23
Senior Member
 
Registered: Jan 2004
Location: Roughly 29.467N / 81.206W
Distribution: OpenBSD, Ubuntu, FreeBSD
Posts: 1,449

Rep: Reputation: 48
Quote:
Anything you can do in C you can do in Java or C++ and vice versa. All of those languages are Turing Complete, meaning that you can do anything you could think of with them.
There is one exception to this I know of. In C you know exactly when all your code is going to run (as you clearly write it all out). In C++ it is similar, the destructors for objects are never called by you but they have a clearly defined location and time at which they will be run when an instance of an object is no longer referenced. So, both of these languages are functionally the same. Java, on the other hand, makes no guarantees about when it will run your destructor. It could run it right after the last instance, at the end of a code block, at the end of a function, or even later if it "feels" like it.

Okay, for all "practical" purposes this should never be an issue for the average programmer. Real languages shouldn't have to do their own memory management (but that is another story anyway). The problem comes only when you have committed yourself to a project only to find a point in time where you absolutely need to know when that destructor will run and be sure it does only at that time, exactly at that time, and every single time for every single run. It is a sour and vicious bite when it is dealt to you... be forewarned.

Aside from that, they are all basically the same when it comes to functionality (C and C++ allow you to get closer to the hardware, as well, but good code should never rely on a defined understanding of the hardware unless it is not meant to be portable).
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Telling people to use "Google," to "RTFM," or "Use the search feature" Ausar General 77 03-21-2010 12:26 PM
Java error "Exception in thread "main" java.lang.StackOverflowError" nro Programming 1 09-04-2004 04:47 AM
crazy boot troubles "disk read error" dave_blob Linux - Software 6 06-28-2004 04:28 PM
I cannot use "java chat". Browser says plugin required "x-java-vm". jdruin Linux - Software 4 04-18-2004 06:44 PM
Java does "age" or "Age" matter when declaring an Int?? Laptop2250 Programming 3 10-13-2003 01:34 PM


All times are GMT -5. The time now is 08:53 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration