Section 1.3 Programming Languages
Programming languages are formal languages that allow programmers to write instructions or code to communicate with computers and create software applications. They serve as a means of instructing the computer to perform specific tasks or calculations. Each programming language has its own syntax and set of rules that dictate how code is written and interpreted. In fact, learning a programming language is not dissimilar to learning a foreign language. There are rules that must be followed in order to converse in any language correctly, and this goes for programming languages as well. What is different is the interpretation. Unlike a human who interprets a foreign language, a programming language is interpreted by a computer, which is very strict about the use of proper grammar and syntax. Fortunately, the computer programs that read the programs we write will tell us when we make a mistake. This gives us the the opportunity to learn and try again.
In this book we will study the Java programming language, one of the most popular object oriented programming languages, especially for writing large software systems.
Programming languages can be classified by type, including low-level languages, high-level languages, and scripting languages. Low-level languages, such as assembly language, execute closer to machine code and provide direct control over hardware resources. High-level languages, like C++ and Java, offer more abstraction and are designed to be more user-friendly and easier for humans to create. They provide built-in features and libraries that simplify complex tasks.
Executing code written in a high-level programming language is usually (but not always) a two-step process. First a program is translated from its high-level syntax files to a low-level syntax file. Once this translation is successful, the low-level program file is executed by the computer’s hardware. You will perform this translation using a special helper program called the compiler. Depending upon the programming language, this compiled program may be run directly, or it may require other helper programs called a runtime engine and a virtual environment. Learning the toolkit that comes with a programming language is part of learning how to program in the language itself.
Scripting languages, such as JavaScript and PHP, are often used for small tasks and web development, and are compiled or interpreted at runtime rather than compiled ahead-of-time. These languages are typically used to write small programs that automate tasks or enhance web pages.
Programming languages may also be categorized based on their purpose or application domain. For example, there are languages specifically designed for web development (e.g., HTML, CSS, JavaScript), preferred for data science (e.g., R, Python), and better for mobile app development (e.g., Swift, Kotlin).
Each programming language has its strengths and weaknesses, and the choice of language depends on factors like project requirements, project size, performance needs, available libraries, and personal preference of the developer.