Introduction to C programming/Lectures/Introduction

From Wikiversity
Jump to navigation Jump to search

What is programming?[edit | edit source]

Programming is the method we use to make the computer do what we want. Contrary to common belief, computers are very stupid. They need to be told how to do even the simplest things down to the tiniest detail. Programming is the act of instructing the computer how to do something.

What is a programming language?[edit | edit source]

A programming language is the way we communicate with the computer. It's the same concept as a spoken language. When you talk to another person, you use a set of symbols (words) with a meaning you both know. When programming, you use a set of symbols that a program called a compiler knows. The compiler then translates it into a series of instructions for the processor.

Why use C?[edit | edit source]

A couple of reasons, actually.

  1. C is a common language in real world applications.
  2. Most modern languages have a C-like syntax, even if they aren't C.
  3. C has a simple syntax, and the user can avoid advanced features until they're more accomplished programmers.
  4. In C, what you write is what you get. No worries about the compiler doing things behind the scenes, the compiler makes no assumptions in C.
  5. C has user managed memory. Some people treat this as a bad part of C for learners. I disagree- if a student doesn't learn memory management early, they never truly understand it. Since resource acquisition is one of the most common tasks in programming, it makes sense to do so early.

What is debugging?[edit | edit source]

Debugging is searching for mistakes in your program. No one is perfect, we all make mistakes. Despite having programmed for nearly a decade, I made several errors while writing the first few programs for this class. If you're going to program, you're going to need to learn to debug. This class will teach some basic debugging techniques and common mistakes along with the rest of the material. Don't treat this as a minor part of the class - you will generally spend more time debugging a program than you will writing it.

What is software engineering?[edit | edit source]

Software engineering is a set of habits and practices that help to make your code easier to read and understand. The easier your code is to understand, the fewer bugs it will have, and the easier they will be to find. It will also make it easier to maintain when you find a bug or want to add a new feature 6 months from now. Trust me, you won't remember how you wrote the code, no matter how much you think you will. Its always best to get into good habits early, so the class will try and teach you how you should do things, as well as just the syntax of the language. Remember, writing good code isn't just for yourself - it helps your coworkers and anyone else who ever has to work with your code.

Using the book[edit | edit source]

This course uses the C wikibook as the class book. If you look at the schedule, you see we will be going out of order and jumping around a bit. This is to try and teach things in the order I think they ought to be covered. Feel free to read any sections we skip, but we will most likely be coming back to those sections later.