views:

2016

answers:

23

Hi, I am learning programming. I plan on learning C and Objective-C this summer. I bought the C for Dummies book but it is a complete waste of time. It's way to many pages! Are there any good books I should read? Or should I just learn C from websites? What would be the fastest way because I really want to learn it fast and start learning Objective-C too.

Thank you

Also, how long does it take to learn C? Until I move to Objective-C 2.0

A: 

The fastest way in my view is through learn through websites.

  1. Set a goal of what you want to do and start a simple project
  2. Instead of reading too many books theoretically,google what you want to know to get it instantly as you go through your project.This way you get PRACTICAL knowledge.
  3. Watch online videos as well.Check out my question on VIDEOS here
  4. Ask whatever you don't understand on stackoverflow. We're here to help :)

Follow these steps and I can assure you that you will be a great programmer soon!

Cheers!

Josh
Just Googling for articles and code snippets isn't guaranteed to be an effective way to learn: a lot of the time, there will be gaps, or assumed knowledge, or even inaccuracies between different sources. Personally, I don't believe that "page faulting in knowledge", as Joel put it, is really a good way to learn—it might be fast, but you'll probably end up spending more time re-learning fundamental concepts, making the overall process slower and more painful as a result.
htw
what was it that?
austin
hmm...maybe.but,i've personally learn't that way for several years and it helps me with work now
Josh
what kind of websites should I use?
austin
Start a project first and google for what you need to know. Check out these sites mentioned on my question here http://stackoverflow.com/questions/856375/list-some-sites-for-free-c-video-podcasts
Josh
well what kind of project can I start with not much knowledge?
austin
What would you like to build? What's your dream software?
Josh
Just jump in and build your dream software as a starter project? This doesn't sound like a very good way to learn the fundamentals of something if you have no teacher. That's like telling a budding architect to just go ahead and make a skyscraper.
Chuck
Chuck is right. Expecting to build masterpieces right away is how a lot of would-be programmers get discouraged.
Matthew Flaschen
Well,then I guess the solution is to watch videos first before you start
Josh
+1  A: 

the way i learned quickest was to watch short video tutorials.

Samuel
Really? That blows me away. If you would have told me that 30 years ago when I was starting, I would have never believed anyone would EVER say that.
Nosredna
+7  A: 

When I look at the title of this question, I am guessing you are 12.

I started programming when I was 13 (I am now 14).

I found that learning depends on what kind of a learner you are!

I hate reading, I have the attention span of a moth and I learn best from videos. Therefor, I am a "visual learner". Try to find out what kind of "learner" you are, then do it that way. Remember, the easiest way is the fastest.

PS, here is a little tip. It may be frustrating (aseptically at our age). If you get frustrated, just put it down for like 10 minutes. Then come back and do research on what your learning. Programming WILL get very frustrating at times.

EDIT: By the way, I like to learn through video :p

Daniel Kindler
Totally agree. Started when I was 12, and now as a 24 year old, it's still extremely frustrating at times. But, you learn how to learn and the reward is always worth it.
Jon Smock
mhm. I cant tell you how many times I'v slammed my computer shut because I just had no idea what I was doing
Daniel Kindler
+4  A: 

I would take a look at The C Programming Language (K&R C). It's much less than 1000 pages and I think you'll find it well worth your while. As htw said, books do serve a purpose in that they provide a thorough and structured approach. K&R C in particular will give you real insight directly from the creators of C.

That's not to say you shouldn't Google things, read open source code, write little practice programs, etc. It all helps. Just remember to be patient. There's a lot out there.

Matthew Flaschen
htw
Chuck
haha. Wow it must me complicating?
austin
Alex Martelli
I'm with Alex. Take it slow and steady, but don't shy away. You'll appreciate your effort later.
Matthew Flaschen
+2  A: 

Don't be impatient; take your time. Follow tutorials, dissect short snippets of code, you'll get the hang of the language. Most importantly, write code yourself and learn from your bugs/errors.

And follow Stack Overflow ;)

Etienne Perot
+1  A: 

If you really want to start with C, I would start by just reading the first three or so chapters of C for Dummies, just to get a feel for how the language works. After that, I recommend going through web tutorials. Good web tutorials will have short code that explain specific functions, and the like.

As a 13-year old, though, I recommend starting with PHP. It's a simpler language to learn than C, but it's based off of C, so it won't be hard to make the transition, whenever you do so.

waiwai933
PHP is not based on C in any meaningful sense. It's written in C, and some of the APIs are similar, but it's a very different programming model and obviously neither is a superset of the other.
Matthew Flaschen
I think PHP is a lot like C if you're a beginner. From wikipedia: "In terms of keywords and language syntax, PHP is similar to most high level languages that follow the C style syntax. If conditions, for and while loops, and function returns are similar in syntax to languages such as C, C++, Java and Perl."
Nosredna
+8  A: 

For learning C, I highly recommend Learn C on the Mac, by Dave Mark. Not only is it aimed at beginners, but it also teaches you a lot about the important fundamentals of programming and computer science (e.g. data structures, recursion, etc.). It's very accessible, well-written, and easy to read. Plus, I found the examples engaging and interesting to work with. After that, if you really want to solidify your foundations in C, I'd recommend trying to moving on to The C Programming Language. It's a challenging book, so take it slowly. If you find yourself having too much trouble with it, I'd say you can just skip to Objective-C, and then come back to The C Programming Language later, once you've gained more familiarity with programming in general.

A lot of people will probably recommend The C Programming Language (a.k.a. "K&R") as your first book to read on C. No doubt it is a very well-written C book (and it's short too—only around 200 pages), but I'd say it'd be a little intimidating as a 12-year-old's first exposure to C: it's pretty dense and hardcore. You can tell that it's definitely aimed at an older audience with a strong background in computers/engineering. But nevertheless, if you already know the basics of programming, reading K&R will give you invaluable insight and understanding of C. You should definitely read it at some point in your programming endeavors.

Anyways, for Objective-C, if there's only one book I could recommend, it would most definitely be Cocoa Programming for Mac OS X, by Aaron Hillegass. It's really not that long (~400 pages or so, although I'd reckon that a lot of that is due to the number of illustrations in the book), and you can get some pretty cool projects up and running in an afternoon. It's very clear and easy to read, the examples are practical and interesting to follow, but most importantly, it's got this right blend of not being too intimidating while still managing to provide you with solid information. Plus, it'll teach you more than just Objective-C: I found that I had learned some very useful design patterns, for example, by learning how some of the components of Cocoa worked.

htw
Chuck
how long would it take for me to learn c before moving to objective c?
austin
There are some exceptions in the "For Dummies" series -- "Python for Dummies" is good, so is "Bridge for Dummies" (the former's author is a friend so I'm biased, but I don't know the latter's personally and he IS one of the greatest bridge players and writers of all times). Despite the exceptions, Sturgeon's Law applies to For Dummies books as it does to _almost_ everything else;-)
Alex Martelli
@austin: Depends on how much you want to do with it. If you really want a strong foundation in C, I'd say several months, but you can pick up the basics of C in less than a month if you want to move onto Objective-C quickly. Plus, while Hillegass's book already assumes you know basic C, you can still learn some good C programming practices by learning Objective-C.
htw
@Alex: Good point. I definitely think that it's down to the author, although with "For Dummies" books, I tend to think that they allow shoddy authors to get away with shoddy work a lot of the time. But you're right, it does depend, and they're not all bad.
htw
Austin, learning C is a long-term effort. It may be worthwhile to learn the /basics/ of C before investigating Obj-C. But don't wait until you're a C expert, because that takes a very long time. :)
Matthew Flaschen
htw
0 vote downcheckPlease login or register to use voting.(click on this box to dismiss)Please login or register to use voting.(click on this box to dismiss) I own http://search.barnesandnoble.com/Programming-in-Objective-C-20/Stephen-Kochan/e/9780321566157/?itm=1 for objective c2.0. So I dont want to read a different book which is 2.0 and get confused??
austin
@austin: Don't worry, the third edition of Cocoa Programming for Mac OS X covers Objective-C 2.0. I'm sure you won't be confused if you read it in tandem with the other book you have.
htw
so I am going to read http://www.amazon.com/Learn-C-Mac-Dave-Mark/dp/1430218096 which is like 376 pages. then http://www.amazon.com/Programming-Language-Prentice-Hall-Software/dp/0131103628 which is 200. thats 576 pages. Or should I just read the first one then go to objective c. then read the other c book after I know like 3 languages?
austin
Here's what I would recommend: definitely read Learn C on the Mac first, and then try to read The C Programming Language after that. Give it a chance, and if you find it to be too much of a challenge, then go ahead and move on to Objective-C, but make sure to come back to it after you've gotten more familiar with programming in general.
htw
how long should that take? maybe a month. I will probably be spending about 80 hours a month in programming.
austin
Like Matthew said, learning C is a long-term effort. Personally, I would suggest you spend *at least* several months to build a good foundation in C, or maybe even more. If you really want to move onto Objective-C quickly, you can probably learn the basics of C in about a month. Perhaps you could start learning Objective-C while, in parallel, keep building your foundation in plain C? Not sure if that would work, but it's a thought…
htw
+2  A: 

Checkout out http://www.cprogramming.com/ or and online K&R type book

Preet Sangha
A: 
Norman Ramsey
+15  A: 

There's no need to rush. Learn at your own pace and find your optimal way of learning.

If reading is your thing, then try to read some books and take it slowly.

If you find a concept you grasp, practice. If you find a concept that you don't quite get, experiment. Once you think you understand the concept, try re-reading the material to see if you understand it the second time.

I found out that I wasn't really good at learning though books -- I generally had to get the first kick-start with a structured lessons in a classroom. A semester course at a community college on Java was able to nudge in the direction of being able to begin effectively learning on my own. See if there are any programming courses offered in your school.

(Although at your age it may be a little bit difficult to find -- I didn't get any formal classes until community college -- my high school did not offer any programming courses.)

One of the things to be careful of is learning it the wrong way.

Rushing through material, or reading poorly written, inaccurate learning material can lead to a situation where you'll need to "un-learn" the concepts and re-learn it the right way.

In that respect, the K&R book (The C Programming Language by Kernighan and Ritchie) would be the "right way" of learning, but it's not a very approachable book. That isn't to say that it is the definitive book on C -- but even after programming in C for a couple years, I still try to take read it a bite-size at a time.

But then again, I can't really think of other "great" sources for learning C. My recommendation would be to take a look at K&R and work on a few pages at a time. Don't think about reading it like a regular book -- read one section, try it out. Do it little-by-little. Once again, don't rush. Work at your own speed.

And be sure to write code. Without seeing it working, it's going to be difficult to learn programming. And don't have huge expectations at first, as most of learning C at the beginning will involve programs that deal with only text.

Once you get a handle of things, try to write clean code that is readable by others -- that should be a motivation to write clean and clear code, and it will force you to think harder about what you're doing.

It's going to be a long adventure, so take it a step at a time. Good luck!

coobird
htw
True, even I need to read it a little at a time to get a good grasp on things. But I do think there's an importance in learning things right the first time than learning bad coding practices and not knowing it.
coobird
Oh, and don't underestimate the ability of 12-year olds ;)
coobird
Also, C itself is aimed at "at engineers and people who work with computers a lot."
Matthew Flaschen
htw
htw
coobird
htw
@htw: A Mac-based C book may be appropriate considering he wants to use Objective-C later. :)
coobird
Very nice answer.May I quote you on thin? :)+1
the_drow
@the_drow: Thank you :) Excuse my ignorance, is "thin" some website? (Or is it a typo of "this"?) The contents of this website is under the Community Commons license as shown at the bottom of each page, so feel free to use this answer according to the terms of the license. :)
coobird
o I am going to read amazon.com/Learn-C-Mac-Dave-Mark/dp/… which is like 376 pages. then amazon.com/Programming-Language-Prentice-Hall-Sof… which is 200. thats 576 pages. Or should I just read the first one then go to objective c. then read the other c book after I know like 3 languages?
austin
A: 

By far the best way (and usually the fastest) to learn programming is to find a good mentor. That's easier said than done. But I think you'd be surprised how many people would be willing to help you out. My advice would be just don't be afraid to ask.

If I were you I would find a local FIRST robotics team and see if you can hang out for some of the coding. Odds are you'll be working on a similar problem and will have some support from people who have a decent amount of experience. That's what I would have done, anyway.

cwash
+2  A: 

I've been where you are. It wasn't fun. This is what saved me:

(Apparently new users aren't allowed to post hyperlinks, so google for "steve summit C", use either the first or the third link, and then click "introductory C programming class notes")

It's a C class by a guy named Steve Summit. Super easy to follow, much easier than K&R, imo. Also, it's free, and there aren't any ads. I loved it. It's how I learned C. I hope it'll do the same for you.

A: 

I just cannot believe that everyone suggested C as a good starting point. You have to be joking. Besides the fact that both C and Object C are as old as earth and not practical in most real-world scenarios, i don't know why you'd ever consider it as your first language to learn. Save your breath and start with C++, rather than going from procedural nightmare to Object Oriented design.

Sergey
C++'s conceptual weight is far too great for a beginner. Why not go with Java or C#?
cwash
-1: "Object C" is "not practical in most real-world scenarios"? Uh…sorry, considering that 95% of all Mac OS X applications are written in Objective-C, and considering that all iPhone applications are written in Objective-C (do you know how much of a market there is for the iPhone?), and considering that even C itself is frequently used in performance-intensive code (graphics) and low-level development (device drivers, embedded systems, etc.), I have no choice but to downvote this answer.
htw
You're absolutely correct. Both are probably the best starting points for beginners. You learn object oriented principles in a clutter-free environment from the start, which is more valuable in software architecture than simply being a good coder. However, C++, like C, forces you to understand the architecture beneath it. Something you rarely have to even think about with Java or C#. I think it's always good to have the knowledge of how the memory is structured and how to use it properly.
Sergey
MAC OS and iPhone? lolYeah, some industry that is. 95 % of MAC OS applications consist of about 6% of the entire software chunk in the industry. I'm not even saying anything about iPhone development, which is an entertainment joke. You are right about device drivers and embedded systems. That's why i said "IN MOST REAL-WORLD SCENARIOS" not "IN ALL REAL-WORLD SCENARIOS". I've been professionally working with C++ for 5 years and i'm yet to meet anyone who's actually done any work in C in the last 10 years. It's a small niche.
Sergey
Macs are a niche, blah blah blah…telling someone who obviously wants to learn programming on the Mac/iPhone that what they want to learn is "not practical" just isn't helpful IMO, hence the downvote. The question was not "What's the best programming language for me to learn?" It's *specifically* asking about C and Objective-C (or, as was implied, Mac/iPhone programming). Sure, Macs don't have much market share, but 1) how is that relevant to the question? And 2) how does that make Objective-C and C "impractical"? Just because there are less jobs for it? =/
htw
I think C++ is a terrible place to start because it has all the C baggage and its own baggage as well. You're basically saying, don't learn C first, learn C AND C++ first.
Nosredna
Oh my god, we're starting a war here. He said he wanted to learn C and then move up to objective-C. I thought it would be easier to start with C++ because it is Object Oriented and it would be easier to be going into it with some OOP background rather then procedural. I didn't say learn C and C++. I said that both language force you to learn the architecture beneath. Thanks for a downvote.
Sergey
Honestly, for someone completely new to programming, I would advise them to get familiar with basic procedural concepts *before* worrying about OOP issues. You know, functions, flow control, and the like. They're simpler and more relevant to a new programmer than things like inheritance or polymorphism are. Like I said, that's not the reason why I downvoted your answer, but I just thought I'd throw that out there.
htw
C++ is a terrible suggestion in the context: the OP is looking to go to Objective-C, ie to Mac or iPhone programming. While C++ can be used on those platform, it's also one of the worst language ever for a beginner. Probably even worst than Fortran. Given the OP's goal, other suggestions above are far better.
Jean-Denis Muys
+2  A: 

There is nothing so educational as a piece of code you can run and tweak. Code examples in books can be really bland and not very applicable. The exception to this rule was the Perl Cookbook which is jammed packed with really useful little snippets for your perl programs.

The topics (or 'idioms') in it were so useful and so applicable across languages that some smart folks have taken to replicating them in different languages. Each has a varied level of completeness, but it's interesting to see how different languages do the same things.

Take a look here http://pleac.sourceforge.net/ for nuggets of programming wisdom that you can shake a stick at. At the very least its interesting to see how simple things written in one language require reams of code in another.

Were I starting to learn programming again I would probably pick something easy and forgiving, a dynamic language, like Python, Ruby etc. Once you get your head around the basics in one of these (flow control, data structures etc) it will make learning C/Objective-C so much easier. Also you'll find that you'll want to write once-off tools and scripts to help you in your Objective-C development that would be tedious and time consuming to write in C but are a matter of lines in a modern dynamic language. Never hurts to have another tool in your belt.

Good luck

sgargan
A: 

I started learning to program in Basic in about 1981 when I was 10. Not many years later it was 6502 assembly to try to get more speed out of a 1 MHz Apple IIe clone.

Pascal was a revelation in 1988 - programming without line numbers.

Modula-2, C, Eiffel, Miranda, Haskel, and Prolog at university as well as scripting in any number of languages.

C++ professionally for about 6 years.

C#, then Java, Ruby, and now back to C# for the last 18 months.

Python somewhere along the way.

My advice, pick the language that is best suited to the problem you need to solve today.

The first problem you have is to learn the basics ie how to break down a problem and express it in a clear and concise manner. I suggest you choose something other than C. I recommend Python as the online documentation is excellent and the libraries are great and you will spend more time writing interesting code and less time trying to figure out why your code stopped due to a segmentation fault.

When you've got the basic concepts under your belt, try some assembly and learn what's going on under the hood. If nothing else, you'll learn how fast CPUs really are. C is a good step after that. I also suggest you try Java or C# before Objective-C.

As to how long before moving to Objective-C, it really depends on how talented you are. If you're really good, then once you've learnt your 3rd or 4th language you'll can be more productive than most coders within 6 weeks of starting a new language (although changing language families (ie imperative, functional, object oriented) takes longer). If you're no good then don't expect to get past the first. Hopefully you make it into the first category.

+1  A: 

Different people have different preferred ways of learning. You can see that in the variety of responses above.

So how do you like to learn? Do you like to sit by yourself with a book and a computer? Do you like to sit in a classroom and absorb learning? Do you prefer set exercises, or mini-projects?

When I learn new programming languages, I find it helps me if I have a small application or problem to work on. I prefer to have a problem to work on. If you have a little project of your own that you always wanted to do, use that. If not, as someone above suggested, join a robotics group. Set up a web page and write some programs to do stuff for that. Look on the web for programming challenges. Google has a fun one every year.

If you want an idea, write a sukoku checking program. Then later, write a sudoku solver!

I like to use a variety of books, rather than just sticking to one or two of the ones suggested above. Find a book whose style you like. Try a few from the library until you find one or two that really click for you.

Personally, I like O'Reilly Publishing books for their chatty and readable style. I learnt C from Deitel, which is more of a classroom style textbook, but it has lots of examples and discussion points.

As you work through examples on your computer, you might wonder how things change if you tweak the code. I learn a lot by first running the example code suggested in a text, but then changing it to see what happens. If I get what I expect, it's a sign that my understanding is pretty good. If I get something unexpected, I try to figure out how I misunderstood what I did.

One last suggestion. Why not start with Python rather than C? I hear that a lot of schools are teaching Python to their kids. The reasons I suggest this are:

Python is pretty easy. You don't have to lay out memory, declare variables and such. No tedious bookkeeping.

Python gives you a nice growth path. You can start off just writing script style programs, using the built in types like lists and dictionaries. Then you progress to using new modules as you need them, and advance into object-oriented coding using classes. There's some functional programming stuff in there too, which you can start learning once you have the basic mechanics of the language under control.

I just love visiting new parts of python all the time.

You can get a lot done in python. It comes with a whole lot of built in modules to do almost anything you like - email, web, xml, graphics, gui, etc.

:)

mataap
+1  A: 

When I was learning to program in C, I found that Practical C Programming was a good resource. It's a very approachable book with lots of examples.

Stephen Van Dahm
htw
A: 

I own http://search.barnesandnoble.com/Programming-in-Objective-C-20/Stephen-Kochan/e/9780321566157/?itm=1 for objective c2.0. So I dont want to read a different book which is 2.0 and get confused??

austin
That book seems ok to me from a cursory look.
Jean-Denis Muys
A: 

In addition to whatever books and websites you end up using, you might consider looking around your area for local support groups. Many areas have a Linux user group or a group for Java or Ruby programming. Professional programmers use these groups to help each other with their programming problems, but the groups are generally friendly to young people and beginners. Don't feel embarrassed or awkward because of your age and inexperience. Most people will admire your initiative and curiosity and be happy to help you when you run into problems.

Stephen Van Dahm
A: 

Assuming you have some basic programming knowledge, Cocoa Dev Central have a series of articles that explain basic C then Objective-C, in a somewhat-less-than-1000-pages way..

Learn C for Cocoa, then Learn Objective-C

Shouldn't take even an hour to go through. The articles don't cover anything remotely advanced, but if you're learning ObjC to write OS X applications, the ObjC bit is basically trivial, it's Cocoa that is difficult to learn!

dbr
A: 

If you want to learn Objectif-C to create iPhone application, don't waste your time on C and learn Objectif-C now, then a book on iPhone programming. It will be more than 1000 pages but if you want to program in your life, you have to be used to read these types of book.

Nicolas Dorier
A: 

Honestly, I learned Java as my first programming language (I discovered it in high school and decided programming was fun and it was what i wanted to do)

I just now picked up Obj-C in a few weeks, reading a little bit from some books, but not a whole book, and using the internet a lot if i can't figure out the syntax (format/grammar of how the program should be structured and written) for something etc.

How fast you can pick up a language depends on how much you understand the fundamentals of programming. You will only get better at it with time and practice.

If you can understand the fundamentals of programming in general then you should be able to apply it to any language, the hard part is learning and remembering the syntax of different languages. Like in Java, you don't have to do memory allocations, but in C, C++ and Obj-C you do. I've never written a C or C++ program, but now that I've learned and written some programs in Obj-C (i've been making iPhone stuff, it is fun) I'm sure I could pick up C and C++ like it's nothing.

You don't have to learn C first in order to learn Obj-C is what i'm trying to say. But it never hurts to know multiple languages.

It is all about your level of understanding how a program works, how to structure one. I love objective-C because it is Object Oriented like Java so it was easier for me to understand and learn quickly, just had to get used to some of the differences in syntax

(I'm also getting close to graduating from college now so I'm surrounded by programming stuff, from procedural languages like ada to object oriented like java, and knowing the nitty gritty behind the scenes stuff that makes a program work, so understanding and learning a new language has gotten a lot easier for me, you start seeing how they relate and don't relate and it is cool)

It is great that you are starting so young. I'm sure you'll pick up on this stuff real fast, and if it is something you really enjoy, it will be even easier.

Good Luck! and have fun! programming can be so frustrating... like, spending 3 hours debugging when you find out it was because you if statement used a grater than instead of grater than or equal too or something like that. but, once you are done with the program, it is so rewarding, and then you just want to make it better and better haha.

I dunno if this helped at all, I hope it did, somehow...

=)

Wolfcow
+2  A: 

Stanford University posts online the lectures, class notes, and assignments for CS193P (an iPhone development class). If you don't know C or Objective-C at all, it might be tough, but I highly recommend this if you intend to do iPhone development.

I think I've read every Cocoa and Objective-C book out there, and most enjoyed Aaron Hillegass' Cocoa Programming for Mac OS X.

zpasternack