Beginning Programming All-in-One For Dummies. Wallace WangЧитать онлайн книгу.
Shack TRS-80, it’s probably best to figure out programming on a computer that’s going to be around in the future. That way you can directly apply your programming skills to a computer used in the real world, which boils down to a computer that runs one of the following operating systems: Linux, macOS, or Windows.
An operating system is a special program that makes all the hardware of your computer work together. The operating system tells the processor how to work with the hard disk, read keystrokes typed on a keyboard, and display information on the monitor. Without an operating system, your computer is nothing more than separate chunks of hardware that do absolutely nothing.
It’s still possible to write programs for obsolete computers like the Atari ST, PDP-11, or Commodore Amiga, but most people choose to write programs for one of the following operating systems:
Linux: Linux is a free operating system for almost every computer (including PCs). Linux is becoming more popular with big companies (as opposed to individual users), so there’s a growing market for talented Linux programmers.
macOS: macOS is the operating system that runs the Apple Mac computer. Although Macs aren’t as popular as Windows computers, macOS is still a large and lucrative market.
Windows: Windows is the operating system that runs on most personal computers (PCs). Because so many people use Windows PCs at work and at home, the software market for Windows is huge and lucrative.
If you want to prepare yourself for the future, it’s probably best to begin programming on any computer that runs Linux, macOS, or Windows.
www.virtualbox.org
), you can run different operating systems at the same time, such as running both Linux and Windows on a PC or running both Linux and macOS on a Mac. That way you can practice writing programs for different operating systems on a single computer.
Most programmers use a desktop computer running Linux, macOS, or Windows to write software. With the growing popularity of mobile devices, wearable computers, and browser-based apps, there’s a huge market for writing apps for these devices as well:
Android: Android is Google’s free operating system that runs on the majority of smartphones and some tablets.
iOS and iPadOS: iOS and iPadOS are the operating systems that run on the iPhone and iPad, respectively. The iPhone is the most popular smartphone in the world, and the iPad is the dominant tablet in the world.
watchOS: watchOS is the operating system that runs on the Apple Watch. The Apple Watch is one of the most popular wearable devices in the world.
Wear OS: Wear OS is Google’s free operating system for smart watches. It’s a version of Android that runs on smart watches to compete against the Apple Watch.
To write apps for mobile and wearable operating systems, you normally need to use a computer that runs Linux, macOS, or Windows. However, you can use some of the more powerful tablets to write apps for smartphones and tablets, too.
Writing programs with an editor
After you have a computer that runs Linux, macOS, or Windows (or a powerful tablet), the next step is to get an editor. An editor acts like a simple word processor that lets you type, change, and save program commands in a file.
In the old days, you had to buy a programming editor. Today, you can often get a powerful, professional editor for free. Some editors are bundled with an integrated development environment (IDE), which combines the features of an editor with a compiler (to convert your code to assembly language or machine language) and a debugger (to find and fix problems in your code).
Some popular editors include the following:
GNU Emacs (www.gnu.org/software/emacs
): Editor only for Linux, macOS, and Windows
Playgrounds (www.apple.com/swift/playgrounds
): iPadOS and macOS
Visual Studio (https://visualstudio.microsoft.com
): macOS and Windows, with a limited version available for Linux
Xcode (https://developer.apple.com/xcode
): macOS only
Unlike a word processor, which offers commands for formatting text to make it look pretty or appear in different colors, text editors are just designed for typing commands in a particular programming language, such as C++, Java, or Swift:
The simplest editor just lets you type commands in a file.
More sophisticated editors can help you write a program byColor-coding program commands (to help you identify them easily)Indenting your code automatically (to make it easier to read)Typing in commonly used commands for you
Figure 1-2 shows a simple editor used to write a Swift program that creates a hypotrochoid art figure.
FIGURE 1-2: An editor lets you write and edit the source code of a program.
Without an editor, you can’t write a program. With an editor, you can write a program. And with a really good editor, you can write a program quickly and easily.
Converting