Beginning Programming All-in-One For Dummies. Wallace WangЧитать онлайн книгу.
or small teams of people who worked in the same room. If they needed to talk to each other or share code, they could simply copy files from one computer to another.
However, as programs have gotten much larger and more complicated, it has become common for multiple teams to work on a single program. Even worse, these separate teams may be located in completely different parts of the world and in different time zones. How can multiple teams work on the same program simultaneously? The answer is through version control or source management.
The problem is that at any given time, only one person can work on a program. Because most large programs are divided into multiple files, all files get stored in a central repository so there’s only one copy of a program.
When someone needs to edit the program, they can check out the file they need. When they check out the file, the repository stops anyone else from checking out that same file. That way two or more people don’t try to modify separate copies of the same file and then wind up not knowing which version of the file to use in the future.
When someone gets done editing a file, they can return it back to the repository for someone else to check out. Although there’s only one copy of a file that others can check out, the repository will often save the previous versions of each file. That way, if a modified version of a file causes catastrophic errors, it’s easy to revert back to the previous version of that same file.
Sometimes two or more programmers will be allowed to check out the same file, and when they’re done, the version control software can merge the two different file versions into a single, new version. However, merging changes made in separate copies of a file can cause problems if the changes in one file interfere with the changes in another file.
For example, suppose one programmer deletes a function in a file because it causes problems, but a second programmer writes new code that relies on that function. Merging the two changed files will then be tricky because if the deleted function is added or kept out of the file, it risks causing problems either way.
Whether a program is small or massive, it can benefit from version control management. Version control makes sure you always work with the latest approved versions of a file and that you’ll always have backup copies to fall back on in case you make a mistake.
If you work alone, version control management can keep you from losing crucial data. If you work in teams, version control management can improve everyone’s efficiency by making it easy to work on multiple files simultaneously.
Creating a Help File
Hardly anyone reads software manuals, so when people need help, they typically turn to the program’s help file for answers. This help file is essentially the software manual organized as miniature web pages that you can view and click to see similar (linked) information.
Almost every program has a help file, but creating a help file can be tedious and time-consuming. So, to simplify this process, many programmers use special help file creation programs.
Just as a word processor makes it easy to write, edit, and format text, help file creators make it easy to write, edit, organize, and link text together to create a help file.
Installing a Program
Before anyone can use your program, they need to install it. Some programs are simple enough that the user can simply copy it where they want to store it. However, most programs consist of multiple files that may require creating new folders to store data or allow access to the Internet.
Installation programs simply automate the process of storing a program on a computer to make the process as simple and easy as possible. This may include adding shortcuts or icons to the computer for faster access to running the program.
Even if a program is simple enough to be copied as a single file, it’s usually best to use an installation program to install that program instead. That way you can be certain all files are copied in the correct location.
Dissecting Programs with a Disassembler
A disassembler acts like a reverse compiler. A compiler converts your program (written in any programming language, such as C++ or Swift) into machine language; a disassembler takes an executable file (which contains machine-language code) and converts it into assembly language.
Disassemblers can’t convert machine language back into its original source code language (such as C++) because disassemblers can’t tell which programming language was originally used. An executable file created from a C++ program looks no different from an executable file created from a Kotlin or Swift program. Therefore, disassemblers can only convert machine language into assembly language.Disassemblers have both honorable and shady uses. On the honorable side, antivirus companies use disassemblers to dissect how the latest viruses, worms, and Trojan horses work. After they know how these nasty programs work, they can figure out how to detect, stop, and remove them.
On the shady side, many companies use disassemblers to tear apart their rivals’ products and see how they work. After you know how a competitor’s program works, you can copy those features and use them in your own program.
Programming languages, such as C#, Java, and Visual Basic .NET, get compiled into bytecode format; therefore, a disassembler can reverse-compile a bytecode file into its original source code. So, if you compile a Java program into bytecode format, a Java disassembler can convert the bytecode file into Java source code. Likewise, if you compile a C# or Visual Basic .NET program, you can disassemble that bytecode file into its original C# or Visual Basic .NET source code.
To protect their bytecode files from disassemblers, programmers use another program called an obfuscator. An obfuscator essentially scrambles a bytecode file. The bytecode file can still run, but if other people try to disassemble an obfuscated bytecode file, they can’t retrieve the original source code.
If you use a programming language that compiles into bytecode (such as C#, Java, or Visual Basic .NET), consider using an obfuscator to protect your source code from prying eyes.
At the bare minimum, all you need is an editor (to write programs) and a compiler (to convert your programs into executable files). However, most programmers use a debugger, version control software, and an installer. Although most programmers are happy when they can get their programs to work, some programmers use a profiler to help them speed up and optimize their program.
Finally, some programmers use disassemblers to peek inside the inner workings of other programs, such as viruses or rival software. Disassemblers are never necessary for creating a program, but they can prove useful for legal and not-so-legal purposes.
The tools of a programmer are highly subjective. Some programmers swear by certain tools, such as their favorite editor or compiler, whereas others are happy with whatever tool is available. Just remember that programmer tools can help you write faster and more reliable programs, but the best tool in the world can never substitute for decent programming skills in the first place.
Book 2
Programming Basics
Contents at a Glance
1
Chapter 1: How Programs Work
Using Keywords as Building Blocks
Organizing a Program
Dividing