Beginning Programming All-in-One For Dummies. Wallace Wang
Читать онлайн книгу.closest thing to a miracle that most people will ever experience in a lifetime!
Chapter 3
Types of Programming Languages
IN THIS CHAPTER
Deciding on your first language
Understanding curly-bracket languages
Determining artificial intelligence languages
Figuring out scripting languages
Understanding database programming languages
Weighing up different programming languages
After you understand how to plan, organize, and create a program through one or more methodologies (such as structured programming, event-driven programming, object-oriented programming, or protocol-oriented programming), you’re ready to start learning a particular programming language.
Just as your native spoken language can shape the way you think and speak, so can your first computer programming language influence the way you think, design, and write a computer program.
You can choose from literally thousands of different programming languages with obscure names, like Algol 60, APL, Forth, Icon, and Scheme. Although you can understand programming by using any programming language, it’s probably best to start with one of the more popular programming languages for the operating system you want to target.
In the world of Windows, one popular language is C#, which is Microsoft’s version of Java and C++. In the world of Apple products (Mac, iPhone, iPad, Apple Watch, and Apple TV), the most popular language is Swift, which replaces Apple’s former official language of Objective-C.
If you want to write apps for Android, learn Kotlin, which has Google’s official support to replace Java. Google also has another unique language called Flutter, based on the Dart programming language, which can be used to create Android and iOS apps at the same time.
If you want to write programs that run on servers to create interactive websites, look at Java, JavaScript, or Python. If you want to get involved in low-level programming, look at C and assembly language.
Because most popular programming languages are derived from C, learning C and its object-oriented version, C++, will always provide you with a strong foundation for learning practically any other programming language in the future.
Knowing a popular programming language simply gives you more opportunities. Just as knowing Arabic, Chinese, English, or Spanish allows you to travel and speak with more people around the world (compared to knowing Eskimo, Mayan, or Swahili), so can knowing one or more popular programming languages give you more opportunities to work and write programs anywhere you go.
Sometimes there’s a good reason to know an obscure programming language. One of the oldest programming languages, COBOL, was heavily used by businesses back when computers filled entire rooms and millions of dollars. Because many COBOL programs are still running today, COBOL programmers can actually make a nice living because so few programmers know COBOL. Knowing an obscure language may limit your opportunities, but at the same time, if someone needs a programmer who knows that language, you could be the only one they could hire (and have to pay big bucks as a result).
Your First Language
So, should you start studying C as your first programming language? Yes and no. C may be the foundation for nearly all popular programming languages, but it’s not the easiest language to learn, especially for beginners. As a novice, learning C can be difficult because it forces you to learn both the fundamentals of programming and the confusing syntax of the C programming language at the same time.
As a result, many beginners get frustrated with C as their first programming language and wind up more confused than ever. Imagine how many people would want to drive a car if it meant knowing how to refine their own gasoline and build their own engine. Understanding C isn’t quite as difficult as refining gasoline or building an engine, but it can seem that way, especially when you’re programming for the first time and you start with the C language.
If you’d rather learn the fundamentals of programming without getting bogged down in the complexities of the C language, consider learning an alternative programming language first, like one of the languages in the following sections.
BASICally disrespected
One of the first programming languages designed specifically to teach beginners is BASIC (short for Beginner’s All-purpose Symbolic Instruction Code). Although BASIC is one of the oldest programming languages around, it isn’t used often in commercial applications. Currently the most popular version of BASIC is Microsoft’s Visual Basic, which made designing user interfaces (UIs) easy.
However, Visual Basic has fallen out of favor despite its initial popularity. Even worse from a financial point of view, BASIC programmers usually earn less than C programmers, even if they’re doing the exact same job. Part of the reason is that BASIC suffers from the perception that it’s a toy language — unsuitable for commercial use. Although that was true at one time, the BASIC language has evolved to the point where it can do almost anything C or other languages can do.
Microsoft created both Visual Basic and C# as nearly equivalent programming languages, so when you learn Visual Basic, you’ll find it’s easy to learn C#.
Although you can use BASIC to create anything from satellite navigation systems to Wall Street financial trading programs, BASIC programmers will probably always get paid less, so you’ll need to know another language like C anyway, just to get paid more and have more opportunities. Because BASIC programmers tend to get paid less than other programmers, many programmers feel that they may as well skip BASIC and just figure out C instead.
However, if you want a much simpler introduction to programming, learning BASIC through Visual Basic or another version of BASIC will be far easier than learning C. When you understand the principles of programming through BASIC, learning another programming language will be much easier.
Visual programming with Scratch
To encourage children to learn programming, many organizations have created programming languages designed to be easy to learn, yet powerful enough to teach people the principles of programming. One popular language designed for kids is called Scratch (https://scratch.mit.edu
).
Instead of requiring you to type text like most programming languages do, Scratch lets you design programs by connecting building blocks together like LEGO blocks, as shown in Figure 3-1. This visual way of learning programming can make programming easier to learn, more understandable, and more enjoyable because you avoid the problem of typing (and mistyping) program commands.