wood burning stoves*
The moose likes Meaningless Drivel and the fly likes I Want to Learn C As Additional Programming Language Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Other » Meaningless Drivel
Bookmark "I Want to Learn C As Additional Programming Language" Watch "I Want to Learn C As Additional Programming Language" New topic
Author

I Want to Learn C As Additional Programming Language

Jeffry Kristianto Yanuar
Ranch Hand

Joined: Oct 01, 2007
Posts: 759
Hi guys, I am Java instructor. Suddenly, I want to learn another programming language as additional language.

I decided to learn C. Is it still useful to learn C while there are another newer programming languages like C++ and even C#?


Regarding C, what are the tools needed to compile the program? For the IDE I want to use NetBeans.


Thanks


Jeffry Kristianto Yanuar SCJP, SCJA, SCJD
Freddy Wong
Ranch Hand

Joined: Sep 11, 2006
Posts: 959

It is always useful to learn another language. And if you're interested in the low-level stuff, it's good to know C. You can use gcc to compile C application and C programmers normally don't use any IDE, they use vi or emacs


SCJP 5.0, SCWCD 1.4, SCBCD 1.3, SCDJWS 1.4
My Blog
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8836
    
    7

On the plus side, C is the most popular language for Open Source software, so there is still a lot of development going on.
On the minus side, C is one step above assembly language. Unlike Java, which has a very rich standard API, nearly everything one would want to do with C requires an external library.
I guess it really depends on what you want to do with it. Do you want to do system-level programming? Use C. Do you have some specific C libraries you want to use? C's your thing. For application programming I'd look at either Python or C# rather than C.

Freddy Wong wrote:C programmers normally don't use any IDE, they use vi or emacs

You're doing it wrong. You are supposed to recommend vi, then I chime in with emacs and we argue for a few days until someone tops us with butterflies


"blabbing like a narcissistic fool with a superiority complex" ~ N.A.
[How To Ask Questions On JavaRanch]
Sumit Bisht
Ranch Hand

Joined: Jul 02, 2008
Posts: 329

The Netbeans has got support for c/c++.
If you are using windows, you'll need to use cygwin for the C compiler and debugger(gcc,gdb and g++ for C++)
In linux, if you have got the appropriate compilers already installed, then no other setup is required.
Note that C/C++ projects created on netbeans use make as the build utility.
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14074
    
  16

Note that C++ and especially C# are different languages than C.

C++ and C# should not be regarded as replacements for C, the same like Java is not a replacement for C.


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
chris webster
Bartender

Joined: Mar 01, 2009
Posts: 1610
    
  13

Jeffry Kristianto Yanuar wrote:Hi guys, I am Java instructor. Suddenly, I want to learn another programming language as additional language.
I decided to learn C. Is it still useful to learn C while there are another newer programming languages like C++ and even C#?


Wow, you must really like punishing yourself!

Seriously, you might want to think about your goals in learning another language. C has a pretty steep learning curve, and it may take you a while before you feel you are achieving anything terribly interesting with it. There's only so much fun to be had in spending hours looking for obscure memory problems caused by pointer errors...

If you're looking more at something to use for applications, then there are lots of alternatives e.g. some of the new scripting languages like Groovy, Ruby, Python etc. You could also look at associated web app frameworks (e.g. Groovy/Grails, Ruby/Rails, Python/Django) which give you a quick return on your learning. Back in C-land, C# should be pretty easy for you to pick up as an experienced Java user, and again, there are plenty of nice tools for building apps.

C++ is the object-oriented variant of C, and is widely used for lower-level application development and in lots of open source projects. But many C++ programs are notorious for being non-OO C programs with a dumb OO wrapper, and you still have all the fun of memory allocation and pointer errors. There's a reason why the Sun guys invented Java in the first place, after all.

Have fun!

No more Blub for me, thank you, Vicar.
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14074
    
  16

chris webster wrote:Back in C-land, C# ...

Argh. C# doesn't belong in C-land. What C and C# have in common is the letter C in the name. For the rest, C# is as different from C as Java is from JavaScript. (And I hope you do understand that Java and JavaScript have almost nothing in common...).

The past year or so there has been a lot of interest for alternative languages that run on the JVM. At JavaOne this year there was a lot of interest for Scala, Groovy, JRuby, Jython and Clojure. Those are the new and hip languages running on the JVM.

It's good to learn C, because it is still the most important systems programming language, and because it's lower level than most of the other languages, it will learn you more in detail how your computer and your operating system work.
Pat Farrell
Rancher

Joined: Aug 11, 2007
Posts: 4646
    
    5

Joe Ess wrote:On the minus side, C is one step above assembly language. Unlike Java, which has a very rich standard API, nearly everything one would want to do with C requires an external library.


This is actually incorrect. If you look carefully at PDP-11 assembly language vintage the early to mid-1970s, you will see that C maps directly into PDP-11 assembly language. The replacement for the PDP-11 was the Vax, and many C constructs can be done in one instruction in the Vax instruction set. So, realistically, C is PDP-11 assembly language.

There are times when C is needed. But it is not needed nearly as often as most people think.

I wrote a lot of C back in the 1980s. Since then, I have only had one assignment where I was professionally required to write in C, and it ended up being only a few hundred lines of code (which reached into the guts of MS Windows for hardware IO).

I strongly encourage folks to learn new languages, and it becomes easy once you have learned four or five. But C would be way down my list of suggested languages, well below Lisp, Smalltalk, Groovy, PHP, Python, Scala and others.
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10167
    
    8

Jeffry Kristianto Yanuar wrote:Hi guys, I am Java instructor. Suddenly, I want to learn another programming language as additional language.


Just curious. How did you start out?
Almost every java developer I know, started off with C and them moved on to either C++ or Java.


[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
chris webster
Bartender

Joined: Mar 01, 2009
Posts: 1610
    
  13

Jesper Young wrote:
chris webster wrote:Back in C-land, C# ...

Argh. C# doesn't belong in C-land. What C and C# have in common is the letter C in the name. For the rest, C# is as different from C as Java is from JavaScript. (And I hope you do understand that Java and JavaScript have almost nothing in common...).


Gulp. I only mentioned C# cos Jeffry mentioned it - chill out, dude! You're right, of course, that C# is a long way from C - basically it's another of Microsoft's many attempts to come up with a response to Java, this time more successfully (anybody else remember VisualJ++?). But C# and Java are both clearly "C-family" languages, like Unix scripting tools and others, but unlike Pascal or Lisp, for example.

Anyway, C is too close to the metal for me these days - life's too short for malloc and pointer errors!
Kevin Navles
Ranch Hand

Joined: Jul 26, 2009
Posts: 39
Maneesh Godbole wrote:
Jeffry Kristianto Yanuar wrote:Hi guys, I am Java instructor. Suddenly, I want to learn another programming language as additional language.


Just curious. How did you start out?
Almost every java developer I know, started off with C and them moved on to either C++ or Java.



Even I am... Did you just started with JAVA straight away....?
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8836
    
    7

Pat Farrell wrote:
Joe Ess wrote:On the minus side, C is one step above assembly language. . .

This is actually incorrect. . . C is PDP-11 assembly language.


I was referring more to the isolation level of the language rather than in strict terms of origin. Besides, unless our friend has dug up a PDP-11 or an emulator, C will not really be functioning as assembly language, right?
Jeffry Kristianto Yanuar
Ranch Hand

Joined: Oct 01, 2007
Posts: 759
Hi guys, sorry for not replying. I didn't get the notice on my E-mail. Thanks for all your replies.
Jeffry Kristianto Yanuar
Ranch Hand

Joined: Oct 01, 2007
Posts: 759
Maneesh Godbole wrote:

Just curious. How did you start out?
Almost every java developer I know, started off with C and them moved on to either C++ or Java.


Java is the first programming language I've learned until now.
frank davis
Ranch Hand

Joined: Feb 12, 2001
Posts: 1479
Pat Farrell wrote:
I strongly encourage folks to learn new languages, and it becomes easy once you have learned four or five. But C would be way down my list of suggested languages, well below Lisp, Smalltalk, Groovy, PHP, Python, Scala and others.


Excellent topic and I agree learning new languages is beneficial. Its gives new perspective to programming in general, new insights to how specific categories of languages work, preparation for Next Big Thing, etc.

Could you give reasons for your list? Maybe others could suggest list also with reason for reccomending each langauge.

I think .NET and Java are similar in many basic philosophies, although implemented differently, and while knowing both would be great for job opportunities it may not broaden/deepen knowledge programming philosophy. Maybe learning a new functional, scripting, or procedural language would be better to get a more 'liberal arts' type programming knowledge?
Jeffry Kristianto Yanuar
Ranch Hand

Joined: Oct 01, 2007
Posts: 759
herb slocomb wrote:

Excellent topic and I agree learning new languages is beneficial. Its gives new perspective to programming in general, new insights to how specific categories of languages work, preparation for Next Big Thing, etc.

Could you give reasons for your list? Maybe others could suggest list also with reason for recommending each language.

I think .NET and Java are similar in many basic philosophies, although implemented differently, and while knowing both would be great for job opportunities it may not broaden/deepen knowledge programming philosophy. Maybe learning a new functional, scripting, or procedural language would be better to get a more 'liberal arts' type programming knowledge?


Here's my reason :

  • I am sure that the JVM is created using C
  • I want to learn new language but not as high as Java
  • I want to try build GUI program using C
  • I want to try call C method using JNI
  • I want to add more skill in my CV
  • Learning the other programming language is like learning more than one human language
  • To maintain legacy program (if any) in the future of my career
  • Pat Farrell
    Rancher

    Joined: Aug 11, 2007
    Posts: 4646
        
        5

    Jeffry Kristianto Yanuar wrote:I want to try build GUI program using C


    THe rest of your list is fine, I like those reasons.

    But building a GUI program in C is too painful to contemplate. I've done it (way back in Windows 2.11 days) and strongly suggest you pick something else to try.

    You can't write a GUI in C without a huge amount of OS-specific help/libraries.

    There is a reason Xerox invented OO languages to build their first WIMP GUI. Its one of the places where OO really wins.
    Jeffry Kristianto Yanuar
    Ranch Hand

    Joined: Oct 01, 2007
    Posts: 759
    Thanks for the advice Pat, I will exclude that reason. Do you have any experience about what it likes when developing application in C? What is the type of software that can be done easily with C but not Java?
    Pat Farrell
    Rancher

    Joined: Aug 11, 2007
    Posts: 4646
        
        5

    Alan Turing taught us that any program can be implemented in any language. Some just make some problems easier than others.

    These days, I tend to think of C as the tool of choice for small, weird efforts that deal with hardware, where you need to touch the IO registers, etc. Up until fairly recently, C was also the language of choice for embedded systems, but that edge is being lost to Python, Lua, etc.

    To get a feel for C and why you like it, I recommend you get an Arduino kit, they are cheap, have an embedded processor, can turn on LEDs, do switches, etc all that kinda stuff that works well with C. While the Arduino code is not technically C, it sure looks like it. You can get an adruino for about $25. They are lots of fun.
    Jeffry Kristianto Yanuar
    Ranch Hand

    Joined: Oct 01, 2007
    Posts: 759
    So, can we create an OS using Java? I think almost every OS is created using C.

    My conclusion about Java and C is :

    To build system software, C is number one.
    To solve business logic as well as develop application software, Java is number one.


    Pat Farrell
    Rancher

    Joined: Aug 11, 2007
    Posts: 4646
        
        5

    Jeffry Kristianto Yanuar wrote:So, can we create an OS using Java? I think almost every OS is created using C.

    Java is a poor choice for all of an OS. But you are incorrect in assuming that every OS is built with C. First, you have to ask what is an OS? You will find that the kernel of most OS is written in a C-like language, but a lot of things that most folks consider part of the OS, can be written in any language.

    The visible part of OS-X is written in Objective-C, which is an OO type language with C roots. You could claim that Java is an OO language with C roots.

    All of the DEC operating systems back when it was a huge power were written in either assembly language or Bliss.

    For the past 20+ years, if an OS is started from scratch, they use a very small kernel written in a C-style language, and put most of the rest in modules. MACH was the first designed this way. The modules (non-kernel modules) can be written in any language you like, Python is a good choice.
    Embla Tingeling
    Ranch Hand

    Joined: Oct 22, 2009
    Posts: 237
    Pat Farrell wrote:Alan Turing taught us that any program can be implemented in any language.


    Only if the languages are Turing-complete. That's what Turing taught us.
    Paul Clapham
    Bartender

    Joined: Oct 14, 2005
    Posts: 18541
        
        8

    Maneesh Godbole wrote:Almost every java developer I know, started off with C and them moved on to either C++ or Java.

    Not me. I have been working on Java for about 10 years but I don't know now and never have known either C or C++.

    Frankly, when you're just working on applications which do things like make sure the garbage trucks pick up their load on time or the bills get paid before interest kicks in, you really don't need C or C++. And I suspect that most of the programming in the world today is on applications like those, although I don't have anything to prove that.
    Embla Tingeling
    Ranch Hand

    Joined: Oct 22, 2009
    Posts: 237
    Jeffry Kristianto Yanuar wrote:Here's my reason :

    I am sure that the JVM is created using C


    Are you sure you're using the term "instructor" correctly? A Java instructor would be a fairly qualified teacher who knows a lot of general computer science and can program in C for sure.

    Anyway there isn't just one JVM. There are many and most commercial JVMs are written in C++.

    Actually C++ may be a better choise for you. Although C is an important language in its own right it's also a subset of C++. It would be better for your career if you knew C++ in addition to Java instead of just C. Java and C++ are very different but used for the same purpose in many cases and because they approach the same thing differently it's very instructive to compare them. You'll become more competent in either language by knowing both.
    Jeffry Kristianto Yanuar
    Ranch Hand

    Joined: Oct 01, 2007
    Posts: 759
    uj nossnahoj wrote:
    Jeffry Kristianto Yanuar wrote:Here's my reason :

    I am sure that the JVM is created using C


    Are you sure you're using the term "instructor" correctly? A Java instructor would be a fairly qualified teacher who knows a lot of general computer science and can program in C for sure.

    Anyway there isn't just one JVM. There are many and most commercial JVMs are written in C++.

    Actually C++ may be a better choise for you. Although C is an important language in its own right it's also a subset of C++. It would be better for your career if you knew C++ in addition to Java instead of just C. Java and C++ are very different but used for the same purpose in many cases and because they approach the same thing differently it's very instructive to compare them. You'll become more competent in either language by knowing both.


    Java is my first programming language, in my university, it is the primary programming language.

    I could become instructor (in informal education) because I can prove my competency in java by achieving three sun certificates, that's all. Now that I already mastered Java, I want to learn the other language but not as high as Java. And the reasons are what I have mentioned above.
    Leandro Coutinho
    Ranch Hand

    Joined: Mar 04, 2009
    Posts: 417
    uj nossnahoj wrote:
    Jeffry Kristianto Yanuar wrote:Here's my reason :

    I am sure that the JVM is created using C


    Are you sure you're using the term "instructor" correctly? A Java instructor would be a fairly qualified teacher who knows a lot of general computer science and can program in C for sure.

    So, according to your theory, Paul Clapham would not be a qualified Java instructor, because he doesn't know C/C++.
    I don't agree. He is a Java instructor, not a C instructor.
    I know that is always good to learn other languages and during the process you end up improving your own, but you don't need to speak Japanese to be an English teacher.
    Embla Tingeling
    Ranch Hand

    Joined: Oct 22, 2009
    Posts: 237
    Leandro Coutinho wrote:So, according to your theory, Paul Clapham would not be a qualified Java instructor, because he doesn't know C/C++.
    I don't agree. He is a Java instructor, not a C instructor.
    I know that is always good to learn other languages and during the process you end up improving your own, but you don't need to speak Japanese to be an English teacher.


    And it's not enougth to speak English to call yourself an English teacher. And getting drunk on a regular basis doesn't make you a wine steward. And beating your spouse doesn't make you master of the noble art of self defense.

    When you present yourself as Java instructor you should know that you raise expectations a lot. You're expected to know not only Java but to be familiar with several other programming languages as well, including C. Furthermore you're expected to be well versed in general computer science and to have teaching experience. But maybe I'm old-fashioned. Maybe today I should consider myself lucky if my Java instructor even knows about the existence of other languages beside Java.

    Anyway, according to my theory I'm sure Paul Clapham won't call himself a Java instructor unless he is one.
    Jeffry Kristianto Yanuar
    Ranch Hand

    Joined: Oct 01, 2007
    Posts: 759
    uj nossnahoj wrote:

    And it's not enougth to speak English to call yourself an English teacher. And getting drunk on a regular basis doesn't make you a wine steward. And beating your spouse doesn't make you master of the noble art of self defense.

    When you present yourself as Java instructor you should know that you raise expectations a lot. You're expected to know not only Java but to be familiar with several other programming languages as well including C. Furthermore you're expected to know your way around computer science in general and to have teaching experience. But maybe I'm old-fashioned. Maybe today I should consider myself lucky if my Java instructor even knows about the existence of other languages beside Java.

    Anyway, according to my theory I'm sure Paul Clapham wouldn't call himself a Java instructor unless he were one.


    well when what you said is correct, I didn't say that Java is the only skill that I have. I also mastered PHP, javascript as well as MySQL as secondary skills (but not C). As I mentioned above, Java is the primary (actually is the only) language used in my university so no wonder that I don't have any experience in C. After all, if I do have, this topic would never exist.

    I don't think that car driving instructor should have understanding in tank driving skill even tank run on land either.
    Leandro Coutinho
    Ranch Hand

    Joined: Mar 04, 2009
    Posts: 417
    I recommend you this book: http://www.amazon.com/Core-Java-TM-I-Fundamentals-7th/dp/0131482025
    It has many comparisons with C/C++, and beyond this, it is an amazing book!
    Of course that you will also need a C book. :]
    Jeffry Kristianto Yanuar
    Ranch Hand

    Joined: Oct 01, 2007
    Posts: 759
    Leandro Coutinho, I already buy it and the volume 2.

    Leandro Coutinho
    Ranch Hand

    Joined: Mar 04, 2009
    Posts: 417
    Jeffry Kristianto Yanuar wrote:Leandro Coutinho, I already buy it and the volume 2.


    What do you have about volume 2? Is it nice too?
    Jeffry Kristianto Yanuar
    Ranch Hand

    Joined: Oct 01, 2007
    Posts: 759
    It is very nice, yet I haven't finish it yet. Highly recommended!!!
    Leandro Coutinho
    Ranch Hand

    Joined: Mar 04, 2009
    Posts: 417
    Jeffry Kristianto Yanuar wrote:Leandro Coutinho, I already buy it and the volume 2.


    Maybe you'll find this useful: http://msdn.microsoft.com/en-us/beginner/cc305129.aspx
    Devaka Cooray
    ExamLab Creator
    Saloon Keeper

    Joined: Jul 29, 2008
    Posts: 3017
        
      35

    uj nossnahoj wrote:When you present yourself as Java instructor you should know that you raise expectations a lot. You're expected to know not only Java but to be familiar with several other programming languages as well, including C

    Really? May I ask you the reason for this?
    Embla Tingeling
    Ranch Hand

    Joined: Oct 22, 2009
    Posts: 237
    Jeffry Kristianto Yanuar wrote:well when what you said is correct, I didn't say that Java is the only skill that I have. I also mastered PHP, javascript as well as MySQL as secondary skills (but not C). As I mentioned above, Java is the primary (actually is the only) language used in my university so no wonder that I don't have any experience in C. After all, if I do have, this topic would never exist.

    I don't think that car driving instructor should have understanding in tank driving skill even tank run on land either.


    Well, I wellcome your ambition to fill the C gap in your education. And afterwards you're a more well-rounded Java instructor better meeting expectations.

    As I've already suggested, I think you should go for C++ instead. C is a subset of C++ and learning C++ will allow you to draw important parallels to Java making you a better programmer of both languages.
    Embla Tingeling
    Ranch Hand

    Joined: Oct 22, 2009
    Posts: 237
    Devaka Cooray wrote:
    uj nossnahoj wrote:When you present yourself as Java instructor you should know that you raise expectations a lot. You're expected to know not only Java but to be familiar with several other programming languages as well, including C

    Really? May I ask you the reason for this?


    It comes with the general expectations on the instructor title. If you present yourself as instructor of any kind you're expected to have shoes on your feet.

    It's not like C is very strange and hard to learn. It's the archetypical procedural language and if you've had just some exposure to computer sceince & engineering in general it's almost impossible not to have come across it and picked it up.

    So if you walk around presenting yourself as Java instructor and it turns out you don't even know C, you'll be the laughing stock of everyone with just a little insight into the field of computing.
    Henry Wong
    author
    Sheriff

    Joined: Sep 28, 2004
    Posts: 18509
        
      40

    uj nossnahoj wrote:So if you walk around presenting yourself as Java instructor and it turns out you don't even know C, you'll be the laughing stock of everyone with just a little insight into the field of computing.


    Well, I wouldn't go that far. Granted, instructors should have knowledge of many programming languages, as it is a sign of experience. But generally people learn the languages that they use, and these days, it is possible to work on many many projects that don't use C.

    Henry
    Jeffry Kristianto Yanuar
    Ranch Hand

    Joined: Oct 01, 2007
    Posts: 759
    I think one day, all the universities will make Java or another high programming language as its primary programming language course
    Embla Tingeling
    Ranch Hand

    Joined: Oct 22, 2009
    Posts: 237
    Jeffry Kristianto Yanuar wrote:I think one day, all the universities will make Java or another high programming language as its primary programming language course


    Not the top universities, only secondary universities with no other ambition than to churn out minimum wage employes for Java sweatshops.

    A good computer science education shouldn't focus too much on programming languages, especially not on a single one. It should avoid the latest fads and concentrate on deep basic solid knowledge that doesn't change in a lifetime.
    Devaka Cooray
    ExamLab Creator
    Saloon Keeper

    Joined: Jul 29, 2008
    Posts: 3017
        
      35

    uj nossnahoj wrote:A good computer science education shouldn't focus too much on programming languages, especially not on a single one.

    Agree. But in my view, Java would be good as the 'main' programming language of the course. Further more, they should include some other programming languages as well. However I don't think that focusing much on *many* programming languages is important than well-focusing on a single language which is comfortable. Personally I never focused too much on languages other than Java.
     
    permaculture playing cards
     
    subject: I Want to Learn C As Additional Programming Language
     
    Similar Threads
    When should I make the jump to other programming languagues?
    Interview: How to answer questions about areas you're not as experienced in
    Java and beyond.
    How to learn java?
    Java to C/C++