Wallace Wang - Beginning Programming All-in-One For Dummies
Здесь есть возможность читать онлайн «Wallace Wang - Beginning Programming All-in-One For Dummies» — ознакомительный отрывок электронной книги совершенно бесплатно, а после прочтения отрывка купить полную версию. В некоторых случаях можно слушать аудио, скачать через торрент в формате fb2 и присутствует краткое содержание. Жанр: unrecognised, на английском языке. Описание произведения, (предисловие) а так же отзывы посетителей доступны на портале библиотеки ЛибКат.
- Название:Beginning Programming All-in-One For Dummies
- Автор:
- Жанр:
- Год:неизвестен
- ISBN:нет данных
- Рейтинг книги:5 / 5. Голосов: 1
-
Избранное:Добавить в избранное
- Отзывы:
-
Ваша оценка:
- 100
- 1
- 2
- 3
- 4
- 5
Beginning Programming All-in-One For Dummies: краткое содержание, описание и аннотация
Предлагаем к чтению аннотацию, описание, краткое содержание или предисловие (зависит от того, что написал сам автор книги «Beginning Programming All-in-One For Dummies»). Если вы не нашли необходимую информацию о книге — напишите в комментариях, мы постараемся отыскать её.
Beginning Programming All-in-One For Dummies
Beginning Programming All-in-One For Dummies — читать онлайн ознакомительный отрывок
Ниже представлен текст книги, разбитый по страницам. Система сохранения места последней прочитанной страницы, позволяет с удобством читать онлайн бесплатно книгу «Beginning Programming All-in-One For Dummies», без необходимости каждый раз заново искать на чём Вы остановились. Поставьте закладку, и сможете в любой момент перейти на страницу, на которой закончили чтение.
Интервал:
Закладка:
Because C programs are nearly (note the emphasis on the word nearly ) as easy to write and understand as higher-level languages but still give you the power of accessing the computer's hardware like assembly language, C is often used for creating large, complicated programs (such as operating systems and word processors) along with more exotic programs (like antivirus utilities or disk diagnostic programs).
With great power comes great responsibility, and C is no exception. Because C programs can access every part of the computer’s hardware, C programs can fail dramatically by crashing other programs, including the entire operating system.
The efficiency of C
A C compiler tends to create smaller, faster, more efficient programs than compilers for other programming languages. The reason is that the C language is much simpler and, thus, easier to translate into equivalent machine language commands.
What makes the C language simpler is its small number of commands or keywords. Keywords are special commands used in every programming language. The more keywords a programming language uses, the fewer commands you need to make the computer do something. The fewer keywords a programming language offers, the more commands you need to make the computer do something.
Think of keywords like words in a human language. The fewer words you know, the more limited your communication is. If a little kid only knows the word hot, they can only express themselves in a limited manner, such as describing something as “very hot,” “a little hot,” or “not so hot.” However, if the kid knows a lot of different words, they can express themselves much better. Rather than use two or more words to describe something as “very hot,” “a little hot,” or “not so hot,” a kid with a richer vocabulary could describe the same items as “scalding,” “warm,” or “cool.”
A programming language with a lot of keywords allows you to write a program with fewer commands. That’s great from the programmer’s point of view but inefficient from the computer’s point of view.
The more keywords used in a language, the more work the compiler needs to do to translate all these keywords into machine language. As a result, programs written in languages that use a lot of keywords tend to run much slower than programs written in C.
A C program compiles to smaller, more efficient machine language commands because instead of offering a large number of keywords, the C language offers just a handful of keywords. This makes it easy for a compiler to translate the limited number of keywords into machine language.
However, as a programmer, you need to use C’s limited number of keywords to create subprograms that mimic the built-in commands of other programming languages. Because this can be impractical, the C language often includes libraries of subprograms that mimic the built-in commands of other programming languages.
The bottom line is that C programs tend to run faster and more efficiently than equivalent programs written in other programming languages. So, if you need speed, efficiency, and access to the computer hardware, the C language is the most popular choice.
The portability of C
By using much fewer commands than most programming languages, the C language makes it easy to create compilers that can translate a C program into machine language. Because it’s so much easier to create C compilers than it is to create compilers for other programming languages, you can find a C compiler for nearly every computer and operating system.
Theoretically, this means it’s possible to take a C program, written on Windows, copy it to another computer and operating system, and run that program on a different operating system, like Linux or macOS, with little or no modifications. When you can copy and run a program on multiple computers and operating systems, the program and the language it’s written in are portable.
So, not only does C create small, fast, and efficient programs, but C also allows you to copy and run your program on different operating systems and computers. Given all these advantages, the C language remains popular despite its age (it was created in 1972).
Adding object-oriented programming with C++
Although the C programming language is popular, it’s not perfect. When object-oriented programming became popular for designing and maintaining large programs, computer scientists created an object-oriented version of C called C++.
Because more people are writing and organizing large programs with object-oriented programming, more programs are being written in C++. Some people study C so they can understand the peculiarities of the C language. When they feel comfortable with C, they start studying C++ and object-oriented programming.
Other people just skip C and start studying C++ right away. The theory is that as a professional programmer, you’ll probably wind up writing and modifying C++ programs anyway, so you may as well study C++ from the start. After you know C++, you pretty much know enough to teach yourself how to write and modify C programs, too.
A far less popular object-oriented version of C is Objective-C, which used to be Apple’s official programming language until Apple switched to Swift.
Gaining true portability with Java
Although C and C++ programs are supposed to be portable — you can copy and run them on other computers — they’re not really. Sometimes you have to make minor changes to get a C/C++ program to run on another computer, but more often, you have to make major changes.
That’s why Sun Microsystems created the Java programming language. Like C++, Java is also based on the C language, but it includes several features to make Java programs safer than C or C++ programs. Specifically, Java isolates the programmer from directly accessing the computer’s memory. This reduces the power of Java somewhat but translates into safer programs that (hopefully) won’t crash as often as C/C++ programs do.
Perhaps the most important feature of Java is its portability. Rather than try to compile a Java program into machine language for different types of processors, Java compiles Java programs into an intermediate file format called bytecode or pseudocode (also called p-code ).
To run a Java program that’s compiled into bytecode, you need a free Java virtual machine (VM). As long as a computer has a Java VM, it can run a Java compiled bytecode program.
Like most promises made by computer scientists, Java programs aren’t always portable. You can write a Java program correctly, compile it to bytecode format, and make the program run perfectly on a specific computer and operating system. But copy that same bytecode program to another computer, and suddenly, the Java program doesn’t run correctly. The problem can occur when the Java VM, on either computer, has errors in it. So, although Java programs are more portable than C/C++ programs, they still aren’t 100 percent portable.
Интервал:
Закладка:
Похожие книги на «Beginning Programming All-in-One For Dummies»
Представляем Вашему вниманию похожие книги на «Beginning Programming All-in-One For Dummies» списком для выбора. Мы отобрали схожую по названию и смыслу литературу в надежде предоставить читателям больше вариантов отыскать новые, интересные, ещё непрочитанные произведения.
Обсуждение, отзывы о книге «Beginning Programming All-in-One For Dummies» и просто собственные мнения читателей. Оставьте ваши комментарии, напишите, что Вы думаете о произведении, его смысле или главных героях. Укажите что конкретно понравилось, а что нет, и почему Вы так считаете.