Results 1 to 15 of 15

Thread: Learning C...

  1. #1
    Learning Java is offline Senior Member
    Join Date
    May 2010
    Location
    London
    Posts
    106
    Rep Power
    0

    Default Learning C...

    Ok so you're probably thinking what C has to do with a Java forum... but my question does relate to Java so I hope I wont get in trouble.

    I'm currently a Java newbie and I'm thinking of learning C. It would seem that many people advise against learning C/C++ as a first language... will basic knowledge of Java be enough to make learning C a little easier?

    Looking forward to your input,

    LJ

  2. #2
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    17,556
    Rep Power
    25

    Default

    Java might keep you on the OOP path. With C it is very easy to wander off.

  3. #3
    Zack's Avatar
    Zack is offline Senior Member
    Join Date
    Jun 2010
    Location
    Destiny Islands
    Posts
    692
    Rep Power
    5

    Default

    One of the biggest problems I have when I do a week of Java them jump right into C++ is that I'll do two things wrong:
    1) Start writing procedurally instead of strict OOP (what Norm said).
    2) Forget to memory manage. You can spam new in Java and not have an issue; in C++ it's quite a different story.

    As a rule of thumb, don't start another cookie until you're finished this one--if you truly feel that Java is holding you back or that C/C++ has something new to offer, then go for it. If you just want to try it for fun... I might stick with Java until it's mastered a little better first.

    That being said, it is your decision--whichever you feel is more advantageous to you as a learner will be the path you stick to better.

    Much luck!

    PS: Personally I started with Flash Actionscript then went to C++ and found it quite easy due to similar syntax. But not everyone agrees. Some people want to start with something like Python (which is remotely different) or Java, just for simplicity's sake.

  4. #4
    Learning Java is offline Senior Member
    Join Date
    May 2010
    Location
    London
    Posts
    106
    Rep Power
    0

    Default

    Thanks for your input guys.

    To be honest the main reason why I'm considering learning C is because of an article I read here -- see "The Pitfalls of Java as a First Programming Language". Also from what I have read (perhaps someone can confirm this) is that those who know lower level languages like C, find it easier to learn higher level languages like Java and such. So my thinking is that if I were to learn C --although it may be more difficult than Java-- I'd have a deeper understanding and therefore when I want to learn other languages I'd be able to pick up on them quicker. I feel as if the statement in the article applies to me:

    Java, instead of exposing this beauty, encourages the programmer to approach problem-solving like a plumber in a hardware store: by rummaging through a multitude of drawers (i.e. packages) we will end up finding some gadget (i.e. class) that does roughly what we want. How it does it is not interesting! The result is a student who knows how to put a simple program together, but does not know how to program.
    I'd like to be a serious programmer, so at some point I suppose I will have to learn C anyway -- right?

    Zack, when you said:

    As a rule of thumb, don't start another cookie until you're finished this one.
    What do you mean by that? I've never had an idea in my head as to when I can say I have "finished" learning Java. I mean, if someone were to ask if I can program in Java I'd say no because I don't feel as if I can. How do I measure what level I am at?

  5. #5
    masijade is offline Senior Member
    Join Date
    Jun 2008
    Posts
    2,571
    Rep Power
    9

    Default

    Quote Originally Posted by Learning Java View Post
    I feel as if the statement in the article applies to me:
    That quote is just not true. About the only difference between the languages in that aspect is that you do not have to do memory management in Java. If you do a bit a searching you will find literally millions of libraries for C that allow you to easily accomplish just about anything you might want to do in much the same way that the Java classes do. Just in Java they are included from the start, whereas in c you have get the library, first. Whoever said that is definately biased if not right out bigoted.

  6. #6
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,085
    Rep Power
    20

    Default

    Just look at what you get with C++ (which is a better match to Java than C)...

    That's as much as you get in Java, ignoring GUI and database related stuff (which you'd be a fool to try and write yourself). Hell, most of it was cribbed for the earliest version of Java.

  7. #7
    JosAH's Avatar
    JosAH is online now Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,648
    Blog Entries
    7
    Rep Power
    21

    Default

    I have programmed in C starting in the mid seventies in the last century; it was far before ANSI/ISO C saw the light and far before Bjarne Stroustrup invented his first version of C++. Knowing C, gradually learning C++ was (sort of) easy. In those days I also programmed in languages using a completely different paradigm: Lisp, Hope, a bit of Haskell; finally learning Java was a breeze for me; of course I had to get used to its idiosyncracies and cleverness (not really present in C++ which suffers from its C inheritance ;-) but I don't know if I'd recommend learning C; it's so close to the bare metal and so far from object oriented programming; it can be used in an object *based* way and it has all the building blocks to create an object oriented language, but that's it. All in all I find C a wonderful language but so is Lisp and Java; C++ is a behemoth that offers you all the arms to shoot yourself in the foot or in your back; I don't recommend C++.

    kind regards,

    Jos

  8. #8
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    17,556
    Rep Power
    25

    Default

    I started with Fortran and moved to assembler. After retiring I wanted to learn OOP so decided to learn Java and have been playing with it ever since. Really enjoy it.
    I've tried C++ several times and keep getting frustrated trying to use the help to get API doc for classes. The doc I've found has been so fragmented, with links that go in loops that after java's API doc, I've give up.
    A current project: EasyBridge written in C++ has been a trial. There are so many ways to screw it up, I can't count. The operator override stuff is cute and saves one or two lines of code but when working with pointers I never know if the code is comparing the pointers or what the pointers point to. And the legacy C stuff is a mess. Conditions: 0 vs not 0 for true and false. All the macro stuff can leave a program unreadable. I used lots or macros in assembler and am very used to them. etc etc I'm getting tired now and must go take my nap.

  9. #9
    Learning Java is offline Senior Member
    Join Date
    May 2010
    Location
    London
    Posts
    106
    Rep Power
    0

    Default

    Thank you for all of your input.

    Has anyone read "The C Programming Language" byBrian W. Kernighan and Dennis Ritchie? Would this be suitable for someone who knows the basics?

  10. #10
    JosAH's Avatar
    JosAH is online now Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,648
    Blog Entries
    7
    Rep Power
    21

    Default

    Quote Originally Posted by Learning Java View Post
    Has anyone read "The C Programming Language" byBrian W. Kernighan and Dennis Ritchie? Would this be suitable for someone who knows the basics?
    Definitely; it's the 'bible' (C-wise speaking); mind though, it looks like a booklet but the pages are also very thin; I recommend that you read (and understand) it cover to cover.

    kind regards,

    Jos

  11. #11
    Learning Java is offline Senior Member
    Join Date
    May 2010
    Location
    London
    Posts
    106
    Rep Power
    0

    Default

    If I read and understand it from cover to cover, how good of a C programmer would I be? (Hope that isn't a stupid question).

  12. #12
    Zack's Avatar
    Zack is offline Senior Member
    Join Date
    Jun 2010
    Location
    Destiny Islands
    Posts
    692
    Rep Power
    5

    Default

    Quote Originally Posted by Learning Java View Post
    Zack, when you said:
    ...
    What do you mean by that? I've never had an idea in my head as to when I can say I have "finished" learning Java.
    It's just a metaphor; you may never entirely finish learning a language. But don't try Java for two days, then C for a week, then C++ for a few days... if you want to learn programming, stick with something until you have a foundation then move up from there.

  13. #13
    JosAH's Avatar
    JosAH is online now Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,648
    Blog Entries
    7
    Rep Power
    21

    Default

    Quote Originally Posted by Learning Java View Post
    If I read and understand it from cover to cover, how good of a C programmer would I be? (Hope that isn't a stupid question).
    Beyond average; brilliancy isn't bound to a programming language; I've seen people who know K&R by head but lack the 'creativity' to be excellent.

    kind regards,

    Jos

  14. #14
    Learning Java is offline Senior Member
    Join Date
    May 2010
    Location
    London
    Posts
    106
    Rep Power
    0

    Default

    Thank you JosAH. I am going to buy the book and have a go at it :)

  15. #15
    Learning Java is offline Senior Member
    Join Date
    May 2010
    Location
    London
    Posts
    106
    Rep Power
    0

    Default

    Anyone read "Absolute Beginner's Guide to C" by Greg Perry? I think perhaps I'll purchase that along with "The C Programming Language" and go through that book first. It does seem to have some good reviews, and people have in fact specifically recommended reading it first. What do you lovely people think? :D

Similar Threads

  1. Learning Java...
    By Learning Java in forum New To Java
    Replies: 2
    Last Post: 09-24-2010, 09:03 PM
  2. Pre-requisites for learning JSP
    By xtiano77 in forum JavaServer Pages (JSP) and JSTL
    Replies: 0
    Last Post: 03-23-2010, 06:03 PM
  3. e-learning
    By Vipan Konnect in forum Advanced Java
    Replies: 3
    Last Post: 11-21-2009, 04:29 PM
  4. Self-directed learning
    By Mr.Beans in forum Forum Lobby
    Replies: 3
    Last Post: 05-05-2009, 10:40 PM
  5. Learning Java
    By Derkins in forum New To Java
    Replies: 3
    Last Post: 04-09-2009, 02:46 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •