5 ways to learn about programming
Open source is about creating a program to solve a problem that’s interesting to you. There are many inroads to learn about programming, there is no “one true path” to write your first program. This year, we shared several articles to help new programmers get started. Use these as a starting point for your own journey into programming:
Learning with the turtle
A great way to get started in programming is with a visual programming interface. One popular system is Turtle Graphics, which is available for the Python programming language. Don shares how his experience in learning to use the ‘turtle’ module introduced him to Python and opened up a world of creativity and learning.
Learn C by writing a number guessing game
Every time I’ve learned about a new programming language, I practice by writing a simple game, like a number guessing game. This exercises several things in programming, including how to store values in variables and how to compare values and how to print messages. If you’re new to the C programming language, or just want to learn more about it, try writing this game to guess a number between 1 and 100.
You can improve your number-guessing game by using Random numbers from the Linux kernel.
Common C programming bugs (and how to avoid them)
Programming in C can provide a lot of flexibility to writing your own command line programs. The trade-off to writing in C is that you need to be more careful. In “higher level” programming languages like Rust, Go, or Java, the language helps to protect the programmer from certain common mistakes. But in C, you need to watch for these pitfalls yourself. Here are five common C programming bugs, and how you can avoid them.
Programming across platforms
The C programming language remains an extremely popular language, and you can find a C compiler on most systems, and easily compile your programs anywhere. But that doesn’t mean that all C implementations are the same. If you’re writing a C program that should operate on multiple systems, use the C preprocessor to help you write programs across different platforms.
Dig deeper into cross-platform programming practices with Writing portable C programs and Portable programming practices.
A gentle introduction to ncurses
In days past, Unix programs ran in “teletype” mode, reading from standard input and writing to standard output. Another way that programs can interact with the user is using screen control, by manipulating the screen directly. The classic way to do this is with the curses library from BSD Unix, but Linux systems provide the same interface using ncurses, or new curses. Let’s explore ncurses by writing a “Hello world” program.
Learn more about ncurses with Terminal size and ncurses and Write a guessing game in ncurses.