Here are a few suggestions that if followed should ease things a bit.
- Design First. Design your code before you start typing. The compile-download loop is longer for embedded systems. “Trial and error” coding doesn’t work well. It just leads to frustration and poor productivity.
- Work incrementally. Write small functions and test them as you go. Do not write a bunch of code and then compile it and test it. It is much harder to debug that way. Coding incrementally means that you are focusing on a smaller amount of code when debugging. This is always a good thing.
- Start Right Away. It is amazing how much faster you can find bugs when you are rested. Also, taking a break when you are faced with a difficult problem usually makes it easier to ultimately find the bug. Starting fresh the next day is also helpful. The worst possible situation is trying to find a bug at the last minute, especially when you wait until the last minute to code things up. When the pressure hits, IQ points seem to dissipate…
Frequently Asked Questions
- Why do we use the C programming language instead of C++, Java, Python, etc?
- What is the best way to prepare for the C quizzes?
- Read the sections from the C Programming wikibook.
- Carefully work through every question on the associated study-questions page.
- Where programs are present in the study questions, don’t try to memorize their output! Instead, study the programs, play with them, modify them, etc., until you completely understand what the programs do. One way to test your understanding would be to slightly modify the program and then to try and predict what the program will do, and then to compile/execute the modified program to see if its output agrees with your prediction.
- Work with the program examples in K&R so you can understand how these programs operate.
- Why do many of the programs in the study questions look different than the C code that you commonly see?
- These programs are testing your deep knowledge of the C language. When programmers are presented with code that is written somewhat differently than what they are used to seeing, they often struggle to understand what the code does. Working through the provided somewhat strange-looking examples in the study questions will help you to understand C code deeply enough that you will be able to comprehend what a program does no matter how it is written or formatted.
- Also, programs like those found in the study questions are often used in interview questions because potential employers are interested in the same thing, i.e., can you understand any C code, or can you only understand C code that has been formatted and written in the most obvious way? (I have been asked by companies if it is OK to borrow some of my study questions).
- Why does this class use a specific coding standard?
- Adhering to a coding standard improves the readability and structure of your code. Code that is carefully structured and that is easy to read usually has fewer bugs and is easier to debug.
- It is much easier to work together in teams when all of the programmers on the team write their code in similar fashion. Most all of you will work in teams during ECEN 390 (winter semester of your junior year). It is very difficult to share code if you don’t all adhere to some sort of standard.
- Coding standards are often used in industry so this is good practice.
- Good coders are disciplined coders; working within a coding standard helps to develop good coding habits.