Modern "Hello, World", not just a few lines of code


Author | Charles R. Martin

Translator | meniscus, Zebian | yugao

Head Figure | paid download from the visual China

Exhibition | CSDN (ID: CSDNnews)

 

Write "Hello, World" program novice tradition dates back to at least 1978. However, for the modern programmer, what is the proper "Hello, World"?

 

Not long ago, a client asked me to write programs in RPG on the AS / 400. Reference Lobachevsky's words: "боже мой!" (My God!)

 

Although I do not want to expose their age, but the last time I write a program using RPG, I am afraid that most readers of this article are not yet born. To build such a program, I need to remember how to use KEDIT editors such as learning how to use the AS / 400 software development tools, build a test library, editing the actual program, and then figure out how to compile and run.

 

Although the client process is very simple, but I do not want to just start writing programs. So, I created a "Hello, World" project.

 

Meaningful tradition

 

The concept of "Hello, World" program can be traced back Brian Kernighan and Dennis M. Ritchie's book "C Programming Language" (first edition), to confirm that you have mastered the language and environment by writing a small program, is ready ready to try more complex functions. The first program written in C language most programmers like this:

 

1 #include <stdio.h>
2
3int main() {
4    printf("Hello, world!\n");
5    return 0;
6}

Code to save 'hello.c' file, and then enter the following command (on UNIX systems):

 

1$ cc hello.c
2$ ./a.out 

 

Then, you can see the output:

 

1Hello, world! 

The above code can prove that you really can be written in C language, compile and execute the program.

 

Brian Kernighan and Dennis M. Ritchie wrote in the book, the program to build the C language means that you master the C language to start a project of basic steps. 

This is the biggest difficulty. To overcome these difficulties, you have to be able to create the program text, successfully compile, load, run and outputs the result. Once you know these technical details, other operations are relatively more easy.

Okay, I admit that "other actions are relatively easy to" slightly absurd this argument, however, this is indeed an important step to learn any programming language.

 

While writing "Hello, World" program has become a traditional programming community, however, like many traditions, but many people do not realize though real purpose or value them. Thus, it was summed up in a Hello World online collection, which contains nearly 600 languages with written "Hello, World" program, from Ada to ZIM. Many IDE can write a basic "Hello, World" program, for many interpreted languages (such as Python) is, "Hello, World" simply type in the REPL interpreter in print ( "Hello, world!" ) .

 

Unfortunately, this does not provide much practical insight, and with Richard Hamming's words, the purpose of computing is insight, not literal string.

 

What is the real meaning of "Hello, World" yes?

 

Originally Brian Kernighan and Dennis M. Ritchie so that we focus on the preparation of "Hello, World" program is not output on the terminal "Hello, World". On the contrary, in order to make sure that you have all the tools needed to write a C program and C language programming environment for UNIX knowledge and have a basic understanding, but also have some knowledge of tools and methods to build a program, this is a start the most important first step in the project.

 

This step usually looks more complex than the original. Today, the actual project not only need editors and compilers, also need to know how to package the program, how to set up the environment, how to plan to maintain version control, how to actually build a program and product programming required for the project delivery. Thus, while the basic "Hello, World" program may still only five lines of code, but the original building that appears to be very easy to "Hello, World" may be much more complex.

 

Start a new project necessitates before entering the "other operations are relatively more easy" stage, to solve the many problems of development.

 

The project "Hello, World" program

 

For a project to build an appropriate "Hello, World" is actually more complicated, but the benefits are great. Consider a project to be delivered, such as a Web application. In addition to selecting the language, to select the frame usually requires the front and rear ends. In addition, you also need to determine how to host the first application, and how to manage and deliver code.

 

For a project, the appropriate "Hello, World" program just displays the output. You need to prove that you are ready to add functionality (if you add users using SCRUM was the case), then through a series of operations to push it to the demo version of the application and testing. For products, the right "Hello, World" program which is the minimum version of the minimum viable product, it shows that along with the design, you can provide useful products for testing and use.

 

What is the proper "Hello, World"?

 

Obviously, depending on the project and the environment, proper "Hello, World" program is also different. I have taught many beginners, usually I would suggest that they have performed the following work:

 

  • A separate project directory: save all the code of a "folder."

  • Initialize git repositories in this folder. Yes, even I have started using git up. While these knowledge base is very easy to learn, but I have seen many students fall into despair, because they made some minor changes, the results did not achieve the desired result, but they do not remember what changes can not be reverted to the old version .

  • Choice of development tools: editor or IDE, build tools, and so on.

  • Compared to invoke the compiler from the command line, repeatable build process more robust.

  • Then is the actual first line of code.

 

After doing the above work, but also can edit, submit, build and demonstrate a very small program, it is considered ready to build the new features, but these efforts also avoid the development process encountered some unpleasant mistake.

 

The establishment of a professional "Hello, World"

 

Although many people think "Hello, World" program is only for beginners, but in fact most of the projects are starting from an empty directory. Generally, a real project of "Hello, World" program will encounter a lot of problems, but the process is very complicated. For example, Maven is a Java program to create a very basic framework, usually need to create more than a dozen directories and subdirectories in order to build a simple "Hello, World" program in Java, and Maven build and dependency management program will also 1350 files to download more than 550 directories.

 

Moreover, not only Java or Maven will encounter this problem. Using the create-react-app React to build a new application also needs to 4304 and 28678 files directory.

 

Clearly, these tasks manually make people crazy. This complexity is forcing developers must create a "Hello, World" application level through the build script, but even these applications is still not perfect, you still need to add the source code control, continuous integration, or Configuration container or pipeline deployment script.

 

Although the work is much more complex than the original five elements "Hello, World", but the purpose remains the same: by building a simple application, to ensure that meet the requirements of the subsequent development.

 

A good start

 

Any scale software project from the outset faced with the same problem: how to start the project successfully, on behalf of building code, deploy code to make subsequent development is focused on building codes to meet actual customer demand?

 

No matter how complex the project, you can ensure a good start by building a demonstration program. Although this demo is very limited, but you can practice through this process to build, test and even deploy the entire process. This is the first proposed the original intention "Hello, World" program, and now it is still a good project to start.

 

Original link:

https://stackoverflow.blog/2020/03/05/a-modern-hello-world-program-needs-more-than-just-code/

This article is a translation of the article CSDN, please indicate the source. 

【End】

Recommended Reading 

Baidu illegal mining engineer profit 100,000, sentenced to three years; Apple antitrust case fined 1.1 billion euros; GitHub proposed acquisition of NPM | Geeks headlines

took the $ 220,000 annual salary, fared not as good as an intern?

How to create a new virus outbreak crown tracker with Jupyter Notebook?

born in a small town, the entrance flow, Fudan coaching, career in Silicon Valley, why the 59-year-old Lu Qi, so "lucky"?

How safe integration when DevOps transformation? What is the impact on the firm's output? 2019 Status Report DevOps latest interpretation of | the Force program

Bitcoin most mainstream, Ethernet fell Square, block chain technology "one size fits all" bonus has ended | block chain developers Annual Report

You look at every point, I seriously as a favorite

Released 1844 original articles · won praise 40000 + · Views 16,650,000 +

Guess you like

Origin blog.csdn.net/csdnnews/article/details/104935651