Home  >  Article  >  Backend Development  >  Five programming languages ​​every developer should learn (Part 1)

Five programming languages ​​every developer should learn (Part 1)

PHPz
PHPzforward
2023-04-10 11:41:031359browse

Five programming languages ​​every developer should learn (Part 1)

There are many general programming languages ​​​​in which programmers write code, and most programmers who use enterprise software usually only use one programming language before they retire. However, there are also programmers who have the opportunity to use multiple programming languages ​​in their daily work. For example, if a programmer uses Flatter native modules, there are opportunities to use Dart, Kotlin (or Java), Objective-C (or Swift), C/C++, etc.

Most programmers have worked in one language for decades, which limits their technical skills. We often see a lot of .NET and Java experts. But it is rare to see programmers who master multiple languages. Learning multiple programming languages ​​brings even more benefits. However, learning every popular programming language is not a wise choice.

In this story, I will show you five programming languages ​​that every programmer should learn. And use examples to illustrate the benefits of learning these programming languages.

1. C/C

C language is the basic language for almost all underlying software components. C's abstraction is closer to the hardware, and C provides the programmer with a minimal syntax (32 keywords reserved). Compared to other modern popular programming languages, C's syntax is closer to assembly language. As a result, C compilers can efficiently convert C source code into machine language and produce lightweight and extremely fast binary executables.

C is an extension of C, so you can use C features that the C language lacks (for example: classes, namespaces, etc.). Learning C/C has many benefits for any programmer. C/C prompts you to write optimized code because C/C does not provide automatic garbage collection.

C improves your problem-solving abilities and basic computer science skills because it does not provide pre-built data structures and a full-featured standard library. For example, if you need a stack in C, you have to build your own.

Similarly, learning C/C helps improve computer science knowledge and skills. The following story explains why programmers should learn C first.

Why every developer should start programming in C

You can start programming in any language - But there are many more benefits to starting with C!

Five programming languages ​​every developer should learn (Part 1)

There are about 700 programming languages ​​in the world. However, developers use approximately 20 different programming languages ​​to build enterprise software. In other words, even though there are many programming languages, there are only a few popular general-purpose programming languages. Developers typically start coding in school, college, or at the beginning of their careers.

When they start coding, every developer finds themselves asking one question: Which programming language should I learn first? If you study computer science at university, the syllabus usually starts with the C programming language.

Programming in C language is still frequently used in hardware-related software projects.

But languages ​​like Java, C#, JavaScript, Go, Python, Ruby, PHP and Kotlin dominate the modern software industry. This is because of their:

  • human-friendly syntax and semantics.
  • Full-featured standard API.
  • Community support.
  • Rich ecosystem of frameworks and libraries.

On the other hand, C is not often used by the modern community - other popular languages ​​provide a friendlier, simpler and more flexible environment than C. Yes, C is a better choice for hardware related projects but most developers are working on web and mobile related projects.

Let me explain why learning C is the best choice.

C Makes you a good problem solver

Almost all programs provide built-in or library methods to solve coding problems that require logical algorithms. For example, if you need to copy specific items into a second array, you can use the built-in filter methods in JavaScript. If you are using Java, you can use the filter method from the package java.util.stream. Literally any popular programming language has a built-in or library method to filter arrays. But if you use C, you have to implement it yourself - since there is no built-in or library filtering method in C.

When you find these scenarios, you will be faced with a problem that needs to be solved. Practicing algorithmic problems is a great way to become a good problem solver. We don't always tackle simple tasks involving only the standard libraries and built-in functionality of your favorite enterprise programming language. We often deal with tasks that involve problem-solving skills. Therefore, writing your initial code in C will make you a better problem solver.

Also, developers participating in competitive programming hackathons often use C to solve problems.

C gives you a taste of hardware

Programming languages ​​like Python, C# and Java are very user-friendly languages. However, these languages ​​are very abstract from physical hardware. In other words, you won't be able to experience the behavior of your computer hardware until you start programming in C. Modern programming languages ​​hide the entire hardware-related experience, providing a completely new sandbox environment. In most cases, this sandbox environment is created using a virtual machine.

Unfortunately, developers skip key hardware-related topics like memory management, file handling, and code optimization - because they don't start in C. Modern programming languages ​​handle memory allocation and deallocation by the garbage collector automatically. On the other hand, in the C programming language, developers manage memory by writing highly optimized code.

Writing initial code in C gives you an unforgettable hardware journey that every computer scientist should experience.

C teaches you expression and freedom

When a programming language provides very human-like abstractions, a particular programming language becomes less flexible. Every standard library method and built-in method of your favorite programming library acts as a hard-coded black box. In other words, modern programming languages ​​hide low-level code and provide developers with clean but limited interfaces. With modern programming languages, direct dynamic memory allocation is virtually impossible. At the same time, C gives you real freedom by exposing all low-level code access.

The C compiler generates extremely fast assembly code. Therefore, the C development environment itself motivates you to write high-performance code. In C, we must carefully declare variables, allocate memory, clean up memory, access resources and release resources. If you started out in C, you might not be using too much memory, unnecessary resources, and wrong data structures with your current programming language.

C inspires you to write clean code

Unlike modern programming languages, you have to write many lines of code in C. This is because C provides low-level access to everything you need - it doesn't provide you with a highly abstract standard library. When the number of lines in the code increases, the complexity of the code also increases. Therefore, we must write clean and self-explanatory code to get rid of cluttered code.

Writing clean code is a much-needed skill when we work on industry-level software projects. In fact, if we have worked on C-based projects, writing clean code is a piece of cake.

Conclusion

With the active development of the C project, C has become a subset of C. C is indeed a modern programming language with a full-featured standard library. Therefore, learning C is different from learning C. However, direct memory operation capabilities and low-level access capabilities are still available. Almost all modern programming languages ​​compete with each other by introducing new syntax, semantics, and standard library methods. However, languages ​​like Go only extend the standard library and community-driven libraries.

If developers immediately jump into a modern programming language such as Python, JavaScript, C#, or Java, they will miss out on the valuable experience that the C programming language provides. Starting with programming in C is a great way to understand how a programming language interfaces with hardware.

First choose the hard route in C language. It will help you become an expert in your favorite programming language.

*Original link: https://betterprogramming.pub/why-every-developer-should-start-programming-with-c-39b3a87392bf.

2. Bash

Bash is a command language and command line interpreter built for Unix-like operating systems. The Bash interpreter program comes preinstalled on almost all Unix-like operating systems. Additionally, many GUI terminal software often use Bash as the default command interpreter. Therefore, we can write portable Bash scripts for different Unix-like operating systems.

Programmers follow different practices to improve their daily programming efficiency. Many programmers often write their own Bash scripts for repetitive manual processes. For example, I wrote a simple Bash script to build and copy the output of a TypeScript project. Learning Bash is undoubtedly the first step towards automating the learning process. Process automation is indeed a way to increase productivity.

Bash natively supports processes. In other words, you can run another program simply by mentioning its name. Therefore, you can quickly write automation scripts to increase programming efficiency. The following story explains how to add GUI elements to a Bash script.

How to Modernize a Bash Script by Adding a GUI

A Bash script consists of a set of instructions written in the Bash command language that can be executed in a Unix shell interpreter. We use bash scripts to automate several tasks that would obviously be time consuming if we were to do them manually. But if we compare to modern computing, bash scripts are old fashioned stuff as all the interaction with the user is done through the command line interface. We know that some developers are using eye-catching logos and colors to highlight important content in the console interface. If a particular old bash script is used by a highly technical audience, that's fine. But if it's being used by a general audience, having some user-friendly interaction would obviously be a good thing.

In fact, you can include GUI (Graphical User Interface) based input/output components into your next bash script using the Zenity command line tool, which helps us show GTK dialog box. Additionally, native GUI notifications can be displayed using the notify-send command line tool. These two tools usually come with popular Linux distributions, so no pre-installation of any kind is required.

Message Box

Obviously, using a native message box to show task completion to the user is better than printing raw text in the console. Zenity makes it easy to generate error, information, problem, and warning type message boxes.

Information message box: zenity --info.

Five programming languages ​​every developer should learn (Part 1)

Warning message box: zenity --info.

Five programming languages ​​every developer should learn (Part 1)

Error message box: zenity --error.

Five programming languages ​​every developer should learn (Part 1)

Error message box: zenity --question.

Five programming languages ​​every developer should learn (Part 1)

If a set of instructions needs to be executed with the user's permission, a question type message can be used. For example, delete files from disk. This can be done by using a simple if condition or $? A special variable that stores the last return value.

Notifications

Notifications are great for displaying the status of long-running batch instructions. This is very important so that users will receive notifications even if they are doing some other work rather than looking at the console to see what is going on. Native notifications can be easily generated with the notify send command line tool.

Consider the simple example below...

Zenity also has the ability to send notifications, but notify send gives us more freedom to adjust .

Input Elements

Zenity provides good support for collecting user input by providing various input elements. It has the following types of input boxes.

Calendar input box zenity --calendar.

This is a better way to capture the date entered by the user rather than asking the user to enter the desired date in yyyy-mm-dd format from the console.

String input box zenity --calendar.

We usually use the read command to get some string input from the console. The usability of bash scripts to non-technical people can be enhanced by providing a GUI text field that also accepts common keystrokes (home/end keys, etc.) and simple copy-paste functionality.

The very similar zenity --password can be used to capture a user's secret string, such as a password or PIN. Additionally, the password input allows you to enable the username field. The username and password are then returned, separated by the | character.

File selection dialog zenity --file-selection.

The native save/open dialog box can be displayed smoothly. I'm using this feature in Neutralinojs as well.

Listing Choices

If we use normal console input to ask the user for some choices, we can implement several shortened key inputs for the user's desired choices . For example, the user is asked to enter the letter A to accept one option, on the other hand the user is asked to enter the letter B to activate another option. From the user's perspective, this approach can be slightly improved by showing a GUI-based list selection.

Let's assume you are making an installation script where you need to ask which helper plugin needs to be installed for two-factor authentication with the main software program.

Advanced Example

As mentioned above, there are several GUI input elements that can be used with bash scripts instead of using raw text all the time. Additionally, I will show you a more advanced example implemented using these native GUI elements.

*Original link: https://medium.com/swlh/how-to-modernize-your-bash-scripts-by-adding-gui-cba613a34cb7.

The above is the detailed content of Five programming languages ​​every developer should learn (Part 1). For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:51cto.com. If there is any infringement, please contact admin@php.cn delete