All You Need before Vibe Coding

AI writing the code, you should know it somehow.

Programming is a spiritual practice.

Arthur Q. Wang

(AI Assisted Preparation)



2026.5 @Daqing, China

Open Forum on Big Systems View





To someone with dreams in the AI age.

The era of individual heroism is back.

Come on, dreamer!



Author 's Introduction

Arthur Q. Wang, screen name is  Arthur Tree New Bee, and real name is Wang Quan, born in 1968, Daqing Oilfield senior programmer, the first software copyright holder in the region, professor, senior engineer.

In 1987, the code was written, starting with Fortran, and for nearly four decades it was intermittent and recently re-routed.

In 1999, the concept of "digital oil field" was put forward, and it was unremittingly and firmly implemented.

In 2016, he completed the open-source book "Big Systems View".

It's still programming, studying, and tossing AI.

Foreword

To whom is this book written?

An old man with dreams.

I saw a brother who was supposed to be older than me. 

He found a programmer and said:

You help me with a little favor. I spent a month developing a highly useful AI batch, which can benefit all of humanity. The program has been completed and is in the Doubao. But I don't know how to run it. Can you help me?

Note, he used a  word "little", and he thought it was easy.

That programmer was instantly petrified!

I laughed after looking at it. And then it was over.

A little brother who was born with no fear of tigers.

A few days later, on Sunday, 10 May 2026, at around 9 a.m., I was lying on my home couch and fiddling with my phone.

OK, I got a dream boy, he's using AI for programming.

But he doesn't know the basics of AI and IT, and it's very troubling that the process can't get through.

I had a sudden thought, I have to write a book for this boy.

I'll write it to the old man too.

Friends who want to be friends with AI.

So, this book is for:

• Ordinary friends who want to write code with AI but don't know much about the basics of computers.

• Those old programmer friends who used to write codes with AI but lost in the new era.

• Those who are caught in the middle of a false report will only ask AI's friends repeatedly.

• Friends who want to learn a computer base but do not want to read boring textbooks.

What's this book about?

Talk about things you should know before AI programming - what computers are, how programs run, how networks are connected, how data is stored, how errors are reported, how problems are investigated...

If you don't talk about it, it's basic. If the foundation is solid, the AI programming is going to turn around.

The most important thing is to help you build up programming thinking.

What is the style of the book?

Simple, humorous, white, northeast, not to be tired.

There's no formula, there's no vocabulary, just like you, but, not very strict, please note.

What's the use of this book?

After reading this book, you can have a count in your mind when you write code with AI.

The code that AI gives you can read; the error that AI reports, you can check; the formula that AI gives you can judge whether it's okay.

How did you write this book?

The book was written with the help of AI.

After I decided to write a book for the guy, I opened WeChat, said two or three hundred words, described what kind of book I wanted to write, and sent it to AI (QwenPaw + GLM5) - the book started!

The AI immediately outlined an outline.

I have some requirements for the outline.

AI wrote the first draft, about 10 minutes, about 40,000 words, Mark Down.

I got him to transfer it to Word to me.

Two minutes later, I received a Word-format document.

I've been going through this document in about 10 minutes.

I made a number of requests.

AI rewriting.

Ten minutes later, the new edition came out, and now you see this Word document.

The entire interaction between me and AI was carried out via micromail until now, I have computer-based modifications and validations of this Word file.

I read and changed every section on the computer, and I had AI help me polish, listening to the song "Heaven's Code" I let AI generate, and the "Auscultation of the People of the Earth" created by my old classmate Brother Chunyang with AI.

Does this book need to be read?

I don't think so.

Of course, if you want to look closely, no one's stopping you.

The book is an introductory literacy book, not a textbook, not a reference book, and not a fast-tracking secret.

I would like to remind you that there may be a detailed error in the book. One is that what AI generates is not guaranteed to be all right, and the other is that he is not aware of many new things, and that he is not guaranteed to correct all of AI's errors.

However, the big system talks about holographic thinking, and small local problems do not affect the overall function of the system.

I suggest you go through it first.

You can either:

• Read through and have a holistic understanding of the basics of computing

• If you encounter a concept that you don't understand, ask about bean buns

• Understanding principles while writing codes in the context of AI programming practice

• Recommending friends who also want to learn AI programming

You should not:

• Expect to become a master of programming after watching

• Use it as a textbook with no emphasis on the test

• Expect to learn specific programming skills, those who have to practice on their own, this is just a prelude

One more word.

This book, it's an old programmer's crush.

I didn't write that much, but it was all something I thought was important.

I'm a little white, because I don't think that technology should be understood only by experts.

I write a little northeast, because I'm from the northeast, and it's more natural.

If this book helps you take a little less turns, it'll make you feel better when you write the code with AI, it's worth it.

Come on, let's go.

Chapter 1: The thing about computer hardware and software

Opening remarks

Before we start talking about AI programming, we need to figure out one of the most basic questions: what is this computer thing?

The word computer has a wider meaning than a computer, which generally refers to a desktop computer for personal use. In addition to computers, computers include other types of computers, such as mainframe computers, servers, mobile phones, and even quantum computers, among many others.

You use computers every day, cell phones, but do you know how it works? Do you know why it counts, plays video, plays games?

In this chapter, we will nag the basic principles of computers in vernacular. Instead of all those complicated circuit diagrams and formulas, talk about what you can understand.

You understand the basics of the computer so you can understand what the program is about and what the AI code is giving you.

1.1 What can and cannot be done by a computer?

1. Computers are not gods.

Let's start with the big truth: a computer is not a fairy, it's a tool.

A lot of people think computers are smart and can do a lot of things. In fact, the computer is not smart at all, it can only do one thing: arithmetic.

Add, subtract, multiply, divide, 0 and 1. that's all.

But it counts so fast that you don't feel it.

For example:

Look at the video. What's the computer doing? It's counting. Decode the data in the video files into images and sound.

You play games, what is the computer doing? Counting. How the calculation screen is displayed, how the characters move, and how the collision is handled.

You're online, what's the computer doing? Still counting. How the data is transmitted, how the web pages are rendered.

You write the code with AI, what's the computer doing? Or is it counting. The text you enter, the parameters of the model, the code of the output.

So computers are essentially "fast iron boxes."

2. What can computers do?

What a computer can do, it can be converted into a calculation, it can be counted as doing:

Storage Information

Save the data as 0s and 1s. Your archived documents, photos, and videos are all 0s and 1s in the eyes of your computer.

Processing of data

Various calculations are made of the data. Add-and-decreases, comparison sizes, and logical judgements are all calculations.

<g id="11741">Show image</g>

Turns the data into an image output to the screen. The colour of each pixel point is calculated.

Play sound

Turn data into sound output to the speaker. The volume and frequency of each moment are calculated.

Network communication

Sending data through the network to others. How you pack, how you transmit, how you verify, is a calculation.

These things, they're all counts.

3. What can't computers do?

Things that computers can't do are things that can't be converted into calculations.

Before there was no large language model, computers could not do the following things, but now it is a bit difficult to say, if general artificial intelligence is realized, the following can be done. For now, I still think it can't be done.

Can't create

Computers don't "invent" things, they can only process data according to the rules you give them.

You give it a bunch of data that can help you analyse, summarize, predict, but it doesn't create new things in the air.

Has anyone said that AI can write? Can he write articles, can he draw pictures, can he code?

Yeah, but AI's also basically counting. It looks at a lot of data, learns the pattern, and then creates new things. It doesn't know it's working, it's just doing algorithms.

I don't understand.

The computer doesn't know what meaning is, it's just processing symbols.

You ask it to translate "I love you", and it translates these three words into "I love you". But it doesn't know what "love" means, doesn't know the emotion behind this sentence, and is just doing symbol replacement.

Unable to judge

Computers don't feel good or bad or wrong, they just do it on terms.

You give it a judgment that returns to True or False, but it doesn't know what that judgement means, but it's just carrying out the logical calculations.

4. Artificial intelligence is also computing

Artificial intelligence is not possible without modern computer technology, as it is also based on computation.

From the simplest judgemental AI, which began several decades ago, to the one based on a large-language model now, calculations are the basis for it.

To summarize

• Computer is not a fairy, it's a fast-counting tool

• Computers can do things that can be converted into calculations

• What computers can't do is things that can't be converted into calculations

• Use a computer, understand it, use it

• Artificial intelligence is based on calculation

1.2 CPU, memory, hard drive, GPU - What do they do?

The four big pieces of a computer:

Open a computer with a lot of parts. But the core is basically four: CPU, memory, hard drive, GPU (if you can not.

The four brothers had their own division of labor, and with the cooperation of work, the computer could run.

Let's one-on-one.

1. CPU: Brain

CPU, it's called the Central Processor, and you can interpret it as a computer brain.

What's CPU doing?

It is responsible for executing instructions, performing calculations, and controlling the work of other parts.

You open a software, CPU reads the instructions, and you do one. You click a button, CPU handles your click, and you tell the screen what to show.

CPU characteristics:

You can do anything, but you can't do much at once.

Like a person, you can take any job, but you can only do one thing at a time. You want it to do ten things at once? It has to come piece by piece, or switch to switch.

How's CPU? Look at some of the indicators:

Number of cores: a few brains. Two cores are two brains, four cores are four brains, and eight cores are eight brains. With more brains, you can do more work at the same time.

Main frequency: How fast does the brain turn? 30 GHz is three billion times a second. Fast is fast, fast is fast.

Cache: A small book next to the brain. Remembering the most recent data, you don't have to go to the warehouse every time. Cache is good, efficient.

For example:

Suppose you want to count 1000 mathematical problems.

The single nuclear CPU is like a person, counting together. The eight nuclear CPU is like eight people, counting 125 each, counting at the same time.

Which one is fast? Of course eight are fast at the same time.

But not all missions can be broken down into eight. Some have a sequence, and they have to come together, and at that point the eight is not much faster than the single.

2. Memory: workstation

Memory, all called "random access memory," you can interpret it as a computer workstation.

What's the memory for?

It temporarily keeps the data and procedures in use.

You open a piece of software, and the software's code and data are loaded into memory. The CPU reads the data from memory, processes it, and writes the result back to memory.

Features of memory:

Fast, but not durable.

How close are we?

The CPU reads the data from memory, blinks; it reads the data from the hard disk, half a day (on the time scale of the computer).

What do you mean, it's not going to last?

When the power is off, it's gone. Did the document you were writing lose power without saving it? All the data in the memory was gone and could not be retrieved.

Memory is good, depending on capacity:

Capacity: how big the workbench is, measured in bytes.

8 GB is 8 guib, 16 guib, 32 guib.

G is the 9th power of 10, that is, 1 billion; B is a byte, which can be simply understood as a letter and a Chinese character.

The workstations are big, there are more programs that can be put on simultaneously, and many software can't be built.

Have you ever been in a situation where:

We've got a lot of web pages and software, computers slow down, even hinting at "insufficiencies"?

That is, the workbench is full, and the CPU has no place to put new things. At this time, the operating system will move some temporarily unused data to the hard disk (this is called "virtual memory"), freeing up workbench space. But the hard drive is much slower than the memory, so the computer becomes a card.

3. Hard drive: warehouse

Hard drive, you can interpret it as a computer warehouse.

What does a hard drive do?

It permanently stores data and programs.

The movies you download, the photos you save, and the software you install are all on your hard drive. If you turn it off, you won't lose it.

Features of the hard drive:

Last but slow.

What does durability mean?

After the power was cut off, the data was still there, and it would be fine for a few years. The documents you archived in 2010 can still be opened now, which is the credit of the hard drive.

How slow are you?

That's why computers, when working, move the usual data from hard disks to memory, so that CPUs can read it from memory instead of from hard disks every time. That's how it works.

The hard drive is divided into two categories:

Mechanical Hard Disk (HDD)

There's a rolling disk, like an old recorder. When you read and write data, the head moves on the disk.

Advantages: Cheap, large capacity. Hundreds of dollars can buy several TBs.

Shortcomings: Slow, noise, fear of vibration.

Like an old warehouse, things are too slow to pick up.

Solid-state Drive (SSD)

There are no spinning components, and data are stored with chips, like the UCD magnification version.

Advantages: fast, silent, earthquake-resistant.

Shortcomings: are expensive and relatively small (but are now growing).

Like a new warehouse, pick up fast but rent high.

Now the new computers are mostly SSDs, much faster. Turns on from a few minutes to a few seconds, and turns on the software.

4 GPU: He was a great painter and now he's an artificial intelligence Hercules.

GPU, full name "the graphic processor."

What's GPU doing?

It specializes in image and video processing.

You play games, watch videos, model 3Ds, and you're working with GPU. CPU gives the image data to GPU, and the GPU calculates the colour of each pixel point and then exports it to the screen.

Features of the GPU:

He's good at doing a lot of simple work at the same time.

A CPU is a brain that does one thing at a time (or switches between doing many things). GPUs are thousands of "small brains", each of which is weak but capable of working simultaneously.

For example:

You have to count 1 million simple additions.

CPU approach: a brain, counting together. A million roads, though fast, will be counted for a while.

GPU approach: 1000 small brains, 1000 per person, calculate together, and get it done in an instant.

That's the GPU advantage: parallel calculations.

So, GPU's not just playing games, drawing pictures, but running the AI model now depends on it. The AI model requires a lot of simple calculations (mixture multipliers), and the GPU is good at this.

Is it ok without a GPU?

Yes, but many things can't be done or are slow.

Play a game? No GPU, it's a PPT.

Run an AI? No GPU, not a day later.

What's so bad about GPU?

Visible: equals the GPU's own workstation. Large enough to handle larger images, larger models.

Number of cores: number of small brains. More cores, faster calculations.

5. How do the four cooperate with each other?

Let's say:

Like a factory:

• Hard drive is a raw material warehouse with a large quantity of goods but slow delivery

• Memory is a workstation, which is quick to pick up, but cannot leave much behind

• The CPU is the chief engineer, who knows everything but can't do much at once

• GPUs are a bunch of pipeline workers that work a little bit per person and add up quickly

One concrete example:

You play the original God with your computer:

1. Game programs and resources (map, person, voice, etc.) are in hard disks

2. You double-click to open the game and the game is loaded to memory

3. CPU deals with game logic (movement, attack, collision, etc.)

4. GPU is responsible for rendering the image (counting each frame image)

5. You quit the game and the progress is saved on the hard drive.

If anything goes wrong, the game will be affected:

• Slow drive? Long load time

• Small memory? Can't open high quality.

• CPU is weak? It's a time card.

• GPU is bad? It's bad.

To summarize

• CPU: Brain, responsible for the execution of instructions and calculations, can do anything but not much at a time

• Memory: workbench, temporary data, fast but no power

• Hard disk: warehouse, permanent data storage, long-lasting but slow

• GPU: Painting master, calculating Hercules, good at doing a lot of simple work at the same time, image and AI rely on it

1.3 Operating systems: large butlers of computers

What's the operating system for?

You turn on your computer and see the Windows, macOS, or Linux interface. This is the operating system.

The operating system is the big butler of computers, which manages all the resources of computers and allows the various software to function properly.

Without an operating system, your computer is a bunch of parts, nothing to do. With an operating system, you can install software, open files, surf online.

Let's say:

Computer hardware is like a building with rooms, utilities, elevators. But without the property, the building was a mess, and no one knew how to use it.

The operating system is the real estate, which manages all aspects of the building:

Allocation of rooms (RAM)

Management of utilities (hardware management)

Maintaining order (process management)

Provision of services (system call)

2. What's in the operating system?

The operating system is mainly concerned with these matters:

Manage Hardware

CPU, memory, hard disk, GPU, these hardware resources are uniformly allocated by the operating system. Which program uses how much memory and how much CPU time is determined by the operating system.

So, for example, the operating system is like a dispatcher and arranges for the use of hardware resources for each program.

Manage Files

Your files are on your hard drive, and the operating system is responsible for organizing the files, creating directories, and managing permissions. You can see folders, copy and paste files, all thanks to the operating system.

So, for example, the operating system is like a librarian, which helps you sort out and locate files.

Management process

You open several software at the same time, and each software is a "process". The operating system decides which process runs first, which runs later, and which pauses.

The operating system is like a traffic cop, directing the processes to run in an orderly fashion.

Provide interface

The operating system provides a unified interface to the software, so that the software does not need to care about hardware details. Software developers only need to invoke the functions of the operating system, and do not need to control the CPU and memory themselves.

So, for example, the operating system is like a translation, the software says, "I want to store documents," and the operating system translates into hardware-reading instructions.

3. Common operating systems

Windows

Microsoft's, the most used worldwide.

ADVANTAGES:

• Friendly interface, easy to get started

• Software is rich, everything.

• Game support is good, most of the works are in Windows.

Disadvantages:

• Vulnerability to poisoning and safety

• The system is swollen, and it slows down when it is used for a long time

macOS

Apple home is only used on Mac computers.

ADVANTAGES:

• Beautiful interface with a strong sense of design

• The system is stable and not prone to crashes

• Preferred design and video work, good software optimization

Disadvantages:

• No Windows available

• Poor game support, many of the works without a Mac version

• Computers are expensive and low-priced

Linux

The open-source free system has many distributions (Ubuntu, Centos, Debian, etc.).

ADVANTAGES:

• Safe and stable, not easily toxic

• It's free and you don't have to pay for it

• Programmers like it, develop it well

Disadvantages:

• Difficult to get started and need to learn

• Few desktop software and less easy to use on a day-to-day basis

Android

Googlers, on the cell phone and the tablet. On Linux, open source, cell phone manufacturers can use it.

The global mobile phone market has the highest share.

iOS

Apple Home, on iPhones and iPads. A closed system that can only be used on Apple devices.

ADVANTAGES:

• Fluid, secure and high quality software

Disadvantages:

• I'm not flexible enough to listen to apples.

4. Which operating system?

Look what you're doing:

UseRecommended systemReason
Programming, day-to-day work, playing gamesWindowsThere's a lot of software, a lot of games.
Programming, design, audio-visual productionmacOSThe software is perfect. Show it.
Programming, Servers, Learning TechnologiesLinuxIt's a good development environment. It's free.
Daily use of mobile phoneAndroid or iOSI'll see what I like.

Linux is absolutely mainstream in the server field. If you want to learn programming, you will have to contact Linux sooner or later.

Virtual and dual systems:

If you want to play games with Windows again, and you want to learn Linux, you can have virtual machines or dual systems.

Virtual machine: Installation of a Linux virtual machine in Windows and running of two systems simultaneously.

Dual systems: Two systems are installed in the computer, which one is candidate at startup.

To summarize

• The operating system is the major butler of computers, managing hardware, documents, processes

• Common operating systems: Windows, Marcos, Linux, Android, iOS

• Different operating systems are suitable for different purposes, depending on what you choose

1.4 What's with the software?

1. What's software?

Hardware is visible and tangible, software is invisible and tangible.

Software is a bunch of codes and data that bring together instructions for hardware to work.

Without software, computers are a bunch of scraps. With software, computers do a lot of things.

Let's say:

Hardware is the human body, and software is the human mind and skill.

Without ideas, the body is a walking corpse. With ideas, people can do everything.

2. What are the software components?

System software

The operating system is the system software, which manages the entire computer.

There are also drivers that allow the operating system to control the hardware. For example, graphics driver, audio driver, printer driver.

Application

Your daily software: micro-mail, browser, player, office software, the various systems you use in your office, these are applications.

The application runs on the operating system, which manages the hardware.

Develop Tools

Software for writing codes: VS Code, PyCharm, Git ... These are development tools.

The development of tools is also an application that is specifically intended for developers.

3. How did the software come about?

The software is written by people.

The programmer writes the code in the programming language, and the code is compiled or interpreted to become a computer-enforceable command and becomes software.

One software, probably only hundreds of lines of code, or millions of lines of code. Windows, for example, is said to have tens of millions of lines of code.

For example:

You used a micro-mail:

• Frontend (Cell phone App): Could be millions of lines of code

• Backend (server): potentially tens of millions of lines of code

• Banks and frameworks: millions of lines again

• Together, it could be a billion lines of code.

Of course, most of the codes are not from zero, but are assembled using other people's written libraries and frames.

4. Operation of the software

To run the software, you have to go through these steps, taking WeChat as an example:

1. Installation: you download the micro-mail installation package, double-click the installation, and the micro-mail files are copied to the hard disk.

2. Load: Click the micro-mail icon and the operating system loads the micro-mail programs into the memory.

3. Implementation: CPU has started to implement the code for micro-mails, displaying the login interface.

4. Interaction: you scan the login, wee-mail the chat interface, you talk to friends.

5. Closure: You click off, micro-mail exits, data from the memory is released.

5. Why isn't there software in it?

Have you ever experienced such a situation: downloading a software, prompting "incompatibility" or "lack of dependency"?

This is usually because:

Incompatibility of operating systems

Windows does not fit Mac and 32-bit software does not run 64-bit systems.

It's like you bought a German electrical device, but you found the plug was a European standard, and you couldn't get it on the Chinese plug.

Lack of operating environment

Some software requires specific operating libraries such as .NET Framewerk, Java Runtime, Visual C++ Runtime.

It's like if you buy a toy that needs batteries, but it doesn't come with batteries, you have to buy it yourself.

The wrong version.

The software version does not match the system version. For example, a software supports Windows 10 and above, and you use Windows 7.

Hardware Not Satisfied

The software requires 8GB memory, you have only 4GB. The software requires uniqueness, and your computer is a collection.

To summarize

• Software is a bunch of codes and data that command hardware.

• Software subsystem software, applications, development tools

• Software is written by people in programming languages

• Software not installed, possibly incompatible with the system, lack of environment, incorrect versions, non-satisfactory hardware

1.5 How do computers communicate with people: input and output?

1. how do people talk to computers?

You want the computer officer, you have to talk to him. But the computer doesn't understand people, what should I do?

Entering the device is a tool for you to talk to the computer.

Common input device:

• Keyboard: input text, command

• Mouse: click, select, drag

• Touch screen: direct by hand

Microphone: input sound (voice input)

• Cameras: enter images (video calls, face recognition)

• Scanner: input paper documents

2. How does a computer talk to people?

When the computer's done, I'll tell you what it says. What does it tell you?

Output devices are the tools your computer uses to talk to you.

Common output devices:

• Monitors: display images, text

• Speakers: play sound

• Printers: printing documents

• Projector: projection

• Cell phones

• Helmet

3. Standard input output

In programming, there's a concept called "standard input output."

Standard input: Default is the keyboard

Standard Output: Display by default

Standard error output: Also a monitor, but dedicated to output error information

For example:

You write a Python program:

name = input("请输入你的名字:") # 标准输入 print("你好," + name) # 标准输出

Run when:

Please enter your name: Zhang San, you enter it from the keyboard

Hello, Zhang San.

4. Terminals and control stations

Standard input output is the " data stream " that the program communicates with the outside world. A specific window is needed to carry these interactions. This window is the terminal or the control table.

Terminals: Usually refers to a software program (e.g. macos' "end" application, Windows' command prompts or Windows Terminal), which is the interface where you enter the command and see text output. It is the front end where you interact directly with Shell (command interpreter, e.g. Bash, PowerShell).

Console: In routine programming, often mixes with the Terminal, but focuses more on the display area of the program output. For example, you run the code in IDE, and the results are shown in the Run Console.

5. Redirection

Sometimes you want to change the input output. It's called "redirection."

Output redirection:

Saves what was originally to be displayed on the screen in the file.

python hello.py > output.txt

The contents that were to be displayed on the screen are now stored in an output.txt file.

Input redirect:

Do not read the input from the keyboard. Read from the file.

python hello.py < input.txt

What would have been entered from the keyboard is now read from the input.txt file.

To summarize

• The input device lets people talk to the computer: keyboard, mouse, touch screen, etc.

• Output equipment to allow computers to speak to people: monitors, speakers, printers, etc.

• Standard input default is the keyboard and standard output default is the monitor

• Redirection can change the origin and destination of the input output

Summary of this chapter

In this chapter, we nag the basic concepts of computers:

The computer is not an immortal, it is a fast tool. Anything that can be done can be transformed into something that can be calculated.

The four major parts of the computer:

WidgetsSimileRoleCharacteristics
CPUBrain.Execute command, calculate.I can do anything, I can't do much at once
MemoryWorkstationTemporary dataCome on, but the power's gone.
Hard DiskWarehousePersistent dataLast but slow.
GPUPainting master, AI calculates.Process images, large-scale calculationsHe's good at parallel calculations.

The operating system is a big housekeeper that manages hardware, documents, processes and allows the software to function properly.

Software is a collection of code, written by people, commanding hardware to work.

Enter the output device to allow people to communicate with computers.

Get this straight, and you'll have a basic understanding of computers.

And then, how did we get into this?

Chapter 2: The matter of the compilation process

Opening remarks

The last chapter we talked about what a computer is, what is this piece of chatter about?

You wrote the code with AI, and then what?

How did the code become a running program? That's the chapter.

Find out how the program runs, so that you can understand what the AI is doing to your code, and know which direction to troubleshoot when you encounter problems.

2.1 Programming languages are a big family

1. what's programming language?

Computers only know zero and one, but you can't write zero and one each time to communicate with it. It's too tired.

So, humans invented programming languages. Programming languages are translation between humans and computers.

You write the code in the programming language, the code is translated into 0 and 1 that the computer can understand, and the computer can execute your instructions.

Let's say:

You talk to foreigners, you speak Chinese, he speaks English, he doesn't understand each other. What do you say? Find an interpreter.

The programming language is the translation, you write the code in the programming language, and the translation turns it into zero and one computer-readable.

2. Evolution of programming languages

The development of programming languages has undergone three generations:

First generation: machine language

At the earliest, the programmer wrote 0 and 1. For example:

10110000 01100001

What does that mean? Only computers know that people look like the Book.

Think about how many zeros and 1s a simple program would have to be written? It's easy to be wrong. One number is wrong, the whole program is wrong.

Second generation: compilation language

Later, some invented the compilation language, replacing 0 and 1 with simple symbols. For example:

MOV AL, 61h

It's better than 0 and 1 -- move 61h into the AL register. But it's still hard to understand, and the CPU compilation language is different.

The compilation you wrote on the CPU in Intel, it might not run on the CPU in ARM.

3rd Generation: Advanced Languages

And then, the higher languages came up. For example:

age = 25

This is much easier to understand — to give 25 values to variables.

Advanced languages make programming simple, so that ordinary people learn. You don't have to worry about the bottom details of CPU's register, memory addresses, and write code like English.

What's the advantage of advanced language?

It's easy to read. It's easy to understand.

Close to natural language, easy to understand.

If you look at the Python code, you can basically guess what it does:

if age >= 18: print("成年人") else: print("未成年")

You don't need a computer to understand what this code means.

Good portability

The same code can run on different computers.

You can run on Windows, on Mac, and on Linux. You don't need to write different codes for each operating system.

Be businesslike.

The programmer writes the code faster and doesn't have to worry about the bottom detail.

You used to write a feature in a compilation language, probably hundreds of lines. Now, in advanced languages, a few lines are done.

4. Common high-level languages

There are now hundreds of programming languages, and dozens are commonly used. The following are the most common:

LanguagesUseCharacteristicsDifficulty
PythonData analysis, AI, Web, scriptsEasy to learn, rich library★☆☆☆☆
JavaScript (JS)Web Frontend, Node.js BackendBrowser native support, everywhere.★★☆☆☆
JavaEnterprise applications, Android developmentCross-platform, stable, ecological★★★☆☆
C/C++System Development, Game, EmbeddedHigh performance, but hard to learn.★★★★★
GoShizuhara, micro-services.Simple and efficient. Google.★★☆☆☆
RustSystem developmentSafe and high performance, but steep learning curves★★★★☆
C#Windows Development, GameMicrosoft. Windows is eco-friendly.★★☆☆☆
SwiftiOS/macos developmentApple products, development of apple applications.★★☆☆☆
KotlinAndroid DevelopmentGoogle recommended Android to develop languages★★☆☆☆
PHPWeb BackendSimple, but a little outdated★★☆☆☆
RubyWeb BackendElegance, but less use.★★☆☆☆
TypeScriptWeb FrontendJavaScript's superset, plus type.★★★☆☆

5. How do you choose a language?

Many beginners ask: I want to learn programming, which language?

There is no standard answer to this question, because different languages are suitable for different tasks.

Select by purpose:

UseSuggested languages
Data analytics, AI, machine learningPython
Web FrontendJavaScript
Web BackendPython、Java、Go、Node.js(JavaScript)
Enterprise applicationsJava
Phone AppKotlin、Java
Cell phone App (iOS)Swift
Cross Platform AppFlutter(Dart)、React Native(JavaScript)
Game DevelopmentC++ (large game), C# (Unity)
System Development, EmbeddingC、Rust
Shizuhara, micro-services.Go

Select by difficulty:

The easiest way to go: Python

The Python grammatical approach is closest to the natural language and the new handyman is not painful. The code reads like English.

Medium difficulty: JavaScript, Java, Go

Syntax is a bit more complex than Python, but it's not that hard. The asynchronous concept of JavaScript needs to be understood. The object-oriented concept of Java needs to be studied.

Harder: C, C++, Rust

Need to manage memory, understand pointers, prone to errors. Learning these languages takes patience.

My Proposals

If you're a pro, you want to get in quick, start with Python or JavaScript.

After Python or JavaScript, the basic concepts of programming (variancies, functions, loops, etc.) are understood and it is easier to learn other languages.

If you have a clear goal (e.g., to get a front end), you just have to learn the language in that field.

If you want to be a website, you start with HTML and JavaScript. Many programmers do not view HTML as a programming language because it is a web page. It is also a language to analyse, called "hypertext tag language."

To summarize

• Programming language is translation between humans and computers

• From machine languages to assembly languages to high-level languages, it's getting easier to understand

• High-level languages are easy to read, transplant and efficient

• Common languages: Python, JavaScript, Java, C/C++, Go, Rust, etc.

• Newcomers recommend starting with Python

2.2 How does the code become operational?

1. can you run when you're done with the code?

You wrote a code, and then what? Can you run with a two-click?

Not necessarily. It depends on what language and how you use it.

2. Compiled language

Some languages need to be compiled first to translate the code into a file that the computer can execute directly.

For example:

Preparation process in C languages:

You finish the code, compile it with a compiler, generate a.exe files (Windows) or an executable (Linux/Mac). Double-click this file to run.

Characteristics of compiled languages:

ADVANTAGES:

• Speed of operation (codes that have been implemented directly by computers)

No running-time environment required (can run directly)

Disadvantages:

• Recompiling every code change

• Different operating systems need to be redacted

Common compiled languages: C, C + +, Go, Rust

3. Interpretive language

Some languages do not need to be compiled, and are interpreted and executed line by line when running.

For example:

Python Implementation Process:

You finish the code, you run it directly with the Python interpreter, you don't need to compile it first.

Characteristics of interpreted language:

ADVANTAGES:

• No compilation is required and no code changes are required to run directly

Cross-platform convenience (as long as there is an interpreter)

Disadvantages:

• Slower speed of operation than compilation (executed with translation)

Common interpretive languages: Python, JavaScript, Ruby, PHP

4. Centrist: Java

Java is a bit special. It compiles to "bytecode" and is then interpreted and executed by the Java Virtual Machine (JVM).

This combines the advantages of a compiled language (cross-platform) with the flexibility of an interpreted language.

Java's features:

• Write once and run everywhere (as long as there is a JVM)

• Faster than pure interpreted languages and slower than purely compiled languages

• The JVM will do optimization (JIT compilation) and the hotspot code will be compiled into machine code

5. How does your AI code work?

The code you write in AI works depending on the language:

LanguagesOperation ModeWhat do you need to do?
PythonExplanatory ExecutionInstallation of Python interpreter
JavaScriptBrowser or Node.js executableYou can have a browser, or node.js.
JavaJVM executionInstall Java (JDK)
C/C++Compile and execute firstInstall compiler (gcc/g++)
GoCompile and execute firstInstall Go

So, before you write the code with AI, you have to figure out: What does this code need to do?

AI gives you a Python code, you have a Python environment, you have a JavaScript code, you have a browser or Node.js, you have a C++ code, you have a compiler.

To summarize

• Codes cannot function directly and need to be translated into computer-readable instructions

• Translation into executables in compiled languages, running fast but requiring re-recording at each time

• Explanatory language line-by-line interpretation implemented, easy but slow to operate

• Java is a middle class, translated into byte codes and then executed by JVM

• Different languages require different operating environments

2.3 Variables, conditions, loops, functions - programming is actually a few things

1. Core concepts of programming

No matter what language, programming has a few core concepts. If you understand this, programming is halfway through the door.

These concepts are:

Variabile

Data Type

• Conditions

• Cycle

• Functions

Let's one-on-one.

2. Variables: naming data

A variable is a "container" for storing data. You give this container a name, and later you will find the data with that name.

For example:

name = "张三" age = 25 height = 1.75 is_student = True

Here, the names, the names, the pages, the pages, the names, the names, the names, the names, the names, the names, the names, the names, the names, the names, the names, the names, the names, the names, the names, the names, the names, the names, the names, the names, the names, the names, the names, the names, are all variable names.

You can imagine the variables as a box with tags on it and data in it.

The name of the variable:

• To be meaningful, use less of `a', `b', `c' and more of `userName', `toralPrice'

• Different languages have different naming conventions, but most do not allow spaces and special symbols

• Don't use language keywords (such as` if `,` for `,` while `) as variable names

• It is suggested that the English language should not be used in Chinese (although some languages support it).

Named style:

The style is recommendation, not rule, and has no effect on computer implementation.

You can have your style.

I can have my style,

The color has no style, it's a style.

StyleExamplesCommonly used in
Small HumpuserNameJavaScript、Java
Hull Peak.UserNameClass Name
Underlineuser_namePython

3. Data type: what type of data are available

variable stored data with different types:

TypeDescriptionExamples
IntegerInteger25, -10, 0
Floats(Decimal1.75, 3.14
StringText"Shang San", "Hello"
Boolean valueReally?True, False
ListMultiple Data[1. 2, 3]
Dictionarykey-value pair{name}: "Shang San"

Different kinds of data, different things to do:

[Integer multiplied]

a = 10 b = 3 print(a + b) # 13 print(a / b) # 3.333...

NOTATION:

# It's a note that you're doing in the program, and the computer ignores it, so the note is not involved in the program.

Different languages use different symbols for comments. For example:

Python uses #;

JavaScript uses/or/**/;

C, Java, Go, and many other languages are//or/* */.

[ Strings can be combined]

s1 = "你好" s2 = "世界" print(s1 + s2) # "你好世界"

However, the integer and string cannot normally be directly added (some may, but also to avoid their use as much as possible).

print("年龄:" + 25) # 报错! print("年龄:" + str(25)) # 正确,先把25转成字符串

[Dynamic and static types]

Dynamic type: The variable type can change. Python, JavaScript are dynamic types.

x = 10 # x是整数 x = "hello" # x变成字符串,没问题

Static type: The variable type cannot change. Java, C++ is the static type.

int x = 10; // x是整数 x = "hello"; // 报错!不能把字符串赋给整数变量

4. Condition: Make the procedure judgmental

Conditional statements allow the program to judge and perform different codes depending on the circumstances.

For example:

[Determination of adulthood]

age = 18 if age >= 18: print("成年人") else: print("未成年")

The program will determine age > = 18 this condition:

• In the case of True, execute `print' ("adult")

• In the case of False, execute `print'

More complex conditions:

[Judge whether it passes]

score = 85 if score >= 90: #如果… print("优秀") elif score >= 80: #否则,如果… print("良好") elif score >= 60: print("及格") else: #否则… print("不及格")

Conditional statements are the basis of the program "intelligent," without which the program can only be executed in a silly sequence.

Conditions for grouping:

The conditions of the combination allow for more fine judgement, and often connects to multiple judgements.

For example, to determine if a person can take a driver's license:

"Designate whether or not to take a driver's license."

if age >= 18 and has_id_card and not is_blind: print("可以报名考试")

The branch must also meet the age requirement, have an identity card and be a non-blind person before entering the branch.

If used, any condition can be satisfied;

Not used to reverse, to make the original condition fake.

This allows for flexible decision-making based on multi-dimensional information, with the same layers of screening as the actual rules.

A combination of conditional writings is the first step in writing a “smart” code.

5. Cycle: allow the program to repeat the work

A circular statement allows the program to repeat a code.

Common loops include fore and while cycles.

For loops: several times known to be looped

1 to 5.

for i in range(1. 6): print(i)

Output:

1

2

3

4

5

When you don't know how many times you're going to do it, you're going to have to do it again.

A guess-the-number game, aka Bulls and Cows

import random target = random.randint(1. 100) guess = 0 while guess != target: guess = int(input("猜一个数字(1-100):")) if guess < target: print("太小了") elif guess > target: print("太大了") print("恭喜你猜对了!")

The loop is the basis for a lot of process data. Without a loop, you have to write 1.000 lines of code if you want to print 1.000 numbers.

Cycle control:

• `break ' : jumping out of the loop

• `continue ' : skip this and continue next time

Find the first number that can be divided by seven and stop.

for i in range(1. 100): if i % 7 == 0: print(i) break

[Print odd numbers of 1-10]

for i in range(1. 11): if i % 2 == 0: continue # 跳过偶数 print(i)

Function: Packing a function

The function is to wrap up a code, name it, and then use it to call it a name.

For example:

[Definition of a function, calculates the sum of two digits]

def add(a, b): return a + b

[Use this function]

result = add(3, 5) print(result) # 8

Here, add is a function that takes two arguments a and b and returns their sum.

Benefits of the function:

Multiplexing: Write it down and use it everywhere.

You write a calculator with four functions added, subtracted, multiplied, divided. You need to calculate anywhere from now on, just call them directly, without repeating them.

Clear: Break down complex functions into small functions, the code is better understood.

A program has 1.000 lines of code, and if it's all written together, you're dizzy. But if you break it down into 10 functions, 100 lines per function, it's much easier to understand.

Maintenance: Change one place and all calls will take effect.

You find a bug in the addition function. After fixing it, all the places where the addition is called are automatically fixed.

Part of the function:

Includes functions to declare keywords, function names, form references, functions, return values.

Take Python, for example:

def add(a, b): res = a + b return res

Part by part:

1. Keywords for defining functions

dev, the exclusive key for the Python function must start with the def.

2. Function name

Add, which calls the function and the name follows the variable rules.

3. List of parameters

(a, b) A, b, in parentheses, to receive data from outside, without parameters.

4. Functional set

Indent the code inside, res = a + b, to implement the specific functional logic.

5. Return value

Return reres to pass the results out and you can never return.

6. Call presentations

c = add(3, 5) print(c) # 输出 8

To summarize

Five core concepts for programming:

ConceptWhat is it?How to use
VariablesContainer for storing data`name = "Shang San"
Data typeType of dataInteger, String, List, etc.
conditionsLet the program judge.`if...else...`
CycleMake the program repeat`for...`、`while...`
FunctionsPack a code.`def add(a, b): return a + b`

You understand these five concepts, and the basis for programming is.

The code you write with AI is basically a combination of these concepts.

2.4 How is the procedure organized?

1. Code file

The code you write is usually found in files. Different languages, different suffix names:

LanguagesDocument suffix
Python.py
JavaScript.js
Java.java
C.c
C++.cpp
HTML.html
CSS.css

A document can have a program or a module (a set of related functions).

2. Modules and packages

When the program becomes larger and a document cannot be released, multiple documents need to be broken.

A module is a file that contains a set of related functions.

A package is a folder where multiple modules are put together.

For example:

my_project/

~ Main.py# master program

D--utils.py#tool module

D--models.py # Data Model Module

In main.py, you can import other modules:

import utils from models import User from config import DATABASE_URL

Use imported content

result = utils.calculate(1. 2) user = User("张三")

3. Libraries and frameworks

The library is a code that someone else has written, and you can use it directly.

The frame is a semi-finished program that you can use when empty.

Most programmers are happy to share their work. He will be delighted if you use his library and frame.

However, it should be noted that copyrighted materials are generally not allowed to be used free of charge.

For example:

Library: réquests library (issuing HTTP request)

import requests response = requests.get("https://www.baidu.com") print(response.text)

You don't have to write your own code to send HTTP requests, just call the requests library.

Frame: Django Framework (Web Development)

from django.urls import path from . import views urlpatterns = [ path('', views.home), path('about/', views.about), ]

The framework gives you a shelf, you just need to write view functions (views) and configure routing (urlpatterns), and a website comes out.

Common libraries and frameworks:

LanguagesCommon libraryCommon Frames
Pythonrequests, pandas, numpyDjango, Flask, FastAPI
JavaScriptlodash, axiosReact, Vue, Express
JavaApache CommonsSpring
GoThe standard library is powerfulGin, Echo

To summarize

• The code exists in a file with different suffix names in different languages

• Modules are a document and packages are a collection of multiple modules

• The library is a code written by others and the frame is a semi-finished program.

• Pools and frameworks can significantly increase development efficiency

Summary of this chapter

In this chapter, we talk about the basic concept of procedure:

Programming language is a translation between humans and computers, from machine language to compilation to advanced language, which is becoming easier to understand.

Different languages are suitable for different purposes, but not necessarily:

• Data analysis/AI selection of Python

• Select JavaScript for the front

• Enterprise application selection Java

Code mode of operation:

• Translation language is compiled and then run

• Explanatory language as well as interpretation as running

Programming core concepts: variables, data type, conditions, loops, functions, understand these, and programming is the starting point.

Program organization: documents, modules, packages, libraries, frames, to be properly organized in order to write big programs.

Next chapter, we're chattering about data.

Chapter 3: The thing about data, databases and algorithms

Opening remarks

Computers process data every day, but do you really know the data?

What's the data? Where's the data? What's the file format? What's the database for?

This chapter, we talk about data. You understand what the program is doing and what the AI code is for you to handle.

3.1 Anything becomes a number!

1. Computer view of the world

In computer eyes, everything is numbers.

Text? Numbers.

Pictures? Numbers.

Sound? Numbers.

Video? Numbers.

Program? Or numbers.

Computers only process numbers, so everything has to be turned into numbers for computers to process.

What's this like?

Like a weirdo who only speaks digital language. You say "hello" to him, he doesn't understand. You have to translate "hello" into numbers, such as "123 456", for him to understand.

Computers are such weirdoes.

2. Binary: the language of the computer

We usually use decimals, 0 to 910 numbers.

Computers are binary, with only 0 and 1 numbers.

Why binary?

Because computers work with telecoms, voltage is 1 and voltage is zero.

Binary is the easiest and most reliable.

If the decimal is used, there are 10 types of voltage, too complex to make mistakes.

By the way, isn't someone going to get a ternary computer now? Arsène didn't think it meant much.

How does a decimal match a binary?

DecimalBinaryinterpreted
00Zero is zero.
11One is one.
2102 = 1×2 + 0×1
3113 = 1×2 + 1×1
41004 = 1×4 + 0×2 + 0×1
51015 = 1×4 + 0×2 + 1×1
61106 = 1×4 + 1×2 + 0×1
71117 = 1×4 + 1×2 + 1×1
810008 = 1×8 + 0×4 + 0×2 + 0×1

You don't have to calculate, the computer will convert itself. But you know, the computer itself is binary.

Bit and byte:

• bit(bit): the smallest unit, 0 or 1 binary

• byte (bytes): 8 bits, which can be expressed as an integer of 0-255

1 byte = 8 bits

For example:

00000000 = 0

11111111 = 255

Storage unit:

UnitsConversionAbout.
KB1024 bytesA text
MB1024 KBa song
GB1024 MBA movie.
TB1024 GBA hard drive.

3. How does the text turn into a number?

How does the text turn into a number? Use the code.

ASCII code:

The earliest code is ASCII, which indicates English letters and symbols in numbers.

CharacterASCII CodeBinary
A6501000001
B6601000010
a9701100001
04800110000
Space3200100000

ASCII has 128 characters, sufficient for English, but what about Chinese?

Unicode encoding:

And then, with Unicode, you can say all the characters in the world.

CharacterUnicodeDescription
20013Chinese
25991Chinese
A65English
😊128522emoji symbol

The text you see is actually a string of numbers in the computer. When displayed, the computer lookup table converts the number into the corresponding glyph and displays it.

UTF-8:

Unicode sets the numbering of each character, but there is also a way to store it in a file. UTF-8 is the most common storage method.

It uses one to four bytes for a character:

• English: 1 byte (ASCII compatibility)

• Chinese: usually 3 bytes

• emoji: typically 4 bytes

If an English letter corresponds to a Chinese word, the Chinese file with the same number of characters is larger than the English file.

However, since a normal English word contains more than one letter and a single word corresponds to one or two Chinese words, in general, Chinese documents tend to be smaller if the meaning is the same.

4. How does a picture turn into a number?

The picture is made up of a lot of little dots, each called a pixel.

Each pixel has a colour, which is expressed in numbers.

RGB Mode:

A variety of colors are mixed with red (R), green (G), and blue (B). Each color component is 0-255.

Colour = (R, G, B)

For example:

• Pure Red = (255, 0, 0)

• Pure green = (0, 255, 0)

• Pure blue = (0, 0, 255)

• White = (255, 255, 255)

• Black = (0, 0, 0)

• Yellow = (255, 255, 0)

• Purple = (255, 0, 255)

A picture is a collection of pixels, each of which is three numbers.

For example:

A picture of 1920 x 1080 with 1920 x 1080 = 2,073,600 pixels.

3 digits (RGB) per pixel, 1 byte per digit.

Total: 2,073,600 x 3 = 6,220,800 bytes 6MB.

So it's a big picture, and it needs to be compressed.

Photo compression:

• JPEG: It undermines compression, discards minor details, files are small, but the quality of the picture is declining.

• PNG: No loss compression, same quality but large file. Fits for icons, screenshots.

• GIF: up to 256 colors, small file size but poor image quality. Supports animation.

• WebP: New generation format, small quality document, almost compatible.

5. How does the sound turn into a number?

Sound is waves, successive waves.

But computers can only store discrete numbers, so they turn successive waves into discrete points. This is called sampling.

Sampling process:

Records the value of a point every small period.

Sampling rate:

How many times a second is taken.

• Telephone: 8,000 times/s (8 kHz)

• CD: 44100/s (44.1 kHz)

• Professional audio: 96,000 times/sec (96kHz) or more

The higher the sampling rate, the more real the sound, the larger the document.

Bit Depth:

How many bits are stored per sampling point.

• 8 places: 256 levels

• 16 places: 65536 levels (CD quality)

• 24 places: 16 million levels (professional quality)

The higher the depth, the better the sound, the bigger the document.

6. How does the video turn into a number?

A video is a picture plus sound.

Twenty-four pictures (or more) in one second, with a voice and a link to play, are videos.

Frame rate:

How many pictures (frames) per second.

• Films: 24 frames/seconds

• TV: 25 or 30 frames per second

• Game: 60 frames/seconds or more

The higher the frame rate, the better the picture.

Why is the video so big:

A 1920 × 1080 image is about 6MB.

The 30-second frame is 180 MB.

One minute is 10.8GB.

It's too big!

So the video has to be compressed. The video compression technology is very complicated, and it can compress the files to a few tenths, or even a few hundred percent.

To summarize

• In computer eyes, everything is numbers.

• Binary for computers, only 0 and 1

• Text coded to numbers (ASCII, Unicode, UTF-8)

• Pictures consist of pixels, each coloured by RGB numbers

• Sound becomes a number by sampling

• Videos are images with sound, with the largest amount of data, and must be compressed

3.2 The secret of the file format

1. What's the name of the document?

You must have seen various file suffixes: .txt, .doc, .jpg, .mp4...

The nickname is to tell the operating system and the software: what type of document this is, what software should be used to open it.

For example:

• .txt — open with notebooks

.doc .open with Word

• .jpg open with a picture viewer

• .mp4 Open with a player

However, the suffix name is only an identification, and changing the suffix name will not change the content of the file.

You change.jpg to .txt, pictures or pictures, but the system may open it with a text editor and see a bunch of pieces.

2. Common file formats

Text file:

FormatDescriptionCharacteristics
.txtPure TextThe simplest thing is, you can open any software.
.mdMarkdownLightweight Marker Language, common for writing documents
.csvComma-separated dataTable data, Excel can open
.jsonJavaScript Object ExpressionData exchange common, Web development essential
.xmlEXtensible Markup LanguageCommonly used configuration files, a little chagrin
.htmlWeb FilesBrowser opens directly
.yamlAnother data formatCommonly used configuration files, simpler than json

Document file:

FormatDescriptionCharacteristics
.doc/.docxWord DocumentMicrosoft Office, most commonly
.pdfPDF documentsCross platform common, not editable
.xls/.xlsxExcel TableSpreadsheets, data processing
.ppt/.pptxPowerPointPresentation

image file

FormatDescriptionCharacteristics
.jpg/.jpeg- It's not good for you.Photos are common. Small files.
.pngNo loss compressionSupport transparent background, icons are common
.gifMomentumUp to 256 colors, animation supported
.bmpNo CompressionIt's a big file. It's not used anymore.
.svgVector DiagramZoom In Real, icon logo is common
.webpNew FormsGood image quality, small files, poor compatibility

Audio files:

FormatDescriptionCharacteristics
.mp3- It's not good for you.Most commonly, music labels.
.wavNo CompressionGood sound quality but large files
.flacNo loss compressionEnthusiasts like
.aac- It's not good for you.A little better than mp3
.oggOpen Source FormatGame is common

URL for video file

FormatDescriptionCharacteristics
.mp4Most commonSupported on all devices
.aviOld FormatIt doesn't work anymore.
.movApple FormatMac/iPhone commonly used
.mkvOpen Source FormatSubtitles in support of multitrack
.webmWeb FormatHTML5 video

Code file:

FormatDescription
.pyPython code.
.jsJavaScript code
.javaJava code.
.c/.cppC/C + + code
.htmlHTML code
.cssCSS Styles
.jsonJSON data
.sqlSQL Script

* Code files are in text format and can be opened by the text editor.

3. Compressed files

The compressed files are one package of multiple files, while the volume is compressed to facilitate transmission and backup.

FormatDescriptionCharacteristics
.zipMost commonAll systems are supported.
.rarWinRar for the best.High compression rate but software charges
.7z7-Zip formatHighest compression rate, open source free
.tar.gzLinux is a common practice.Bars packed, gzip compressed

4. Recommendations for document format selection

scenarioRecommended format
Write Document.docx or.md
Keep a photo.jpg
Acquire screenshots/ icons.png
Save Music.mp3
Save Video.mp4
Store data.json or.csv
Save CodeI'm reading language.

To summarize

• File suffix identifies the file type and tells the system what software to use to open it

• Different types of documents have different formats and characteristics

• Text, documents, images, audio, video, code, all in common formats

• Choose a format depending on the scene

3.3 Databases: larger tables than Excel

1. what's the database?

You've used Excel, right? Excel is a table that stores data.

A database is a more powerful "tabular system".

It allows for more data, faster access, multiple use, and data security.

2. Why do you need a database?

Question of Excel:

It's slow when the data is much more.

• Conflict is easy for many people to use at the same

No permission control (who can see, who can change)

No business.

• Inconvenient query.

Advantages of a database:

It's a lot more.

The database can store millions, tens of millions, or even hundreds of millions of pieces of data, and the query is still fast.

We're running fast.

The database has an index, like a catalogue of books, and the search is fast several orders of magnitude.

Multiplayer

There are locking mechanisms in the database to ensure that the data is not confused.

Keep it safe.

Suddenly, the power outage allows the database to return to its pre-electric state. It's called "business," either it works or it fails.

Control Permissions

The financial data is only financial, and the personnel data are personal.

Complex Query

Multiple tabulations, aggregate statistics, sorting groups, one SQL command is done.

3. Relationship-type databases

The most commonly used is a relational database, where the data resides in a "table", like Excel.

A table has "column" and "line."

For example, the user table:

idnameagecity
1Zhang San25Beijing
2Li Qi30Shanghai
3Cooper asks.28Guangzhou

Each column is a field (property) and each row is a record (entity).

Multiple tables can be linked:

User table

idnamecity_id
1Zhang San1
2Li Qi2

City table:

idname
1Beijing
2Shanghai

By connecting city_id, we can find out which city Zhang San lives in.

This is what "relational" means - there is a relationship between tables.

4. SQL: the language of dialogue with the database

SQL (Structured Query Language) is the language of an operating relationship database.

Basic operation: add/ delete/research

SELECT

SELECT * FROM users; -- 查所有用户 SELECT * FROM users WHERE city = '北京'; -- 查北京的用户 SELECT name, age FROM users; -- 只查名字和年龄

INSERT

INSERT INTO users (name, age, city) VALUES ('赵六', 35, '深圳');

Change (UPDATE)

UPDATE users SET age = 26 WHERE name = '张三';

Deleting

DELETE FROM users WHERE name = '王五';

Complex queries:

• Query the number of users

SELECT COUNT(*) FROM users;

• Ask for average age

SELECT AVG(age) FROM users;

• Statistics by city group

SELECT city, COUNT(*) FROM users GROUP BY city;

• Multi-table association queries

SELECT users.name, cities.name FROM users JOIN cities ON users.city_id = cities.id;

• Sorting

SELECT * FROM users ORDER BY age DESC;

• Page break

• From the user tables, skip the first 20, take only the next 10 data

SELECT * FROM users LIMIT 10 OFFSET 20;

Learn these orders, basic operations will be enough.

5. Common relationships database

DatabaseDescriptionApplied scene
MySQLMost Popular Open Source Database, FreeWeb Apps, Small and Medium Projects
PostgreSQLA stronger open source database, free of chargeItems requiring advanced functionality
SQLiteLightweight database, single file, freeSmall applications, mobile applications
OracleBusiness database, robust, fee-for-moneyLarge enterprises, critical systems
SQL ServerMicrosoft database, charge/freeWindows environment, business applications

6. NoSQL database

In addition to relationship-type databases, there are also NoSQL databases that are suitable for specific scenarios:

Document database:

Saves a JSON document, is flexible and does not require a fixed field.

Representative: MongoDB

{ "name": "张三", "age": 25, "hobbies": ["游泳", "读书"], "address": { "city": "北京", "street": "朝阳路" } }

Suitable for: content management, logs, user data

Key database:

Keys are saved correctly, simple and efficient.

Representative: Redis

SET user:1:name "张三" GET user:1:name

Fit: Cache, Sessions, Counters

List database:

Stores by column, suitable for big data analysis.

Representatives: HBase, Cassandra

Suitable: big data, time series data

Chart database:

Maintain nodes and relationships, suitable for social networking, referral systems.

Representative: Neo4j

Suitable for: Social Networks, Knowledge Graph, Recommendation System

7, JSON and data exchange formats

JSON (JavaScript Object Notation) is a lightweight data exchange format that is easy to read, write, and parse. It is based on a key-value pair structure and supports data types such as string, number, boolean, array, object, and null.

Examples:

{ "name": "张三", "age": 30, "hobbies": ["阅读", "编程"] }

Common formats for data exchange also include XML, YAML, etc.

Each of these features: XML is suitable for complex data structures and YAML is easy to read and write manually.

Because of its lightness and easy to interpret, JSON is the most widely used in Web API.

To summarize

• The database is a stronger data storage system than Excel, capable of storing large amounts of data and quick access

• Relational databases store data in "tables" and operate with SQL

• Common relationship database: MySQL, PostgreSQL, SQLite, Oracle

• NoSQL is suitable for special scenes: MongoDB (documents), Redis (key values), Neo4j (figures)

3.4 Data structure and algorithms: inner competence of programmers

1. What is a data structure?

Data structure is how data is organized in a computer.

Different data structures fit different scenarios. The right data structures are selected and process efficiency can increase dozens or even hundreds of times.

Common data structures:

Array (List)

A row of consecutive cells, each with a data.

[1. 2, 3, 4. 5]

• Advantages: quick access by location (direct location)

• Disadvantages: insert slow deletions (all later have to move)

Chain Tables

A string of beads, each pointing to the next.

1 → 2 → 3 → 4 → 5

Advantage: insert delete fast (changed pointer)

Shortcomings: slow access (from the beginning)

A stack of plates that can only be taken from above.

├───┤ ├───┤ ├───┤ ├───┤

Features: Last In First Out (LIFO)

• Purpose: function call, cancellation

Queue

Get in line and buy the tickets first.

→ → → → → 1 2 3 4 5 ↑ ↑ 出 进

Features: FIFO

• Purpose: task queue, message queue

Hashi watch.

Use the key to find value, like a dictionary.

{ "张三": 25, "李四": 30, "王五": 28 }

Advantages: Find Quick (O(1))

• Purpose: caching, indexing

There's hierarchically related data, like a family tree.

根 / \ A B / \ \ C D E

• Purpose: document system, database index, HTML structure

Nodes and edges, like a map.

A —— B C —— D

• Use: social networking, navigation, referral systems

2. What is an algorithm?

Algorithms are the method and the steps to solve the problem.

It's like a recipe: first cut, second oil, third fire...

The algorithm describes the steps to solve the problem.

Common algorithms:

Sorting algorithm (order by)

Sort of a bunch of random data into order.

• Bubbles sorting: simple but slow

• Quick Sort: Fast, Frequently Used

• Merge Order: Stable

Find algorithms:

Look for the target in a pile of data.

• Linear search: from scratch, slow

• Two-point search: half-round search, fast (but data have to be sequenced)

Chart algorithm:

• Shortest path: navigational

• Depth-first search: walk the maze

• Wide-range priority search: social networking

3. Algorithmic complexity

How do you measure the algorithm? Look at the complexity.

Time complexity:

Run time is related to the amount of data.

• O(1): Constant time, unrelated to data level

• O (log n): logarithmic time, soon

• O(n): linear time, double time for data

• O(n log n): Slower than linear

• O(n2): square time, double the amount of data four times

Space complexity:

Repository is related to the amount of data.

For example:

Find a number in an orderly array:

Linear lookup: finding the end from scratch

• Time complexity: O (n), worst-case search n

Two-point search: 50% search

• Time complexity: O (log n), 1 million numbers up to 20 times

There's a big gap!

4. Do you need to learn?

If you write small programs in AI, you don't need to study data structure and algorithms. AI will help you pick the right ones.

But if you want to be a professional programmer, data structure and algorithms are mandatory.

The beginners recommend that:

• Understand the basic concepts

• Know when to use the data structure

• Performance problems, if any;

To summarize

• The data structure is the way the data is organized, and it is selected with high efficiency

• Common data structure: arrays, chains, pads, queues, Hash tables, trees, graphs

• Algorithms are methods and steps to solve problems

• Combination measurement algorithm efficiency: time and space complexity

• Beginners need to understand the basic concepts

Summary of this chapter

In this chapter, we talked about the data:

It's all numbers: words, pictures, voices, videos, in computers.

File format: The suffix ID file type, with different formats for different types.

Database: A more powerful data storage system than Excel, which can store a large amount of data and quickly query with SQL operations.

Data Structures and Algorithms: The programmer's inner workings, just understand the basic concepts.

Data are the object of computer processing and the concept of data can be understood in order to better understand programming.

Next chapter, we're chattering about the Internet.

Chapter 4: The thing about the network.

Opening remarks

You're online every day, but do you know how it works?

You click the link, the web page comes out -- what's going on behind it?

You send a micromail, and your friends get it -- how did the data go?

This chapter, the basics of our chatter network, let you know what's going on behind the mouse.

You can understand Web development, API calls, cloud services, and so on.

4.1 What about two computers?

1. The essence of the network

The essence of the network is that computers can talk to each other.

Two computers connected to a network cable can form the simplest network. They can send files and messages to each other.

So many computers are connected together, and the big network. The world's computers are connected, the Internet.

Let's say:

The network is like a phone system. Each computer is a phone, and the network is a phone. You dial, you answer, you can communicate.

2. Network protocol: "Language" of computers

What do you say to computers? You have to use a unified "language," that's the network protocol.

It's like people talk to people, they have to speak the same language. You speak Chinese, I speak English, we can't talk.

The same is true of computers, which need a uniform protocol in order to transmit data correctly.

The most common protocol is TCP/IP, which is the underlying protocol of the Internet.

TCP/IP is not a single agreement but a group of agreements that have a large membership and are updated, upgraded, added, repealed more frequently, mainly including:

• IP: Internet Protocol, responsible for addressing and routing

• TCP: Transfer control protocol, responsible for reliable transmission

• UDP: User Datagram Protocol for fast transmission

HTTP: Hypertext transfer protocol, responsible for web transfer

• FTP: file transfer protocol, responsible for transferring files

• SMTP: mail transfer protocol, responsible for sending mail

These agreements operate in a functional and complementary manner to enable the Internet to function properly.

3. How do you transmit the data?

How did you get the data from sending a file to another computer on the computer?

Not all of a sudden, it's "cut" into a lot of bags, and each one goes alone, and it's put together when it's at its destination.

It's called a group exchange.

Benefits of doing so:

• Lost a bag. Just retransmit it. Don't retransmit it all.

• Multiple data can be transmitted simultaneously and network resources shared

• Mistakes can be easily located and repaired

Like you sent a book:

It is not a whole book, but a large number of pages, each in a separate envelope, and then a book, once it is received by the other party.

Although it sounds cumbersome, it is more efficient and reliable.

To summarize

• The essence of the network is to allow computers to talk to each other.

• Network protocols are "languages" for computer communication, TCP/IP is the basis

• Data are cut into small packages to be put together at the destination

4.2 IP address: the number of the Internet World

1. what's an IP address?

You have to send a letter, you have to know the address.

The IP address is the house number of the network world.

For example: 192.168.1.100

These four figures make up an IP address, each of which has an IP address.

2. What's the IP address like?

IPv4 address:

4 numbers, separated by dots, each number 0-255.

192.168.1.100

Each number is eight, that is, one byte. The eight-digit two-digit number is a maximum of 1111111. equal to 255 in the 10-digit.

Four figures total 32 places, which means the number of addresses: 232, 4.3 billion. This is the global total of all IP addresses.

IPv6 address:

Eight sets of hexadecimal numbers, separated by colons.

2001:0db8:85a3:0000:0000:8a2e:0370:7334

A total of 128 addresses are available to the maximum number of users.

3. IPv4 and IPv6

v is the reference, the version means. v4 is the fourth and v6 is the sixth.

IPv4 Question:

There's not enough addresses! There's only more than 4 billion people in the world, not enough points.

Think about how many devices are connected around the world? Computers, mobile phones, tablets, smart watches, smart headphones... are already over 4.3 billion.

IPv6 solution:

The number of addresses is so large (2128 3.4 x 1038) that it is enough to use it.

Status:

IPv4 is still in use, but there are not enough addresses, so there are various technologies (NAT, dynamic distribution, intranet) to save it.

4. Public Internet IP and Intranet IP

Public Internet IP:

The only IP address in the world that can be accessed on the Internet.

Just like your home address, there's only one in the world where someone else can find you.

Private network IP:

Only IP addresses are valid in the internal LAN, and different LANs can be repeated.

Like your gate number, "Room 502 in Building 3", a lot of the neighborhoods have this address, but it's the only one in your neighborhood.

Common Intranet IP segment:

• 192.168.x.x (most commonly used on home routers)

10.x.x.x (commonly used by large companies)

• 172.16.x.x - 172.31.x.x

Your Internet:

Your computer, mobile phone, are using intranet IP. They are connected to the internet via a router (with public IP).

This is NAT: multiple devices share a public network IP.

5. How do I check my IP?

Check the IP of the intranet:

Windows: Open command line, enter ipconfig

Mac/ Linux: Open terminal, enter ifconfig or ip addr

Chacón net IP:

Browser access: https://www.ip.cn/

Or a hundred-degree search for "IP", which will show you your Internet IP.

Not necessarily accurate.

To summarize

• IP address is the name and number of the Internet world

• IPv4 address is running out and IPv6 is a future trend

• The public IP is the only one in the world, and the intranet IP is only valid on the local area network

• Family networks share a public network IP with multiple devices through NAT

4.3 Domain names and DNS: well-recorded names

1. What is a domain name?

The IP address is too hard to remember. 192.168.1.100. Who remembers?

So there's domain names, like www.baidu.com, that's a lot better to remember.

Domain names are "alias" to the IP address, so that people can remember.

2. Structure of domain names

Domain name from right to left:


www.baidu.com

com Top-level domain name (. com for business)

beidu § Second domain name (corporate name)

www Level 3 domain name (hostname)

Common top-level domains:

Top-level domain nameMeaning
.comBusiness institutions
.orgNon-profit organizations
.netNetwork service provider
.eduEducational institutions
.govGovernment institutions
.cnChina
.jpJapan

3. DNS: Domain Name Translator

If you enter a domain name, how does the computer know the corresponding IP address?

Domain Name System, domain name system.

DNS, like a phone book, records the correspondence between the domain name and the IP address.

Query process:

The domain name query is a hierarchical diffusion process called domain name parsing:

Once the user has entered the domain name, the local computer first checks the local cache and, if no result is obtained, requests the local DNS server; the local DNS tracks its own cache and does not search the root domain name server, the top-level domain name server, the authoritative domain name server in a step-by-step manner, and eventually obtains the corresponding IP address and transmits it back to the user device, with the local computer accessing the target server using the IP.

That is, although you used a domain name, the computer finally did the access via an IP address.

DNS cache:

To speed up, both computers and DNS servers cache (remember) the results previously checked.

Next time, check the same domain name and use the cached IP instead of checking.

4. Hosts files

Before DNS, there is also a place where domain names and IP correspondences can be configured: hosts files.

Position:

• Windows:`C:\Windows\System32\drivers\etc\hosts`

• Mac/Linux:`/etc/hosts`

Sample content

127.0.0.1 localhost

192.168.1.100 myserver

Purpose:

• Local Development Testing

• Blocking certain websites (e.g. targeting ad domains to 127.0.0.1)

• circumventing DNS pollution

To summarize

• A domain name is a memorable alias for an IP address

• Domain name from right to left: top-level domain name Second-level domain name Third-level domain name

• DNS translates a domain name into an IP address, like a phone book

• Hosts files can manually configure the interface between domain names and IPs

4.4 How does a website open?

1. Browser access to the website

You entered the site on the browser, press the next car back. What happened?

Complete process:

• Browser first performs domain name parsing and replaces the site with IP

• Establishment of three TCP handshake and server connectivity

• Send HTTP/HTTPS requests (page views using HTTP/HTTPS protocol)

• Server handles requests and returns data (HTML, CSS, JS, photos, etc.)

• Browser parsing HTML, rendering pages, loading resources, executing JS

• TCP waved four times to break the connection after browsing

2. three handshake: creating connections

TCP connections take three handshake times. So-called handshake is about contact before official communications.

Why three times?

Make sure both sides receive and send. Just like calling:

"Hello, can you hear me?"

• “I hear you, can you hear me?" (second time)

"Heard that, you say that."

3. HTTP requests and responses

HTTP requests:

The message from the browser to the server is as follows:

GET /index.html HTTP/1.1 Host: www.example.com User-Agent: Mozilla/5.0... Accept: text/html

It contains key messages:

• Methodology: GET (access), POST (submission), PUT (update), DELETE (deleted)

• Path: /index.html

• Protocol version: HTTP/1.1

• Request header: host, browser information, accepted content type, etc.

HTTP response:

Server returns message to browser:

HTTP/1.1 200 OK Content-Type: text/html Content-Length: 1234 <!DOCTYPE html> <html> ... </html>

It contains key messages:

• Status code: 200 (successful), 404 (not found), 500 (server error)

• Response headlines: type of content, length, etc.

• Response: actual HTML content

Common status code returned by server:

Status CodeMeaningDescription
200OKBerhasil
301Moved PermanentlyPermanent Redirection
302FoundTemporary re-orientation
304Not ModifiedCannot initialise Evolution's mail component.
400Bad RequestError in request format
401UnauthorizedUnauthorized
403ForbiddenAccess forbidden
404Not FoundNot found
500Internal Server ErrorInternal Server Error
502Bad GatewayGateway error
503Service UnavailableService exception.

This is where the 404 stem on the Internet comes from.

4. HTTP and HTTPS

HTTP (HyperText Transfer Protocol): Web transfer protocol, express transmission.

HTTPS: Encrypted version of HTTP, safer.

Differences:

HTTPHTTPS
Transfer Methodcleartextcryptography
SAFETYIt's not safe.Security
Port80443
CertificateI don't need it.Could not close temporary folder: %s

Now most websites use HTTPS. Look at the address bar. There's a small lock icon, HTTPS.

Why is HTTPS safe?

HTTP is an express transmission, and your text may be intercepted by an intermediary.

HTTPS is encrypted, and the middleman intercepts it and doesn't understand it.

HTTPS encryption process:

• Browser requests the server's certificate

Server returns certificate (including public keys)

• Browser authentication certificate (not issued by a trusted authority)

• The browser generates a random key, encrypts it with the server's public key, and sends it to the server

• The server decrypts with its own private key to get this random key

• Both parties then use this key to encrypt communications

To summarize

• Access to the website: DNS resolves the connection creation, send requests, respond to the dye break-up

• TCP three-way handshake ensures both parties can send and receive

• HTTP requests and responses are the way browsers and servers communicate

• The status code tells you whether it's a success or a failure.

• HTTPS is safer than HTTP because of encrypted transmission

4.5 Literacy of common network concepts

1. Port: room number of a building

The IP address found the server, but there are multiple programs on the server, how to distinguish?

With the port.

The port is a room number. The IP address is the building address and the port is the room number.

IP address: 192.168.1.100

Port number: 80

Full web address: 192.168.1.100:80

Common port:

PortServices
80HTTP (website)
443HTTPS (encrypted web page)
22SSH (remote login)
21FTP (File Transfer)
25SMTP (Mail Sending)
3306MySQL database
5432PostgreSQL database
6379Redis
27017MongoDB

Port range:

• 0-1023: Famous port, system occupancy

• 1024-49151: registered port, application

• 49152-65535: Dynamic ports, temporary

2. URL: unified resource locator

The URL (Uniform Resources Locator) is a acronym for a unified resource locator, which is used to locate and access resources on the Internet.

Each URL points to a particular page, file or service and is the basis for a web search.

URLs typically contain parts such as protocols, domain names, paths, etc., such as:

http://www.example.com/page

Of these, http is an agreement, www.example.com is a domain name,/page is a path.

With URL, the browser can accurately capture and display the contents of the target.

3. Firewall: Network Security

The firewall is a network security system that controls which data are accessible.

Just like the cell doorman, check each incoming and outgoing data packet, release according to the rules, and interception of non-conformance.

Firewall Rules:

• Allow traffic on certain ports

• Prohibition of certain IP visits

• Restrictions on certain agreements

For example:

Websites (port 80) and databases (port 3306) are operated on the server.

Firewall configuration:

• Allowing access to 80 ports (user access to the website)

• Outline access to port 3306 is prohibited (database is not open to the public)

In this way, even if there are vulnerabilities in the database, the external network cannot be attacked.

4. Proxy server: an intermediary

The proxy server is the intermediate server between the client and the server.

Regular visits:

Client-Server

By proxy:

Client → Proxy → Server

Use of agency:

Presented to proxy:

Agent of the client to help the client access the server.

Rolling the wall (access to blocked sites)

• Hide the real IP

Speed up access (agent has caches)

Reverse agent:

Server agent, help the server receive the request.

• Load balance (distribution of requests to multiple servers)

• Hide the real server IP

• Cache static resources

Nginx is the most commonly used reverse proxy server.

5. VPN: Virtual Private Network

VPN (Virtuary Private Network) can create a dedicated encrypted channel on the public web.

Normal Internet access:

You, the Internet, the website.

With VPN:

You VPN Encrypted Channel VPN Server Internet Website

Use of VPN:

Telecommuting (security access to the company network)

• Protection of privacy (flow encryption, not visible to the operator)

• Content of restrictions on the areas visited

Note: Domestic use of VPN requires compliance with laws and regulations.

6. CDN: Content Distribution Network

The CDN caches content to local servers, and the user accesses it.

No CDN:

User (Beijing) Source server (United States) Delayed high

There's a CDN:

User (Beijing) → CDN node (Beijing) low → latency

Benefits of CDN:

• Expedited access

• De-escalation of source server pressure

• Improving usability (one node hangs out and others)

Common CDN service provider:

• Abroad: Claudeflare, Akamai

• Domestic: Alibaba Cloud CDN, Tencent Cloud CDN, Baidu Cloud CDN

To summarize

• Ports distinguish between different programs on the server, like room numbers

• URL is a web-based unified resource locator

• Firewall control of network traffic, such as door guards

• The proxy server is an intermediary and is being directed to a proxy client, a reverse agent server

• VPN creates encrypted access to protect privacy

• CDN distributes content everywhere to speed up access

Summary of this chapter

In this chapter, we nag the basic principles of the network:

The essence of the network is that it allows computers to talk to each other and transmit data by protocol.

IP address is the name of the Internet world, IPv4 is running out, IPv6 is the future.

A domain name is a good alias for an IP address, and DNS translates the domain name into an IP address.

The process of accessing the website: DNS parses the creation of connections to send requests to respond to the dissipation of the dye.

Common concepts: Ports, firewalls, agents, VPNs, CDNs.

You can understand Web principles so you can understand Web development, API calls these concepts.

Next chapter, we're talking about the website.

Chapter 5: The web page and the front end

Opening remarks

You brush the web every day, but do you know how it's made?

A webpage, looking at the bells and whistles, with pictures, words and animations, and clicking buttons to jump. What's all this all about?

This chapter, the basics of our chatter web pages. You understand what the front-end code is creating for you.

5.1 Web Troika

1、HTML、CSS、JavaScript

Open a web page and you see a full picture. How did it come out?

It is drawn by combining three things:

• HTML: skeleton, which determines what a webpage has

• CSS: Clothes, decide what the web page looks like

• JavaScript: Action, deciding what the web page can do

2, HTML: Bones

HTML (HyperText Markup Language), HTML.

It sounds tall, but it's really using "tags" to define the various elements on the webpage.

Look at a HTML code:

<!DOCTYPE html> <html> <head> <title>我的第一个网页</title> </head> <body> <h1>这是一个标题</h1> <p>这是一个段落。</p> <img src="photo.jpg" alt="一张图片"> <a href="https://www.baidu.com">这是一个链接</a> <ul> <li>列表项1</li> <li>列表项2</li> <li>列表项3</li> </ul> </body> </html>

You open the notebook and copy the code.

Saves it in HTML format, the file name is .html. Double-click this file to see the effect.

What do these labels mean?

labelMeaningRole
<html>The whole page.All contents of the package.
<head>HeadStore information on titles, styles, etc.
<body>SubjectStore visible content
<h1>First level titleShow large headers
<p>ParagraphsShow a text
<img>ImagesShow pictures
<a>LinkClick Jump
<ul>No Sequence TableShow list of items
<li>List Item Each item in the list

This is how HTML uses these labels to put the skeletons on the web site.

Of course, there are more than just these labels, but there are more labels.

3. CSS: Clothes

HTML has bones. It's a really ugly page. It's all black and white. It's like a notebook.

CSS (Cascading Style Sheets), a stubble stylesheet, is "dressing" for the web page.

Look at a CSS code:

h1 { color: red; font-size: 24px; text-align: center; } p { color: gray; line-height: 1.5; margin: 10px; } body { background-color: #f0f0f0; font-family: "微软雅黑", sans-serif; }

What's this CSS doing?

• Heading red, 24 pixels big, centered

• The paragraph becomes grey, line is 1.5 times tall and is surrounded by 10 pixels

• The page background becomes light grey and the font is :

CSS Basic Syntax:

Selector {

Properties: Value;

Properties: Value;

...

}

• Selector: select the elements you want to modify (e.g. `h1' select all titles)

• Properties: what do you want to change (e.g. `color ' change colour)

• Value: change to what (e.g. `red ' to red)

4. JavaScript: Let the web page move

The HTML and CSS combined, the page was pretty good, but it was "dead," and nothing could be done.

JavaScript is the language that keeps web pages "alive".

Look at a piece of JavaScript code:

// 找到按钮元素 var button = document.getElementById("myButton"); // 给按钮添加点击事件 button.onclick = function() { alert("你点了我!"); };

What's this JavaScript doing?

• Found a button on the page that id is my Button

• Add a click event to this button

• A prompt box pops up when the user clicks the button

JavaScript has done a lot more:

• The user clicks a button to perform an action

• Users fill out forms to verify that the input is legal

• Users scroll pages to load more content

Perform certain operations on a regular basis (e.g., rotations)

• Send network requests and obtain data

• Operation page elements, change style or content

5. How can the three cooperate?

A full web page, HTML, CSS, JavaScript, is coordinated as follows:

<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>示例网页</title> <!-- CSS写在style标签里,或者引入外部CSS文件 --> <style> body { font-family: sans-serif; background-color: #f5f5f5; } #myButton { padding: 10px 20px; background-color: #007bff; color: white; border: none; border-radius: 5px; cursor: pointer; } #myButton:hover { background-color: #0056b3; } #message { margin-top: 10px; font-size: 18px; color: green; } </style> </head> <body> <!-- HTML定义页面结构 --> <h1>欢迎来到我的网页</h1> <p>这是一个示例网页,点击下面的按钮试试。</p> <button id="myButton">点我试试</button> <div id="message"></div> <!-- JavaScript写在script标签里,或者引入外部JS文件 --> <script> // 找到按钮和消息区域 var button = document.getElementById("myButton"); var message = document.getElementById("message"); // 点击按钮时执行 button.onclick = function() { message.textContent = "恭喜你,按钮被点击了!"; }; </script> </body> </html>

The effect of this web page:

• Show a title and a text

• Show a blue button

• When the button is suspended, the button colours get deeper

• Click on the button to show a message below

To summarize

TECHNOLOGYRoleSimile
HTMLDefine web structureHuman bones.
CSSBeautify your web styleMan's Clothes
JavaScriptAdd interactivityHuman action

If you understand these three things, the front door will be pushed.

5.2 What's the relationship between the front and the back?

1. what's the front end?

The front end is the part of the webpage that the user sees.

Everything you see in the browser -- text, pictures, buttons, animation -- is the front end.

The front-end code runs in your browser and does not require server involvement (except when data are obtained).

What the front-end development needs to do:

• Design and implementation of web-based interfaces

• Process user interaction (click, input, scroll, etc.)

• Send a request to the backend to get or submit data

• Show data returned from backend

2. what's the back end?

The backend is the program on the server, which is invisible to the user.

Backend runs on the server, handles business logic, operates databases, returns data to the front end.

What the backend development needs to do:

• Design and implementation of business logic

Operation of databases (additional changes)

• Provides an API interface to call the front end

• Process user certification and authorization

• Address issues of integration, security, performance

3. How does the front and back end cooperate?

An example should be given of:

Scenario: User logs in

• User enters account password, front-end verification format

• Encrypted to backend

• Backend query database to verify the matching of account codes

• Verify pass, generate a session to return to the front-end, otherwise deny login

A clear division of labour between the front and the back:

StepWho's doing it?Doing what?
Show Login PagesFrontendHTML+CSS Rendering
Receive user inputFrontendJavaScript Process
Send RequestFrontendJavaScript sent HTTP requests
Authenticate UsersBackendCheck database, authenticate password
Returns resultBackendReturns JSON data
Show ResultsFrontendSuccess or failure according to return data

4. make a metaphor.

Frontend = Restaurant lobby

• Waiter to receive guests

• Presentation of menus

• Hosting of guests to order

• Bring the dishes to the table

Backend = restaurant chef

• Cooking by a chef

• Fetching ingredients from the warehouse

• Stand by for orders

• Give the cooked dish to the waiter

Guest = User

Only the front room (front end) and the back end (back end) are not visible, but the food is made from the back kitchen.

In fact, the name of the front, back, came from here.

5. Separation of the front and rear ends

The front and back ends are often mixed a long time ago. The web pages are generated from the back end, which is only shown.

Now, the front-end separation is the main form:

• Independent development and deployment of the front end

• Backend provides only API interfaces, not interested in interfaces

• Front and back end communication via HTTP interface

Benefits:

• Be developed in parallel and efficient at the back and back ends

• The front end can use any frame (React, Vue, etc.)

• Backend can be used in any language (Python, Java, Go, etc.)

• The same backend can serve multiple frontends (web pages, apps, applets)

6. Front-end and back-end in the AI programming era

In the AI programming era, the back and back are moving towards integration.

AI-based full-stack programming is back on fire. This is also the main reason why Asak wrote this pamphlet.

If you want to program the whole place, you'll have to understand it all before and after.

The front-end interface can be automatically generated based on natural language descriptions, and the back-end logic is directly structured and populated by AI according to business needs.

The developer role evolved from writer to requirements definer, reviewer, and optimization facilitator.

The full stack capability has been redefined, and the center of gravity has shifted to the coordination and control of the overall agent of the system.

In the future, the line between the front and the rear will become blurred and integrated into a unified intelligent development stream.

To summarize

• Frontend: the page segments that users can see, running on the browser

• Backend: programs on the server, not visible to the user

• Back-end collaboration: request from front end, back-end return data

• Division of labor: front-end tube display and interaction, back-end tube business and data

• Separation: independently developed from the front and end and communicated through API

5.3 API interface: caller at front and back ends

1. what's an API?

API (Application Programmeing Interface), Application Programming Interface.

It's kind of a "promise" -- front-end, back-end, back-to-back.

Let's say:

You call for takeout:

• You said, "Come on, let's get a chicken from the palace and get it to XX."

• The store said, "Okay, 30 minutes, $25."

This is an interface:

• Information you send = Request

• In-store response = response

• The Behavior of "Call for Delivery" = Calling the Interface

2. What is the interface like?

An API interface, usually containing this information:

Information requested:

• URL: interface address, e.g. `/api/user/login'

• Methodology: GET, POST, PUT, DELETE, etc.

• Parameters: data to be transmitted

Response Info

• Status code: Success or failure

• Data: the returned contents, usually in JSON format

To give a concrete example:

Interface: user login

Upon request of:

POST /api/user/login Content-Type: application/json { "username": "zhangsan", "password": "123456" }

Response:

{ "code": 200, "message": "登录成功", "data": { "token": "eyJhbGciOiJIUzI1NiIs...", "userId": 123, "username": "zhangsan" } }

3. Common request methods

The HTTP agreement defines several request methods that correspond to different operations:

MethodologyUseExamples
GETAccess to dataget user info
POSTCreate DataAdd a new record
PUTUpdate DataModify User Information
DELETEDelete DataDelete a record
PATCHPartial UpdateChange only a field

RESTful style:

Now the popular interface design style is RESTful, and the rules are:

Use URL for resources (nouns)

Operation using HTTP method (verbs)

For example:

GET /api/users # 获取用户列表 GET /api/users/1 # 获取id为1的用户 POST /api/users # 新增一个用户 PUT /api/users/1 # 更新id为1的用户 DELETE /api/users/1 # 删除id为1的用户

4. Interface documents

The backend develops the interface and tells the front end how to use it. This requires the interface document.

Interface documentation typically includes:

Interface Name: User Login

Interface address: POST/ api/user/login

Request parameters:

• Username: Username (which must be filled)

• Password: password (which must be filled)

Return data:

• code: status code

• message: prompt information

• Data: returns data

• Token: Login documents

• UserId: User ID

• Username: Username

Error code:

• 200: Success

• 400: Error in parameters

• 401: Username or password error

Common interface document tools:

• Swagger / OpenAPI

• Apifox

• Postman

• YApi

5. How do you call the interface?

Calling an interface refers to calling a request method, and a request method is a function.

The way the interface is called at the front:

Mode I: With fetch (browser original)

[Calling login interface]

fetch('/api/user/login', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ username: 'zhangsan', password: '123456' }) }) .then(response => response.json()) .then(data => { console.log(data); });

Mode two: use axiios (third party library)

axios.post('/api/user/login', { username: 'zhangsan', password: '123456' }) .then(response => { console.log(response.data); });

Although the browser's native fetchAPI has matured, axios has significant advantages in ease of use, functional integrity, and compatibility, and is widely used in practical commercial projects.

To summarize

• API interface is a bridge for front-end and back-end communication, front-end requests, back-end responses

• The request contains: URL, method, parameters

• The response contains: status code, data (usually JSON)

• RESTful style: resources in URL and operations in HTTP method

• The interface documentation tells the front-end how to call the interface

• Front-end call interface with fetch or axiios

5.4 Front-end frame: no more handwritten original code.

1. Why the frame?

You might think: why do you learn the frame by using raw HTML, CSS, JavaScript?

It can be written, but when the project is big, the problem comes:

Issue one: code disorder

HTML, CSS, JavaScript mixed together and moved their whole bodies in one place.

Issue II: Duplication of efforts

Many functions have to be written repeatedly: buttons, forms, windows... Every time you write from the top?

Question three: Difficult to maintain

People write codes that they can't read. They write codes that they can't read in two days.

Issue IV: Inefficiency

Write a simple function with a lot of code. It's exhausting.

The framework addresses these issues.

2. Three front-end frameworks

Now the three hottest frameworks at the front end:

FrameProductionsCharacteristics
ReactFacebookComponentization, virtual DOM, most ecologically powerful
VueYuyun Creek.Progressive, easy to use, active Chinese community
AngularGoogleBig and round, firm level, learning curves.

React

// React组件示例 function Welcome(props) { return <h1>Hello, {props.name}</h1>; } // 使用组件 ReactDOM.render( <Welcome name="张三" />, document.getElementById('root') );

Vue

<!-- Vue组件示例 --> <template> <h1>Hello, {{ name }}</h1> </template> <script> export default { data() { return { name: '张三' } } } </script>

3. Benefits of the framework

Component

Splits the page into one component, each of which can be developed, tested and reused independently.

Data Driver

Frames help you to process data and view synchronisation. You just need to change the data and the view automatically updates.

// 原生JavaScript:改数据还要手动改DOM document.getElementById('name').textContent = '李四'; // Vue:改数据,视图自动更新 this.name = '李四';

Ecologically rich

The framework is rich in ecology: UI assembly, route, state management, construction tools...

You don't need a zero wheel. Just use it.

In fact, Asher, as an old programmer, is not used to using frameworks, or unconsciously using native code, but this is not right. It has to be changed!

4. Which frame?

Newcomer entry: Vue

Vue is the easiest to get started, the grammar is intuitive, the Chinese documents are complete, and the community is active.

Econometrically strongest: React

React is the most ecologically rich, large companies are much more useful and learn to find jobs.

Enterprise project: Angular

Angular is large and comprehensive, suitable for large-scale enterprise projects, but costly to learn.

It is recommended that:

Get started with Vue, understand the concepts of componentization and data-driven, and then learn React to broaden your horizons.

To summarize

• Framework to address the pains of primary development: code confusion, duplication of effort, difficulty in maintaining, inefficiency

• Three main frameworks: React, Vue, Angular

• Framework Benefits: Component-based, data-driven, eco-rich

• Newcomer's proposal: starting with Vue, learning about React

5.5 Writing front-end code with AI

1. what can AI write for you?

Write HTML Structures

You say: Write me a HTML structure for the login page, including username, password input box and login buttons.

AI Answer:

<div class="login-container"> <h2>用户登录</h2> <form class="login-form"> <div class="form-group"> <label for="username">用户名</label> <input type="text" id="username" name="username" required> </div> <div class="form-group"> <label for="password">密码</label> <input type="password" id="password" name="password" required> </div> <button type="submit" class="login-btn">登录</button> </form> </div>

Writing CSS Styles

You said, "Help me write the CSS style for the login page above, so that it can be displayed in the middle, in a modern, simple style.

AI Answer:

.login-container { width: 400px; margin: 100px auto; padding: 30px; background: white; border-radius: 10px; box-shadow: 0 2px 10px rgba(0,0,0,0.1); } .login-container h2 { text-align: center; margin-bottom: 30px; color: #333; } .form-group { margin-bottom: 20px; } .form-group label { display: block; margin-bottom: 5px; color: #666; } .form-group input { width: 100%; padding: 10px; border: 1px solid #ddd; border-radius: 5px; } .login-btn { width: 100%; padding: 12px; background: #007bff; color: white; border: none; border-radius: 5px; cursor: pointer; } .login-btn:hover { background: #0056b3; }

Write JavaScript interactively

You say: Add JavaScript to the login page and send a request to/api/login when you click on the login button.

AI Answer:

document.querySelector('.login-form').addEventListener('submit', function(e) { e.preventDefault(); const username = document.getElementById('username').value; const password = document.getElementById('password').value; fetch('/api/login', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ username, password }) }) .then(response => response.json()) .then(data => { if (data.code === 200) { alert('登录成功'); // 跳转到首页 window.location.href = '/'; } else { alert('登录失败:' + data.message); } }) .catch(error => { console.error('Error:', error); alert('网络错误,请重试'); }); });

2. how do I get AI to write you a code?

One thing at a time.

Don't let the AI write the entire website at once, one module at a time.

Give a clear description.

Poor

帮我写个网页。

Okay:

帮我写一个产品列表页面,显示产品的图片、名称、价格,每行显示4个产品,响应式布局,使用Flexbox。

Provide context

If AI is to write the previous code, send it to AI.

Specified technology store

Tell AI what frameworks and UI libraries you use. For example:

帮我用Vue3和Element Plus写一个用户管理页面,包括用户列表、搜索、新增、编辑、删除功能。

3. watch out for AI's hole.

Pit one: inconsistent style

AI may generate different styles at a time, resulting in inconsistent page styles.

Solve: Lets AI use a unified CSS framework (e.g. Tailwind CSS, Bootstrap) or lets AI write a public style file.

Pit 2: Code has a bug

There may be errors in the code that AI writes, such as the misspelled variable name and the logic.

Solve: Codes to be checked, tested, not directly online.

Pit three: incompatible

AI may have used some new features and could not run on the old browser.

Solve: Ask AI compatibility, or specify a browser version to be compatible.

To summarize

• AI can help you write HTML, CSS, JavaScript

• Clear description and context for AI

• To specify technology stores and styles

• AI code to be checked, tested

Summary of this chapter

In this chapter, we talked about the web page:

Three elements of the web page: HTML skeleton, CSS clothing, JavaScript action.

Front-end and back-end relationships: The front end is the facade, and the back end is the kitchen, communicating through the API.

API interface: front and back end microphone, request + response, RESTful style.

Front-end framework: React, Vue, Angular, to address the pains of primary development.

AI writing front-end: can help you write, but to give a clear description, the code should be checked.

Next chapter, we'll talk back about that.

Chapter 6: The Server and the Backend

Opening remarks

The previous chapter nags the front end and this chapter nags the back end.

Backends, that's what's on the server. Users can't see, but they're all doing it here.

You click the "Login" button, the front-end sends the username and password, the back-end has to verify, check the database, and return the results. These are back-end jobs.

This chapter, the basic concept that we're developing at the back end.

6.1 What's the back end for?

1. Backend duties

The back end is like "back-cooking" in a hotel, where users order (request) and then cook (process request) and then bring out the food (return data).

Specifically, the back-end should do these tasks:

Processing business logic

This is the core of the back end. For example:

• User login: authentication of username passwords

• Purchase orders: inspection of inventory, calculation of prices, generation of orders

• Post comments: check content, save database

operational database

CRUD, most of which deals with databases.

Provide API interface

The interface that is called for the front end returns the data in the JSON format.

User authentication and authorization

Verify who the user is and what he can do. For example, ordinary users can only see, administrators can change.

Processing and distribution

Multiple users access it simultaneously and the server is able to handle it.

Security

Prevent various security issues such as SQL injection, XSS attacks, CSRF attacks, etc.

2. Backend processing processes

Processing process: Receive requests for analysis of parameters — authentication rights — business processing — database — return response.

To summarize

• Back-end processing of business logic, operational databases, provision of interfaces

• The back-end is also responsible for authentication authorization, processing concurrency, and security

• Processing flow: Receive a response from the request→ parsing parameter→ validation permission→ business processing→→ operation database

6.2 Which language is the back end?

1. Common backend language

The backend can be written in many languages, each with its own characteristics:

LanguagesCharacteristicsApplied scene
PythonEasy to learn, rich in framework.Rapid development, data processing, AI
JavaIt's stable and reliable, and it's ecologically strong.Enterprise-level applications, large-scale projects
GoHigh performance, and strong.Microservices, clouds.
Node.js(JavaScript)Frontend can write backends.Full-store development, real-time applications
PHPSimple and easy to deploySmall and medium-sized websites
C#Microsoft family cans.Windows Environment

Python: Simple is beautiful.

ADVANTAGES:

• Simple grammar, quick start

• Framework rich: Django, Flask, FastaPI

• Eco-strong: data processing, AI

Disadvantages:

• Less efficient than compiled languages

• Combining relatively weak processing

Who it's for:

• Founder

• Rapid prototyping

• Data-driven applications

One example of Flask:

from flask import Flask, jsonify, request app = Flask(__name__) @app.route('/api/hello', methods=['GET']) def hello(): name = request.args.get('name', 'World') return jsonify({ 'message': f'Hello, {name}!' }) if __name__ == '__main__': app.run(debug=True)

Dozens of lines of code can run an API service. Easy, right?

3. Java: Steady is winning.

ADVANTAGES:

• Be stable and reliable and have been tested for a long time

• Ecologically strong, with everything

• Business preferences, easy access to jobs

Disadvantages:

• Syntax chatter, multiple codes

• Slow start and high memory occupancy

Who it's for:

• Large enterprise projects

• Key systems, such as banks, electricity providers, etc.

• The pursuit of stable applications

One example of Spring Boot:

@RestController @RequestMapping("/api") public class HelloController { @GetMapping("/hello") public Map<String, String> hello(@RequestParam(defaultValue = "World") tring name) { Map<String, String> result = new HashMap<>(); result.put("message", "Hello, " + name + "!"); return result; } }

It's better than Python's talk, but it's safe, Ide.

4. Go: Quick is strong.

ADVANTAGES:

• Strong performance, close to C

• Co-generation support

• A simple deployment, one binary file completed

Disadvantages:

• Relatively young ecology

• There's a problem with mishandling

Who it's for:

• High performance services

• Micro-service architecture

• Cloud-based applications

One example of Go:

package main import ( "net/http" "encoding/json" ) func hello(w http.ResponseWriter, r *http.Request) { name := r.URL.Query().Get("name") if name == "" { name = "World" } result := map[string]string{"message": "Hello, " + name + "!"} json.NewEncoder(w).Encode(result) } func main() { http.HandleFunc("/api/hello", hello) http.ListenAndServe(":8080", nil) }

Simple and efficient, you know.

Node.js: The front end can dry backends as well

ADVANTAGES:

• JavaScript's full house, with the same language on the front end and back

• Acid IO, tall and friendly

• Eco-rich npm

Disadvantages:

• Less CPU-intensive tasks

• Rewinding the nest is easy to faint (although async/await is solved)

Who it's for:

• The front-end switch to the full house

Real-time applications (chatting, games)

• Rapid prototype development

An example of Express:

const express = require('express'); const app = express(); app.get('/api/hello', (req, res) => { const name = req.query.name || 'World'; res.json({ message: Hello, ${name}! }); }); app.listen(3000, () => { console.log('Server running on port 3000'); });

The front end is cordial.

6. Which one?

Newcomer entry: Python

Easy to learn, quick to get started, quick to see results.

Looking for a job: Java

Businesses are much more useful, have more jobs and learn to find jobs.

Pursuit of performance: Go

High performance scenes, micro-service architecture, Go is a good choice.

Front-end transfer to full-store: Node.js

The same language is used at the front and back end, and learning costs are low.

My Proposals

Start with Python, understand the basic concepts developed at the back end and learn other languages as required.

To summarize

• Backend languages have characteristics: Python simple, Java stable, Go fast, Node.js full-house

• Newcomers suggest starting with Python

• Choose different languages for different scenarios

6.3 Web Framework: Making Wheels Better Than Using Wheels

1. what's the Web framework?

The Web framework is a toolbox for you to do back-end work when you get a request from HTTP.

If there is no frame, you have to deal with it yourself:

• Resolve HTTP requests

• Routing Distribution

• Parameter validation

• Database connectivity

• Session management

• Mishandling

• ...

A bunch of things, tired.

With the framework, it's all done for you, you just have to write the business logic.

2. Common web frameworks

LanguagesFrameCharacteristics
PythonDjangoIt's big and it's full. Open it.
PythonFlaskSmall and delicate. Flexible and free.
PythonFastAPIQuick, automatically generate documents
JavaSpring BootEnterprise-class, powerful
GoGinLight and high performance
Node.jsExpressSimple and flexible
Node.jsKoaModern grace.

3. Django: Large and complete

Django is Python's "weight" frame, with a lot of features built up:

ORM (Database Operations)

• Back office management

• User certification

• Form processing

Ceacle

• ...

Suitable: Rapid development of a fully functional website.

One example of Django:

【views.py】

from django.http import JsonResponse def hello(request): name = request.GET.get('name', 'World') return JsonResponse({'message': f'Hello, {name}!'})

【urls.py】

from django.urls import path from . import views urlpatterns = [ path('api/hello', views.hello), ]

4. Flask: Small and delicate

Flask is Python's "lightweight" framework that provides only the most core features, others choose for themselves.

Fit: Small projects, micro-services, need for flexibility and customization.

One example of Flask:

from flask import Flask, request, jsonify app = Flask(__name__) @app.route('/api/hello') def hello(): name = request.args.get('name', 'World') return jsonify({'message': f'Hello, {name}!'}) if __name__ == '__main__': app.run()

5. FlastAPI: Fast and good.

FastAPI is a new star frame for Python. Features:

Powerful (fast than flask)

• Automatically generate API documentation

• Type tips support good

• Good asynchronous support

Suitable: modern API service.

One example of FastAPI:

from fastapi import FastAPI from pydantic import BaseModel app = FastAPI() class HelloResponse(BaseModel): message: str @app.get('/api/hello', response_model=HelloResponse) def hello(name: str = 'World'): return {'message': f'Hello, {name}!'}

Access/docs can also see API documents generated automatically. Comfortable!

To summarize

• The Web framework helps you with the bottom detail. You write business logic.

• Django's big and full, Flask's small and delicate, and Fast and Good Fast API

• Choosing a framework depends on project needs and personal preferences

6.4 Database operation: ORM or SQL?

1. what's an ORM?

ORM (Object-Renational Maping), Object Relationship Map.

Simply put, it is to operate the database with code, not to write SQL.

Without ORM:

import sqlite3 conn = sqlite3.connect('test.db') cursor = conn.cursor()

Write SQL Query

cursor.execute("SELECT * FROM users WHERE age > 18") users = cursor.fetchall() conn.close()

Use ORM (Django):

from myapp.models import User

Query with code

users = User.objects.filter(age__gt=18)

Without writing SQL, the database can be operated with Python code, much more visual.

2. Benefits of ORM

Code is clearer.

SQL is a string, not intuitive. The ORM is code, type-safe, and can be prompted by the IDE.

Cross-Database

Change the database, the code doesn't change. MySQL replaces PostgreSQL. Orm fixes it for you.

Prevent SQL injection.

ORM automatically handles parameters without worrying about SQL injection.

Increase efficiency

Operation of one line of code is done without duplicate SQL.

3. Shortcomings of ORM

Performance issues

The SQL generated by ORM may not be optimal and complex query performance may decline.

Learning costs

You have to study the grammatical and conceptual aspects of ORM.

Flexibility is poor

Some complex SQL, ORM can not write, still have to write native SQL.

4. Common ORM

LanguagesORM
PythonDjango ORM、SQLAlchemy
JavaHibernate、MyBatis
GoGORM
Node.jsSequelize、TypeORM、Prisma

5. Recommendations

Newcomer: With ORM

ORM is a simple intuitive view and can operate a database without learning SQL.

Step: ORM+SQL

Simple operations write SQL with ORM, complex queries.

Advanced: selected by scene

Performance-sensitive places, handwritten SQL optimization.

To summarize

• ORM lets you manipulate databases with code without writing SQL

• ORM Benefits: Clear, cross-database, anti-injection, high efficiency

• ORM shortcomings: possible poor performance, learning costs, poor flexibility

• New hand ORM, step ORM+SQL

6.5 User authentication: Who are you and what can you do?

1. What is user authentication?

User authentication is the solution to two problems:

Who are you?

What can you do?

Authentication: authenticate the user identity. For example, authenticate the username password when you log in.

Authorization: Assign permissions to the user. For example, the administrator can delete it, and ordinary users can only see it.

2. Traditional methods of authentication:

Process:

• After the login is successful, the server generates and saves Session

• The server returns Session ID through Cookie to the browser

• The browser follow request automatically carries this Cookie

• The server finds the corresponding Session ID in Cookie to authenticate user identity

• After successful verification, process the request and return the data

Where does Session exist?

Server memory, or Redis.

Disadvantages:

• Servers are stored in Ssession and shared on multiple servers

• Poor expansion

• Cookie is vulnerable to CSW attacks

3. Modern methods of accreditation: Token

Process:

• Login successful, server generated Token

• Server returns Token to client

• Client store Token locally (e. g. localStorage)

• Bring Token in Header next request

• Server authenticates Token and returns data through

The benefits of Token:

• Servers are not stored in Sesion, no state

• Natural support of multiple servers

• Capable of separation from the front and back ends

Most common Token: JWT

JWT (JSON Web Token) is the most popular Token format in the world.

What does JWT look like?

eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IuW8oOS4iSIsImlhdCI6MTUxNjIzOTAyMn0.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c

Looked like a mess. It's actually three paragraphs:

Header.Payload.Signature

• Header: algorithm information

• Payload: user information (user ID, expiry time, etc.)

• Signature: signature to prevent tampering

To summarize

• User authentication addresses "who you are" and "what you can do"

• Traditional Session, server status

• Modern Token (e.g. JWT), unstated and suitable for distribution

Summary of this chapter

In this chapter, we talked about the back end development thing:

Backend responsibilities: processing business logic, operating databases, providing interfaces, certifying authorizations, etc.

Backend language: Python simple, Java stable, Go fast, Node.js full house.

Web framework: Django is big and full, Flask is small and fine, and Fast and Good FastAPI.

Database operation: ORM makes the code clearer and newer recommends ORM.

User authentication: Session tradition, Token modern, JWT most popular.

Chapter 7: The cloud, the deployment and the transport.

Opening remarks

You wrote the code with AI and you ran well on your own computer. And?

Your friend wants to use it. What do we do? Send him the source code?

What if millions of people want to use it? It can't be done one by one, right?

This requires putting the program on a server so that everyone can access it over the network. This is "deployment".

Now it's popular. What about cloud?

This chapter, we talk about clouds and deployments.

7.1 "Cloud" isn't the best thing.

1. what's cloud computing?

The word "cloud", which sounds quite mysterious, is actually a server on the Internet.

Buy your own server and put it at home. You have to worry about a lot of things:

Buying hardware (costs)

Get a room.

Connecting to the network, distribution (totem)

Maintenance, maintenance (disturbing)

• Worry about power outages, grid outages, thefts...

"Cloud" is to hand these shits over to professional people. You just rent their servers.

Let's say:

• Formerly: purchase of generators for power generation (build your own office)

Now, use the power from the electricity department.

No need to generate electricity yourself, plug in the socket and there will be electricity, pay by the number of degrees. Don't worry!

2. What are the cloud service providers?

Luar negeri

ManufacturerDescription
AWS (Amazon)Big global boss, everything.
Azure (Microsoft)More enterprise users
Google CloudAI's strong.
Oracle CloudDatabase Strength

At the national level:

ManufacturerDescription
Ali Yun.Domestic boss, e-commerce gene
Tsing Tsing Yun.Game, social ecology.
Huawei CloudA lot of clients.
The 100-Double Clouds.AI Capabilities

Which one to choose? It depends on your needs. If there are many domestic users, choose domestic; if there is an overseas demand, choose AWS or Azure.

3. Three types of cloud services

Cloud services come in three tiers: Infrastructure as a Service (IaaS), Platform as a Service (PaaS), and Software as a Service (SaaS).

IaaS provides virtual computing resources, such as servers and storage;

PaaS provides a platform for developers to develop and deploy applications;

SaaS provides the user with the available applications directly.

These three layers constitute the core architecture of cloud services, which is abstracted layer by layer, enabling users to obtain corresponding services on demand.

Which one should you choose?

• Wanting to learn transport, seeking flexibility: IaaS (Cloud Server)

• Just write the code, not the environment: PaaS (Bound Platform)

• Only want to use the software, do not want to develop: SaaS (online software)

4. Mode of billing for cloud services

Cost-based

It's as much as paying for utilities.

• Advantages: flexible and ready to stop

• Disadvantages: It is more expensive to use for a long time than the annual package

• Suitability: ad hoc testing, unstable operations

Year round.

Buying access for a while, like renting a house.

• Advantages: long-term cost-effective

• Disadvantages: No need to spend money in the middle of the day

• Fit for: stable operations

Examples of bids

It is cheap but unstable to use the idle resources of the cloud vendor.

• Advantages: Cheap, maybe only 10% off

• Deficiencies: they may be recovered at any time

• Suitability: minor back-office tasks

To summarize

• Clouds is a computer that rents people's computers, saves the trouble of maintaining hardware.

• Ali, Tan, Hua, AWS, Azure, abroad

• Cloud services in three layers: Iaas (virtual machine), PaaS (platform), SaaS (software)

• Costing modality: fee-based, monthly, bid-based

7.2 Server: where the program resides

1. what's a server?

A server, to put it bluntly, is a computer that specializes in serving others.

Your computer is for your own use, and the server is for others -- people access it through the network, it provides services.

Difference between server and common computer:

Contrast itemNormal computersServer
UsePersonal useServices to others
StabilityIt's okay to reboot occasionally.Runs 7 x 24 hours
FeaturesIt's good enough.Be strong
NetworkNormal NetworkLines, bandwidth.
ShowMonitorMany without monitors (telemanage)
EnvironmentOffices, homes.Professional engine room

2. Type of server

Fracture by shape:

TypeCharacteristicsApplied scene
Tower ServerIt's like a big desk.Small businesses, offices
racked serversflat. It's a hanger.Data centres, large enterprises
Blade serverVery thin, high densityLarge-scale data center

By purpose:

TypeCharacteristics
Web ServerWebsites, Web applications
Database serverData storage, running database
File ServerSave files, make web disks
Apply ServersRun applications
Game ServerRun Game Server

3. Virtual and cloud servers

Few people now buy physical servers on their own, mostly renting virtual servers or cloud servers.

Virtual server (VPS):

Cut a physical server into multiple parts, each of which is a stand-alone "small server".

You rent one of them, like you have a server of your own.

Cloud Servers

It's higher than VPS. Resources can be flexible. Today, 2G memory. Tomorrow, they can go up to 4G.

You can also do advanced features like snapshot backups, autoscaling, load balancing, and more.

4. Server operating systems

The servers are mostly Linux, broken down into distribution versions such as Ubuntu, Centos and Debian.

Why don't you use Windows?

• Linux is free. Windows wants money.

• Linux is stable, not easy to fall

• Low use of Linux resources and RAM

• Linux command lines are strong and easy to manage remotely

• Linux open source, security breach repair fast

Of course, if your program can only run on Windows, it's gonna have to use Windows Server.

To summarize

• Servers are computers dedicated to other people and operate in a stable, high performance, 7x24

• Virtual or cloud servers are now mostly leased, not physics machines

• Multi-purpose Linux server system, stable and free

7.3 Deployment: Sending procedures to the battlefield

1. what's a deployment?

You wrote the program on your own computer, how can others use it?

We have to put the program on the server and let it run. That's deployment.

Deployment is like putting your program on the battlefield and making it truly service its users.

2. Basic Steps for Deployment

• Preparation of servers (purchase or use of cloud servers)

• Installation of the operating environment (Python, Node.js, etc.)

• Upload code to server

• Configure environmental variables and database connectivity

• Initiate procedures to test access

• Configure domain names and SSL certificates

3. Connecting the server

Buy the server, how do you operate it? Use SSH.

What's SSH?

SSH is a secure remote access protocol.

You're home, you can use SSH to operate the server remotely, just like you do your own computer.

How?

Windows:

Use the PuTTY or Xshell tool. The steps are as follows:

• Download and install PuTTY

• Open PuTTY

• Enter the server IP address

• Point Open

Enter username (usually root)

• Enter password

Mac/Linux:

Use the terminal. Execute the command:

ssh root@服务器IP

Then just enter the password.

After the connection, you can knock on the command operating server at the terminal.

4. Upload code

How does the code get to the server?

Motion 1: Git

It's the most recommended way. What's Git? We'll talk later.

Your code is hosted on GitHub or Gitee, and the server pulls it down with git clone.

git clone https://github.com/yourname/yourproject.git

Mode II: FTP/SFTP

Uploads like an operating file manager using tools such as FileZilla.

Mode three: SCP

Use the command line to pass the file.

scp -r 本地文件夹 root@服务器IP:/目标路径

Mode IV: Specialized transportation systems

For example, the pagoda panel. It's a web service installed on a server, dedicated to a server, and uploading the code is the easiest thing to do. We'll talk about it later.

5. Commencement of proceedings

The code's on. How do we run it?

Answer: Execute the command at the server terminal.

Simple mode: Direct run

python app.py

But there is a problem: you turn off the terminal, and the program stops.

A better way: backstage running.

nohup python app.py &

So shut the terminal down and the program's still running.

A more professional way: with Process Manager

♪ With supervisor or pm2 ♪

pm2 start app.py

The process manager can help you monitor the program and the program is automatically restarted.

Most professional way: use systemd

Write a service file that lets the operating system manage your programs.

【/etc/systemd/system/myapp.service】

[Unit] Description=My Application After=network.target [Service] User=root ExecStart=/usr/bin/python /path/to/app.py Restart=always [Install] WantedBy=multi-user.target

Then:

systemctl start myapp # 启动 systemctl enable myapp # 开机自启 systemctl status myapp # 查看状态

6. Domain names and HTTPS

The IP access is so ugly that it needs to be given a domain name.

Buying a domain name

The blogger says that it is not possible to buy it on the basis of the information provided by the media, but also on the basis of the information provided by the media.

A few dozen cheap dollars a year, hundreds of thousands of expensive.

Domain Parsing

You buy a domain name, you have to point it to your server IP.

You want to add a parse record to the domain name management backstage of the domain name server:

Record TypeHost logsRecord value
A@Server IP
AwwwServer IP

In this way, example.com and www.example.com will point to your server.

Configure HTTPS

Now HTTPS is marked. Without a small green lock, the browser will warn.

How do you get the HTTPS certificate?

• Free of charge: Let's Encrypt, automatically issued, automatically updated three months ago, and set up without care.

• Fee: Alibaba Cloud, Tencent Cloud and other platforms have certificates for sale, with higher credibility and more features.

Configure certificates with Nginx:

server { listen 443 ssl; server_name example.com; ssl_certificate /path/to/cert.pem; ssl_certificate_key /path/to/key.pem; location / { proxy_pass http://127.0.0.1:8000; } }

To summarize

• Deployment is the placement of a program on a server so that it can be accessed by others

• Step: purchase of servers — company servers — environment — code transfer — startup program — domain name — surveillance maintenance

• Connect the server with SSH, upload the code with Git and manage the program with systemd

• Domain name resolution points to IP, configuring HTTPS certificates

7.4 Docker: Pack the environment and take it away

1. Unsymmetrical distress

You can't run off on the server with the program you wrote on your computer.

Why? The environment is inconsistent.

• Your computer is Python 3.10 and your server is Python 3.8

• Your computer has version 2.0 of a certain library and the server is version 1.0

• Your computer is Ubuntu and your server is Centos

These differences can cause the program to run poorly or behave inconsistently.

That's the classic question about running on my machine.

2. what's Docker?

Docker solved the problem.

Docker put your program and all the environments it needs in a container.

The container can run on any computer because it has all its dependence on it.

Let's say:

• Normal deployment: you move to your new home and buy furniture

• Docker deployment: you drive a motorhome, it's that environment wherever you go

The core concept of Docker:

Docker is a container technology that packages a program + runtime environment into an image.

Mirrors can run on any machine, and running mirrors are called containers.

The container is separated from each other.

3. Basic use of Docker

Install Docker

Download installation on the website: https://www.docker.com/

Windows and Mac have desktop versions and Linux is installed by command.

Pull the mirror.

docker pull python:3.10

This will download Python 3.10 mirrors from Docker Hub.

Run Container

docker run -it python:3.10 bash

This will activate a Python 3.10 container and enter the bah.

View Containers

docker ps # 查看运行中的容器 docker ps -a # 查看所有容器

Stop the container

docker stop 容器ID

4. Benefits of Docker

Environmentally consistent

The development, testing, production environment is exactly the same. There's no more question of running on my machine.

Fast deployment

An order can be activated without setting the environment up every time.

Isolate Runs

Multiple programs do not interfere with each other. You use Python 3.8, I use Python 3.10, and each container runs separately.

Facilitation of migration

Containers can be easily migrated to other servers and packed away.

Version Management

Mirrors can be labeled, versions can be easily managed. Problems can roll back quickly.

To summarize

• Docker resolves environmental inconsistencies by packing procedures and environments into containers

• Core concepts: images (templates), containers (running instances), warehouses (where mirrors are stored)

• Dockerfile is the formula for the mirror.

• Docker makes deployment simpler and more reliable

7.5 Operation and maintenance: Let the program run steadily

1. what's a transporter for?

It's done, it's done. You have to make sure it keeps running. Just stay put.

The conveyance is to maintain the steady operation of the program.

Including: monitoring program status, handling failures, backing up data, updating versions, optimizing performance, security...

2. Two ways of operation and maintenance

Option 1: Command line (hardcore pie)

Connect to the server with SSH and tap on various Linux commands.

• View log: tail-f /var/log/nginx/access.log

• View process: ps aux grep python

• View disk: df-h

• View memory: free-m

• View the Web: netstat-tul

This method is flexible, but the threshold is high, and it is easy to type the wrong command to crash the server.

Mode II: Graphical panels (Longer Group)

Use the Web interface to operate the server, as simple as Windows.

The most popular is the pagoda panel.

3. Core tasks of the Operation

Surveillance

You have to know how the program is running.

• Monitoring CPU, memory, diskette, network: see if resources are enough

• Monitor service status: see if the program is running

• Monitoring logs: see if there is a mistake

• Monitoring of access: to see if operations are normal

The pagoda panel has a monitoring function and can also use specialized monitoring tools (e.g. Prometheus+Grafana).

Backup

Data is priceless and must be backed up regularly.

• Backup code: Git has version management in itself, but it would be better to pack it elsewhere

• Back-up database: automatically export SQL files on a daily basis and store them to object storage or another server

• Back-up files: images, documents, etc. uploaded by users

The Towers can set up planned tasks and back up websites and databases on a regular basis.

Update

Procedures are updated regularly to address gaps and add functionality.

• Code update: Git pull pulls the latest code

• Reliance on updates: pip install-r updates.txt-upgrade

• System update: yum update or apt update

You have to back up before the update, and the test's on the line.

Security

Server security is important. Don't get hacked.

• Change SSH default port (22 to other)

• Login with key, without password

• Firewalls open only necessary ports (80, 443, SSH ports)

• Regular updating of system patches

• Install security software (e.g. fail2ban)

• Pagoda panel changed to default port (8888 changed to something else), strong password

4. Recommendations for means of transport

• Tower panel: Web management panel, newer friendly

• Prometheus+Grafana: professional surveillance, good drawings

• Jenkins: automated deployment, code submission for automatic build release

• Ansible: batch management of multiple servers

• ELK/EFK: Log collection and analysis

5. The pagoda panel: the Avatar

What is the pagoda panel?

A Web management panel installed on the server allows you to manage the server without knocking on the command.

Like putting a "desktop" on your server, you can do most of the work by clicking the mouse.

Why recommend the pagoda?

• Free editions have sufficient personal and team functionality

• Graphical operation without orders

• One-key installation environment (Nginx, MySQL, PHP, Python, etc.)

• One-key deployment of website, FTP, database

• Visualize file management, like an operational web disk

• Monitoring of CPU, memory, diskettes, networks

• Security protection, firewall configuration

• Planned tasks, back-up management

How do we install the pagoda?

Connect to the server (SSH) and execute one line of command (CentOS example):

yum install -y wget && wget -O install.sh http://download.bt.cn/install/install_6.0.sh && sh install.sh

Once installed, the panel address, username, and password will be displayed. To change your password now, remember it.

How do you use the pagoda?

1) Browser open panel address (e.g. http://IP of server: 8888)

2) Enter username login

3) First login recommends installation of environment packages (LNMP or LAMP), ticking of required software, one-click installation

4) Once the installation is complete, the website, the database, the files can be managed on the panel

Pagoda's Core Functions

• Website management: addition of website, configuration of domain names, SSL certificates (one-key application for Let's Enter certificate), pseudo-statistical, reverse agent

• Database management: create databases, users, import and export SQL files

• File management: upload and download files, edit code online, modify permissions

• Software store: one-key installation of WordPress, Discuz, Node.js, Redis, etc.

• Security: firewalls, SSH port modifications, IP blacklists, wooden horse scans

• Monitoring: real-time access to CPU, memory, diskette, network traffic

• Planned tasks: timed back-up of websites, databases, implementation scripts

• Logs: view website access logs, error logs

The pagoda's strengths and weaknesses.

ADVANTAGES:

• Substantially lowering the wiring threshold and ease for newcomers to manage servers

• Fully functional, covering most of the daily requirements for the transportation of the support

• Visual operation, high efficiency, not easy to make mistakes

Disadvantages:

Use server resources (RAM, CPU)

• Security risk (web panel is vulnerable to attack, change default port, strong password)

• Too much reliance on dashboards, which is not conducive to learning Linux commands

To summarize

• The conveyance is to keep the program steady, including surveillance, backup, updates, security

• The pagoda panel is a vehicle of the God, a graphical operation, and a newer can easily manage the server

• Core tasks: control resources, regular backup, security protection, updates

• Tools: pagoda (daily management), Prometheus (monitoring), Jenkins (automated)

Summary of this chapter

In this chapter, we talk about clouds and deployments:

Cloud computing is a computer that rents people’s computers and does not need to maintain hardware.

Servers are computers that are used for other people’s services. They need to be stable and high-performance.

Deployment is placing a program on a server so that others can access it. Step: Buy the server→ with the environment→ and transmit the code→ to→ start the domain name→ monitoring.

Docker packages programs and environments to solve the problem of "running on my machine" and make deployment easier.

It's a job to ensure that the program is running steadily. The pyramid panel is a Web-management interface that allows you to install software, manage websites, watch surveillance with mouse points, and significantly lower the threshold for server-wire transportation.

You understand clouds, deployments and carriers so that you can actually use the code that AI writes, so that others can access it.

The next chapter, we're talking about AI and the big language model.

Chapter 8: AI and the Large Language Model

Opening remarks

In the previous chapters, we talked about hardcore topics such as computers, programming, data, networking, front-end, back-end, and deployment.

Now, it's finally AI's turn.

You're probably already writing code in AI -- in ChatGPT, Claude, in writing or something. You find AI writing code, explaining code, looking for bugs, it's good.

But have you ever thought about these questions:

How does AI really work? Does it really “understand” the code? Why is it sometimes so smart and sometimes so stupid? What's the difference between a big language model and an AI before?

In this chapter, let's nag about AI and big language models. No formulas, no profound learning, just listen to the story.

8.1 What's AI like? What's different from the traditional program?

1. what's an artificial intelligence?

Artificial Intelligence, or AI for short. Listen tall, to put it bluntly: let the machine do something that requires the human brain to do.

You know, writing, drawing, talking, translating, playing chess, driving, writing codes... these things were used to be done only by people. Now the machine can do it, and that's AI.

But the word 'smart' is easy to overthink. A lot of people (including Assad) think AI is conscious, thinking, and emotional - but that's probably a lot to think about. When you ask him to program, it's best not to think like that.

Arsène, for example:

You have a dog that sits down, shakes hands, rolls. You think it's "human." But do you really think it has the ability to think philosophically? No. Does it change procedure? No.

The same is true of the current AI -- it's acting like it's thinking, but it's essentially a super-complicated "strange machine." Whether AI has any idea or no feelings, it's better to be treated as a machine when you program it.

2. Turing Tests: How do you know that the opposite is a machine?

In 1950, the English mathematician Alan Turing put forward a test: if a person talks across the board and the person cannot tell from the other, the machine passed the Turing test.

It's actually a very philosophical question: what do you mean, "think"? If you act like you're thinking, do you think?

By 2025, 2026, you opened an AI chat, and it's almost impossible to distinguish between people who are machines. Especially those big language models, they're much higher than they were supposed to be.

But there is a question about the Turing test: it tests whether you can be deceived or not, not whether there is a real understanding.

It's getting a little deeper. We'll call it a day.

3. Distinction between AI and traditional procedures

Traditional program: The programmer writes the rules, the computer follows the rules. Enter A, calculate B by the rules. Everything is expected by the programmer.

AI Programs: The programmer does not write specific rules, but rather lets the program “learning” from the data. Enter a list of examples, and the program itself draws the pattern.

Let's say:

Traditional procedure: You write a detailed recipe for your child, writing it out every step of the way - “Beat the egg in a bowl, stir it 30 times…” The child does just that.

AI Program: You show the kids 1.000 videos of tomato-fried eggs, and the kids figure out, "Oh, that's probably what it is," and play it themselves.

Can you see the difference?

Traditional programs are highly deterministic - the same input, always the same output. AI is “creative” - the same prompt that may give you a different answer each time.

The traditional procedure is so well calibrated -- you can go after the logical chain for bugs. AI is the black box -- it gives you an answer, but it's not clear how it comes from.

4. Mechanical and in-depth learning

Machine learning (Machine Learning, ML) is a branch of AI. Core idea: no rules, lets the program learn from data.

Deep Learning is a branch of machine learning. It uses the "neurological network" to learn, which is multi-layered and multi-parametered, so it's called "deep."

What is a neural network? To put it bluntly, it is to imitate the neuronal structure of the human brain. The human brain has tens of billions of neurons connected to each other. An artificial neural network is a simulation of this structure - using digital "neurons" to transmit information layer by layer.

The Large Language Model (Large Language Model, LLM) is a large model based on in-depth learning, specialized in languages. It is the latest in the field of in-depth learning in natural language processing.

Their relationship is as follows:

AI (Maximum) Machine learning (subset) In-depth learning (subset) Large language model (subset)

You now use ChatGPT, Claude, General Inquisition, Words, all of which are part of the larger language model.

To summarize

• AI's a brain-braining machine.

• The Turing test is "Doesn't look like a human being" and "Doesn't have consciousness"?

• Traditional procedures rely on rules and AI programmes on data learning

• Machine Learning→ Deep Learning is a→ larger language model than a specific concept

8.2 How do large language models work?

1. What does the "big" of a large language model mean?

Large language model, the key is "big" and "language".

Let's start with the “big”: the previous AI model was small, and tens of millions of dollars were big. Now, the LLM, it's a multi-billion or even trillion parameter. The GPT-4 is said to have 1.8 trillion.

What are the parameters? You can understand it as a model's memory cell or knob. Each parameter is a adjustable number, and the model is based on billions of such numbers to "remember" what it learned.

The more parameters, the more complex and sophisticated the pattern that the model can remember. But not all parameters are good — high training costs, slow running, easy to “mortality back”.

Again, "Language": These models are language-specific. They read text in volumes, learning language patterns, knowledge, logic, and even a certain degree of common sense.

2. Predict the core gameplay of the next word

The core gameplay of the big language model is so simple that you can't believe it:

Give it a text that allows it to predict the next most likely word.

As simple as that.

For example, you type in, "It's a real day," and the model predicts that the next word is probably "good" or "good" or "hot."

Then the model takes the predicted words and goes on to predict the next one: "It's a nice day" → Predicting → "ah" "It's a nice day" → Predicting → "," It's a nice day "→Predicting" me "→...

The entire dialogue process is "squeezed" out of such a word. It looks like you are thinking, but you are actually doing a high-speed "guessing game".

You might say, "Isn't that a high-level input method?

Yeah, that's right. But this input method looks at the entire Internet data (in trillion words), so it's very good at guessing, and it looks like it really understands.

When this "guessing game" is extreme, the guessing content is no longer a simple word, but a paragraph of logical, knowledgeable, and even seemingly thoughtful words.

3. Training and reasoning

Large language models have two phases: training and reasoning.

Training phase:

Use big data (languages on the Internet — web pages, books, papers, codes, dialogues ) for models, allowing models to practice “conjectures”.

Wrong guess, the model adjusts its parameters (the tens of billions of knobs) to make it more accurate next time.

This process requires great computing — tens of thousands of GPUs running for several months at a time with tens of millions of dollars in electricity.

Logic stage:

A trained model can be used to answer questions. You send a hint to the model, the model runs once, and the answer is out.

The reasoning does not need to be so great that a piece of GPU, or even CPU, can run (of course slower).

Every time you talk with ChatGPT or Claude, you're doing a line of reasoning -- the model produces a word-by-word answer based on your input.

4. What the hell is Token?

You may notice that the AI chat interface sometimes shows either "X tokens" or "maximum token limit" for hints.

Token is the basic unit of text processing for large language models. It is not " word " or " word " , but a more flexible segment.

For example: "It's a nice day" may be divided into ["today", "weather", "nice"] three tokens, or it may be divided into ["today", "weather", "true", "good"] four tokens.

The English version of “I love progressing” may be divided as follows: [I, “love”, “pro”, “gramming”).

The word segmentation methods of different models are different, but roughly follow the principle of "common words are completely retained, and unusual words are broken into small pieces".

generally speaking

• One Chinese hyphenate 1 to 2 token

• One English word 1-2 token

• 1000 tokens ≈ 750 English words, or about 500 Chinese characters

Understanding the Token concept is important because:

AI has contextual window limits (e.g. 8K, 32K, 128K token) that go beyond what is “unrememberable”.

The bill is also token-based, and the input output is expensive. So the length of the matter directly affects the wallet.

5. Illusion: Why does AI talk nonsense?

You can see with more AI: AI sometimes gives completely wrong information with particular confidence.

You ask it, “Who is the 2025 NBA champion?" It might give you a damn good answer - the names of the players, the scores, the MVPs - but it's all made up.

That's "hallucination."

Why? Because the model is essentially a "probation game." The rule it learns is, "When asked questions about XX, the usual answer format is XXX." So it produces content in this format.

But it doesn't “know” what the truth is. It has no knowledge base, no databases, only the statistical patterns that are learned from training data.

So:

• AI is not necessarily right — always checking.

• AI is more confident and careful - it doesn't have the concept of “uncertainty”

• The code is also tested — the code that AI wrote may seem right, but it runs wrong.

To summarize

• The “large” meaning of the large language model refers to a large number of parameters, while the “language” refers to text processing

• Core game: predicting the next word, generating answers in one word

• Training requires big data and arithmetic, and the reasoning is daily use

• Token is the basic unit of AI for text processing, affecting the length and cost of context

• The illusion is that AI will be confident and confidant and learn to verify

8.3 Common large language models

1. Foreign players

ChatGPT / GPT-4 / GPT-4o(OpenAI)

In the A.C., it was released in late 2022, and the wave of AI was triggered. The GPT-4 and GPT-4o are powerful, supporting text, pictures, audio multimodels.

Accomplishments: Capable, ecologically sound, multi-plugged. Accomplishments: expensive, in-country visits are not easy.

Claude(Anthropic)

Founded by former OpenAI employees with a focus on 'safety' and 'reliability'. Claude has a good reputation in programming, a huge context window (200K tokens), and is very good at writing long articles and analyzing large projects.

Accomplishment: high programming capacity, long context, and secure. Accomplishment: less visible than ChatGPT.

Gemini(Google)

Google's AI model is integrated with Google's ecological depth. It's multi-module, it handles videos, pictures, text.

Advantages: Good integration with Google products. Weaknesses: A bit of a mess with updates, lots of versions.

There are also Llama (Meta open source), Mistral (French open source), etc., so it will not unfold here.

2. Nationalists

General Question (Ali)

Produced by Ali, the comprehensive ability is good, and there is an open source version. Integrate with Alibaba Cloud, DingTalk, and more.

Words (100 degrees)

Produced by Baidu, based on the Wenxin model. Strong understanding of Chinese, open up with Baidu search, library and other products.

Ideas clear (AI / GLM)

Tsinghua-based startup, GLM model. It has a good reputation in academia and industry, as well as an open source version.

Bean buns (bytes beat)

The bytes jump out of the product and are integrated into the product of tremors, flying books, etc. Users experience well.

DeepSeek

China’s Light! The main focus is on reasoning, code writing and in-depth thinking, the strength of the field of expertise, the ecological integrity of open-sources, long text processing, digital comprehension issues, and engineering performance, which is highly favoured by technology developers and the professional population.

There's a lot of big models in the country. They're different.

3. Which one is it?

There's no "best" model, only "best fit" for you.

Write code: Claude and ChatGPT are good, and many programmers think Claude is more solid.

Daily questions and answers: There is not much difference between each one, so pick one that is handy.

Support in Chinese: Domestic models are usually better in Chinese.

Networking required: Both ChatGPT and domestic models have networking options.

Value for money: Try domestic models, many have free credits or are very cheap.

A Chinese proposal: Do not bother, take one first. Change it after you've done it, but it's not very expensive.

[Note ] About Claude:

Speaking of Claude, it's easy to confuse two meanings.

Anthropic, a company with two products, is the Claude Language Model and Claude Code programming environment, which is an intelligent body.

We can't use Claude's large-language model because it's controlled.

Claude Code, as a smart body and programming environment, can be used and can be supported by models in large languages in the country.

It's the Claude Code + (Kimi Code or DeepSeek), which is used in the programming and editing of this book. It feels good.

The chapter VIII that you are seeing is actually the last temporary addition of Assai.

I ask Claude Code to insert Chapter 8 and follow the format of the original book.

And it did it the way it was. It did it very well. There were two main reasons for that: Claude Code, the smart body, was really great; and DeepSeek was very good at it as a big model.

To summarize

• Mainstream abroad: ChatGPT, Claude, Gemini

• National mainstream: DeepSeek, General Inquiries, Words of Letters, Wise Perspectives, Bean Bags

• Write code recommendations for DeepSeek, Kimi Code, Claude, ChatGPT

• There is no best, only the best fit, use it before adjusting

8.4 Chat with AI: The lessons of the hint

1. what's a hint?

Prompt is what you say to AI. You tell AI what you want, AI answers from this.

Don't underestimate the cue. In the same AI, the prompt words are well written, and the quality of the answers varies greatly.

That is more than you speak to a super smart, completely unmindful assistant — the clearer you say, the better he does; you are vague, and he guesses.

2. Basic techniques for writing instructions

Number one: Say what you want.

Bad way to ask: "Write a program for me."

Good question: "Help me write a calculator program with Python, support additions and subtractions, command line interactive, user input two numbers and operators, output results."

Second: Set the role.

Let AI play a specific role, and the answer will be more professional. "You are a senior Python developer, please help me review the code below..."

Third: Give me an example.

You want AI to produce a format, give it an example. It'll follow your format.

Fourth: Step by step.

Don't throw all the complicated tasks to AI. Let it be the first step. Check it out before it's the second step.

Fifth: AI is required to think step by step.

When you have a logical problem, insert the words “please think step by step” or “Let's think step by step”, and the quality of AI's response usually improves considerably.

3. Step-by-step techniques

Use System Tip Word: Some AIs (e.g. Claude, ChatGPT) support setting the System Hint, which is equivalent to giving AI a "background setting" to answer in this style from the beginning to the end.

The context of the dialogue is managed: AI remembers the content of the current dialogue, but it does not remember the other. So, when it comes to complex issues, it stays in one dialogue and does not open a new one.

File uploading: Many AIs now support uploading pictures, PDFs, code files, etc. Direct uploading files makes it easier to analyse than to paste.

Tools: AI can call plugins, search web pages, run codes, etc.

Don't treat AI like a god.

Although AI is strong, it's not almighty. You have to know the bottom line:

AI doesn't understand the code, it just sees a lot of it. "like" is not equal to "yes."

AI goes wrong, and sometimes it goes wrong. Always stay alert.

AI does not have a privacy concept. Do not send AI sensitive information such as passwords, keys, ID numbers, etc.

AI has a cut-off date for knowledge. It doesn't know what happens when it's trained.

It's important to think of AI as a “smart but less reliable assistant”, not as a “God Almighty”.

To summarize

• The more you speak to AI, the better it is.

• Basic skills: clarifying needs, setting roles, giving examples, step by step, requiring step by step thinking

• Advanced: system prompts, context management, file uploads, tool usage

• AI is not a fairy, it's a mistake, it's not private, it's an intellectual deadline.

8.5 The correct position of AI programming

1. What can AI do for us?

AI programming is now the daily routine of many programmers. It can do a lot:

Write code: Affordable from zero, write test, write script, and an AI can do it.

Explanatory code: The code that you can't read is thrown to AI to explain. Faster than checking your files.

Look for bugs: Posting the wrong message to AI, it helps you to locate the problem.

Reconfigure the code: let AI help you to optimize the code structure and improve readability.

Writing documents: Auto-generated notes, README, API documents.

Learn new things: I want to learn new technologies, new languages, so AI can be your private teacher.

More importantly, AI programming has significantly lowered the programming threshold. There is no need for syntax, no need for API, no need for detail, you just need to know what you want, and AI helps you do it.

2. AI can't do what?

Understand the boundaries of AI to make good use of AI:

AI can't guarantee correctness. It says the code looks right, but it's not necessarily true. Tests and reviews are still up to you.

AI doesn't understand business needs. You tell it to be a power provider website, and it actually writes one for you. But is business logic correct? Is it in line with your business model? It's up to you to judge.

AI cannot make architectural decisions. What database to use, how to split the service, whether to use microservices... these are up to you. AI's advice can be listened to, but not copied.

AI can't deal with what you don't have clearly described. You give a vague hint, it gives you a vague answer -- it looks right, but it's a little bit too close.

AI is not good at version upgrading, relying on conflict, setting up these “dirty jobs”. These are people.

3. How do you program with AI?

I summarized a few lessons:

Number one: Think it over before it's written by AI.

Don't let AI write the code as soon as you get up. You have to figure out what you want -- functional needs, input output, border conditions. Think about it, AI writes the code.

Article II: Dismantling of tasks, breaking one by one.

Don't let AI write a thousands of lines of program at once. Break it down into small tasks: write user logs, write a merchandise show, write a shopping car... every step of the way.

Article III: Review of the AI code.

AI wrote the code, you have to read it. Let the AI explain it to you. Don't use it if you don't understand.

Article 4: Learning to ask the right questions.

"Help me write a script for downloading a file in Python" -- let's say, "Help me write a script for downloading a file in Python, download from URL to local specified directory, support progress, support intermittent transmissions."

Article V: Keeping the equations.

AI writes the first edition, you check, test, and you give it back to AI for changes. A couple of rounds, the code quality goes up.

4. The future of AI programming

A lot of people are worried: is AI so strong that the programmer is going to lose his job?

According to the Chinese view, programmers are not unemployed, but “programmers who only write codes” may be eliminated.

In the AI era, programming thresholds were being lowered, but the ability to “solve problems” was more important.

Before: You have to understand grammar, algorithms, API to write codes.

Now: All you have to do is know what you want. AI writes it for you.

Future: The ability you need is no longer 'how to code', but:

• “What to do” — capacity to analyse and dismantle demand

• “Is it right to do so” — the ability to judge and review AI output

• “What to do if there is a problem” — error and Debug's ability

• “Is it better” — capacity for optimization and replication

In other words, the work of programmers has changed from "skilled labor" to "mental labor + skilled labor", which requires higher comprehensive capabilities.

The good news is that people who don't know how to program can use AI for basic development. This is a huge liberation for non-technicals.

To summarize

• AI can write codes, explain codes, find bugs, reconstruct, write documents, be a teacher

• AI cannot guarantee correctness, understanding of business, and cannot substitute for structural decision-making

• Make good use of AI: think clearly first, break down tasks, review code, ask the right questions, keep iterating

• Programmers will not be unemployed, but the required competencies are constantly being upgraded

8.6 OpenClaw and lobsters of all kinds

1. what's lobster?

The most recent fires of all kinds of lobsters are essentially AI smart body frames.

OpenClaw is an open-source general-purpose agent framework and the originator of all lobster products.

It can manipulate computers, identify interfaces, perform all kinds of computer operations automatically, and put eyes and hands on AI, not limited to chatting, and can actually perform the tasks of a locally operated computer.

So it's also very dangerous. When using it, pay attention to security issues such as personal information, privacy, confidential matters, and property.

The tools with the Claw suffix on the market, commonly known as lobster tools, are currently being developed by major Internet companies, setting off a "shrimp farming" boom.

2. Other lobster products

Ali QwenPaw:

The first draft of the book was prepared by QwenPaw.

Its predecessor, CoPaw, is the first home-grown intelligent body developed on the basis of OpenClaw, with depth adapted to the universal multidisciplinary model, focused on local deployment, data security, simple operation and low threshold of upper hand, inclined towards day-to-day office, simple automation, and the most popular entry-level lobster.

WorkBuddy:

The desktop-smart lobster tool, launched by the Quest, is in depth aligned with the micro-letters, the Quaker Office Ecology, the main office automation, documentation, daily support, the domestic office setting, the Quest-wide software, and office compatibility.

AutoClaw:

The main key is local installation, open the box, with a large number of ready-to-use skills built up to match zero basic users, inclined to content creation, simple batch operations, with a high level of generality, and capable of doing so without complex configurations.

Other common lobsters:

In addition to this, there are similar intellectual tools such as 100-degree red fingers, HiClaw, etc., which are produced by big factories such as bytes, centimeters, and 100-degrees.

3. lobsters aren't suitable for AI programming?

To put it straight: the vast majority of lobsters are not fit for professional AI programming.

The advantage of lobsters is that they are universal, capable of carrying out desktops, processing documents and performing simple automation tasks, but the shortboards are also obvious: inadequate programming professionalism, poor code logic, low fitability of complex projects, and prone to redundant codes, logical loopholes, or even mis-deleting documents and misdirection of instructions.

They are general-purpose, not tailored for programming.

4. How do you choose tools for programming?

Write code, develop, and do not blindly follow the wind with lobsters of all kinds.

Programming is best done by selecting a specialized programming intelligence.

These specialized tools focus on the code scene, fit with development logic, are more accurate in syntax and bug screening, support project re-engineering, engineering optimization and code debugging, and are more focused on programming scene depth optimization than common lobster.

Summary: lobsters are suitable for play, office automation, simple chores; professional programming development, with priority given to specialized programming AI, and not to mix common lobster tools.

Summary of this chapter

In this chapter, we talked about AI and the big language model:

AI is a tool for the machine to carry out its intellectual work, and in essence it is a “story-seeking machine” rather than a “thinker”.

The core of the big language model is to predict the next word, which is trained on massive data and huge computing power.

LLM has a lot: ChatGPT, Claude, Gemini, DeepSeek, General Inquisition, Words, Bean Bags, each with its own characteristics.

Prompt words are the key to communicating with AI. The clearer you say them, the better the AI will do.

AI programming is powerful, but it's not all-powerful. You have to check it, judge it, change it.

Lobster is a powerful intelligent body, but it is not necessarily suitable for AI programming.

You learn this, you can use AI more easily than it can take it with it.

The next chapter, the thing about us talking about programming tools.

Chapter 9: The thing about programming tools

Opening remarks

In the previous chapters, we covered the concepts of computers, programs, networks, deployment, and operation and maintenance. In this chapter, we will nag programming tools.

If you want to work well, you have to use your tools. The tools are chosen and the environment is set, so that you can write the code.

This chapter, we talk about what tools you need, how you choose, how you use them.

9.1 What's the programming environment?

1. what's the programming environment?

The programming environment is where you write and run code.

Composition of the programming environment:

• Operating systems: Windows/Mac/Linux

• Operating environment: Python/Node.js/Java et al.

• Editor: VS Code/PyCharm et al.

• Command line terminal: Terminal

• Version control: Git

• Debug and analysis tools: IDE built-in debugger/Chrome DevTools/pprof, etc.

2. How's the environment?

Different languages, different projects, different environment configurations. But the general steps are:

Step 1: Install the operating system

If you're a rookie, use Windows. A familiar interface.

If you want to study further programming, you can try Linux or macos.

Step 2: Install and run the environment

In the language you will learn, install the corresponding operating environment:

Go to the official website to download the installation package, all the way to the next step, it is very simple.

Step 3: Install the editor

It's recommended to VS Code, free, plug-in, cross-platform, with newer hands.

Step four: installation of Git

Version control is necessary and will be detailed later.

Step 5: Install Package Manager

Python carries a pip, Node.js a npm, which is usually not installed separately.

3. What are the environmental variables?

When installed, the operating environment is sometimes configured.

What's the environmental variable?

Environment variables are global variables that are logged by the operating system and are read by the program at runtime.

The most common scene:

You have Python installed, but the command line input python prompt cannot find the command.

Why? Because the operating system doesn't know where Python is.

You need to add Python's installation path to the PATH environment variable to the operating system to find it.

How Windows allocates environment variables:

• Right-click this computer Properties

• Click Advanced System Settings

• Click on the environment variable

• Found Path in System Variables, click on Editor

• Click to create a new one, add a path

• Determine the course and reboot the command line.

How does Mac/Linux fit?

Edit ~/.bashrc or ~/.zshrc files:

export PATH="/path/to/python:$PATH"

Then:

source ~/.bashrc

To summarize

• Programming environment includes operating systems, operating environments, editors, command lines, etc.

• Installation steps: system — operating environment — editor — Git — package manager

• Environmental variables tell the operating system where the program is, sometimes manually configured

9.2 Code Editor: Why is VS Code so hot?

1. what's the code editor?

The code editor is the software for writing the code, like writing a document in Word, writing the code in an editor.

You might ask, "Can't the notebook write the code?"

Yes, but too primitive. There was no grammar highlighting, no smart tips, no auto-completion... the writing was exhausting.

The code editor is optimized for writing codes and has a variety of sweet features.

2. Common Editor

Notepad: comes with the system, nothing

Notepad++: lightweight, only Windows version

VS Code: The most hot, free source

Sublime Text: Lightly fast, chargeable

Vim/Emacs: veteran editor, steep learning curve

3. Distinction between IDE and editor

You may have heard of the IDE (Integration Development Environment).

Editor: The main function is to write code, lightweight, flexible. The plugins are rich, what you want.

IDE: The function is more comprehensive and is integrated into editing, debugging, editing, running, etc.

Which one?

• Beginner: VS Code, lightweight and easy to use

• Python Development: VS Code or PyCharm

• Java Development: IntelliJ IDEA

• Frontend development: VS Code

Don't want to do it: IDE.

4. VS, why is Code so hot?

Free open source

Microsoft comes out, it's free, and it's open-source.

Plug-in Rich

Plugins, theme plugins, functional plugins, whatever they want. Plugins are also called extensions.

Popular Plugins:

• Python: Python Plugin (MSC)

• JavaScript/TypeScript: ES7+React/Redux et al.

• Git: built-in Git support

• AI programming: synonyms, GitHub Copilot, Claude Code, etc.

• Chinese: Chinese language kit

Cross Platform

Windows, macos, Linux can be used and experienced consistently.

5. How do you use VS Code?

Installation: download the installation package on the official web.visualstudio.com, next step.

Basic use:

• Open folder: File OpenFolder

• New document: Ctrl+N

• Save file: Ctrl+S

• Open terminal: Ctrl+` (inverse quote)

• Install the plugin: click the extension icon on the left, search for the plugin, click Install

Common shortcut keys:

• Ctrl+Shift+P: Open command panel

• Ctrl+P: Quick Open File

• Ctrl + `: open terminal

• Ctrl+Shift+`: New terminal

• Alt+: move current line

• Ctrl+/: Comment / Cancel Comment

To summarize

• Code editors are software for writing codes, much more powerful than notebooks

• The IDE is full-featured but heavy, and the editor is lightweight and flexible

• VS Code, free of charge, open source, plug-in, cross-platform, is currently the hottest editor

• The common shortcuts can significantly improve efficiency

9.3 Terminal and Command Line: Don't be afraid of black windows

1. What is a terminal?

Terminal is a black window where you enter the command and the computer executes it.

Many newcomers are afraid to see the terminal — black and all in English, and the knock is wrong.

The terminal's not that scary. You don't need to remember all the orders. It's just a few.

Why use the terminal? Because there are things that can't be pointed with the mouse -- for example, wrapping up, running scripts, viewing logs. Terminals are more efficient.

Terminal and command line relationship:

• Terminal: the software itself, the window

• Command line: you enter the command environment and run in the terminal

• Shell (shell): Interpreters for command lines, such as Bash, Zsh, PowerShell

2. Opening terminal

Windows:

• Press Win+R, enter cmd, return the car

• Or search for a command prompt or PowerShell

• Press Ctrl+ `in VS Code

macOS:

• Opening of start-up stations and other terminals

• Or press Cmd+space to search for terminals

Linux:

• Press Ctrl+Alt+T

3. Common Commands

File operation:

• Iss: a file listing the current directory (Linux/Mac)

• Dir: Document listing the current directory (Windows)

• cd directory name: entering a directory

• cd..: back to parent directory

• mkdir directory name: create new directory

• rm filename: delete file (Linux/Mac)

• del filename: delete file (Windows)

• cp Source Target: Copy File

• mv Source Target: Move/rename file

View file:

• Cat filename: View the contents of the document (Linux/Mac)

• type filename: View file contents (Windows)

Other:

• pwd: displays the current directory path

• Clear: screen clean (Linux/Mac)

cls: Clear (Windows)

• Echo text: output text

4. What's the route?

The path is the address of the file or folder on the computer.

Absolute path: Write from the root directory. For example:

Windows: C: \USERS\Your name

Mac/Linux:/Users/Your name/Documents

Relative Path: Starts at the current position. For example:

If you want to visit test.txt under the Documents directory, just write it directly.

./indicates the current directory,../indicates the parent directory.

Several special symbols:

• ...: current directory

Parent Directory

~: User Home Directory (Linux/Mac)

5. Tips

Press Tab to automatically complete commands and paths

Press key to switch history command

Press Ctrl + C to terminate a running command

Multiple commands can be connected with & &: cmd1 & & cmd2

The orders are too long to write on the line.

To summarize

• The terminal is a black window in which you enter commands for the computer to work

• Few commonly used commands: cd, ls/dir, mkdir, rm/del, cp, mv

• The path is absolute and relative, ... is the current directory, ..is the top directory.

• Tab completion, history roll, Ctrl+C termination, with practical techniques

9.4 Git: The King of Version Control

1. what's version control?

Version control is the system that records the history of file changes.

That's not how you write the paper:

Papers _v1.docx, _v2.docx, _final.docx, _final 2.docx...

The same is true for writing code - change it back, want to go back and can't find the previous version.

Version control solves the problem. It can:

• Recording each modification: who, when and what has changed

• Back to any historical version: change is not bad or afraid

• Multi-person collaboration: individual, final merger

• Branch management: develop multiple functions at the same time

2. what's Git?

Git is the most popular version control tool, none.

Linus Torvalds, the father of Linux, was developed to manage the Linux kernel code.

Git features:

• Distribution: every computer has a complete code warehouse

• Quick: most operations are local and do not rely on networks

• Powerful: Branch management is flexible

• Open source free of charge: no money

3. Basic operation of Git

Install Git:

Go git-scm.com and download the installation package, next step.

Configure Identity:

git config --global user.name "你的名字" git config --global user.email "你的邮箱"

Basic processes:

初始化仓库:git init 添加文件到暂存区:git add 文件名 或 git add .(添加所有) 提交到仓库:git commit -m "提交说明" 查看状态:git status 查看历史:git log

Core concepts of Git:

• Repository: where the code is stored

• Staging: a temporary storage area before submission

• Commit (Commit): save once and generate a version

• Branch (Branch): an independent development line

4. Git ' s workflow

Single-player development:

Give init — write code — give add — give committee — repeat

Multiple collaborations:

克隆远程仓库:git clone 仓库地址 创建分支:git branch 分支名 切换到分支:git checkout 分支名

Modify, submit on branch

合并到主分支:git merge 分支名 推送到远程:git push 拉取最新代码:git pull

5. What's GitHub?

GitHub is a code hosting platform to help you store the code to the cloud.

It provides:

• Code hosting: store your code on it

• Collaborative development: developing projects with multiple people

• Open-source communities: many open-source projects are on board

• Other functions: Issue (question tracking), Wiki, Actions (automated), etc.

Similar platforms:

PlatformCharacteristics
GitHubThe largest in the world, acquired by Microsoft.
GitLabYou can build your own
GiteeIn-country platform, quick access
BitbucketAtlas sian, integrated with Jira

To summarize

• Version control helps you keep track of every change, so you can go back at any time

• Git is the most popular version control tool, distributed, fast and powerful

• Basic concepts: warehouse, submission, branch, temporary storage area, remote warehouse

• Basic operations: init,add,committee,push,pull

• GitHub is the platform for hosting the Git warehouse and a community of programmers

9.5 AI Programming Assistant: Your Staff Officer

1. what's an AI programming assistant?

The AI programming assistant is an AI tool to write your code.

You describe needs, AI gives you the code; you write half, AI completes you; you're wrong, AI analyzes you.

It's like there's a staff officer next to you, you can ask him something you don't understand.

2. Foreign AI programming assistants

GitHub Copilot

Produced by Microsoft and integrated in VS Code.

• Automatic completion: automatic tip when writing code

• Generate code based on comment: write an comment, AI gives you code

• Fees, but with free trial

Cursor

AI original editor, based on VS Code.

• Deeply integrated AI with the ability to talk to AI directly in the editor

• The free version is limited and the paid version is more powerful

Claude Code

Powerful AI agent. Arsenal mainly uses it.

Anthropic products, command line tools, which can be embedded in VS Code as plugins.

• Could help you write codes, change bugs, explain codes

• Can also do other tasks such as environmental deployment, system installation, daily office work, etc.

• Needing large language model API key support

3. National AI programming assistant

Tongyi Spirit Code

Ali's product, free of charge.

• Support for multilingualism

• Integration in VS Code and Jet Brains IDE

MarsCode.

Bytes jump out, free of charge.

• Support for multilingualism

• VS Code plugins and online IDE

CodeGeeX

Qinghua, free open source.

• Support for multilingualism

• VS Code plugins

TRAE

• Byte beat products, personal versions of which are permanently free of charge.

• AI original IDE, supporting IDE (AI-Auxiliary) and SOLO (AI-Autonomous)

• Support multilingual, transcoded, debugging and restoration

• Independent client (Windows/macos/Linux), online IDE or VS Code plugin

4. How do you use AI programming assistants?

Install UA default icons

Take VS Code, for example:

• Open VS Code

• Point to the left "Extension" icon

• Search for the desired plugins, such as: `Claude Code', `Synthetic Code', `Copilot', etc.

• Point "installation"

• Login or configuration by hint

Usage

• Autocomplete: AI automatically prompts when writing code, press` Tab `to accept

• Chat: dialogue with AI on the sidebar and ask questions

• Code interpretation: selected code for AI to interpret

• Generate the code: describe the need and allow AI to generate the code

5. Recommendations for use

Code given by AI, do not copy and paste directly

See what you're doing, understand what you're doing, use it.

AI makes mistakes.

In particular, some details, border conditions may not be well handled by AI and should be checked.

Learn to ask questions.

If AI is to give a good answer, the background, the needs, the constraints are clear.

You call AI a staff officer, not a boss.

AI gives you advice, you decide if you want to take it.

To summarize

• The AI programming assistant can help you write codes, change bugs, explain codes

• Abroad: GitHub Copilot, Cursor, Claude Code

• At home: synonyms, soybean bags, MarsCode, CodeGeeX

• The code given by AI must be checked. Don't believe it blindly.

Summary of this chapter

In this chapter, we nag the programming tools:

The programming environment includes operating systems, operating environments, editors, command lines, etc., and is well-equipped to write codes.

VS Code is the hottest editor, free, plugin rich, lightweight and fast.

Ordering doesn't scare me that much. Just learn a few of the usual orders.

Git is the king of version control, helping you record changes and collaborate on development.

AI programming assistant can help you write code, there are useful tools at home and abroad, choose a handy one.

Next chapter, how do we talk to AI?

Chapter 10: The fight against bugs.

Opening remarks

Writing code with AI will inevitably cause problems.

Wrong report, bad run, wrong result ... These problems are encountered by every programmer.

This chapter, we're going to check the problem, we're going to solve it.

Don't panic, if there is a problem, there is a way.

10.1 What about the reporting of errors?

1. What's the wrong message?

Reporting the wrong information is the program telling you that something's wrong.

Error messages generally include:

• Wrong type: what type of error

• Wrong location: in which file line

• Reason for error: Why was it wrong?

2. Common type of error

Syntax Error (Syntax Error)

The code was wrong and the program couldn't run.

In the past few years, the government has been able to identify the most important issues in the world, such as the unclosed brackets, the colons, and the wrong indentations.

[EXPLAINING]

if x > 0 print("正数") # if后面忘了冒号

For the Chinese, special attention should be paid to the question of the semi-encord and the full corner of the punctuated symbol, especially the semi-colons.

Runtime Error (Runtime Error)

The syntax is fine, but it went wrong.

For example, divide by zero, access a non-existent index, open a non-existent file.

[EXPLAINING]

x = 10 / 0 # 除以零

Logic Error

Code can run, but the results are wrong.

This is the most difficult to find, because the process is not wrong, and you have to find out for yourself that the results are wrong.

[Error example]: Wanting to calculate averages, but misspelled

average = a + b / 2 # 应该是 (a + b) / 2

3. How do you get the wrong message?

Step 1: Look at the type of error

You know what kind of mistakes are.

Step two: look at the wrong location

Find the wrong file and line number, go look in that line.

Step 3: Look at the cause of the error

Understand what's wrong before it's right.

Step four: context

Sometimes the problem is not the wrong line, but the first line.

4. Example: Look at a Python error report

Traceback (most recent call last): File "test.py", line 5, in <module> result = divide(10, 0) File "test.py", line 2, in divide return a / b

ZeroDivisionError: division by zero

Let's break it down:

• `File "test.py", line 5 `: call divide function in line 5 of test.py

• `File "test.py", line 2 `: in line 2 of test.py, a/b error

• `ZeroDivision Error: division by zero': divided by zero error

Then we'll know what the problem is: the divide is zero, and we can't divide it.

To summarize

• Error message to tell you where the problem is

• Look at the type, then the location, then the reason.

• Syntax errors are the easiest to change, and logical errors are the hardest to find

10.2 Common type of error

1. TypeError: Type error

Could not close temporary folder: %s

[EXPLAINING]

"hello" + 123 # 字符串不能直接加数字

Workaround: Convert type.

"hello" + str(123) # 把数字转成字符串

2. NameError: Wrong name

Use a variable or function that does not exist.

[EXPLAINING]

print(username) # username没定义过

Solutions: Check whether variable names are misspelled or not defined.

3. IndexError: Index error

A non-existent index was visited.

[EXPLAINING]

list = [1. 2, 3] print(list[5]) # 列表只有3个元素,没有索引5

Workaround: Check the length of the list to make sure the index is within range.

4. KeyError: key error

Visit non-existent dictionary keys.

[EXPLAINING]

person = {"name": "张三"} print(person["age"]) # 没有age这个键

Solution: Check whether the key exists by the get method or first.

print(person.get("age", "未知")) # 如果没有,返回"未知"

5. FileNotFoundError: no error in file

Could not close temporary folder: %s

[EXPLAINING]

with open("data.txt") as f: # data.txt不存在 content = f.read()

Solution: Check file path to ensure that the document exists.

6. AttributeError: property error

Object does not have this attribute or method.

[EXPLAINING]

num = 123 num.append(4) # 数字没有append方法

Workaround: Check the object type to make sure it has this method.

7. IndentationError: Indentation error

Python is sensitive to indentation and will report an error if the indentation is incorrect.

[EXPLAINING]

if x > 0: print("正数") # 没有缩进

Solution: Unified indentation by four spaces, not mixing spaces with Tab.

To summarize

• TypeError: Wrong type

• NameError: variables are not defined

• IndexError: Index cross-border

• KeyError: The dictionary key does not exist

• FileNotFoundError: File not found

• AttributeError: properties or methods do not exist

• IndentationError: Wrong indentation

10.3 Debug ' s basics

1. what's Debug?

Debug, you're looking for bugs, you're looking for bugs.

Bug, that's the error in the program.

There are many ways Debug can do it. We say a few of them.

2. Print debugging

The simplest way is to print.

Where things can go wrong, print the value of the variable to see if it's what you expect.

x = 10 y = 0 print(f"x = {x}, y = {y}") # 打印看看 result = x / y # 这里会报错

Advantages of printing debugging:

• Simple, without additional tools

• Intuitive view, with a view to the values of the variables

Disadvantages:

• Manually plus print, debuggered and deleted

• Too many printings, and the output can be messy.

3. Use a debugger

The debugger allows you to execute the code step by step and see the value of the variable.

Take VS Code, for example:

• Click to the left of the code line number and hit the red dot breakpoint

• Debug start with F5

• The program stops at a breakpoint

• Available to view variables, step by step

Advantages of debuggers:

• No change of code

• Accurate control of the execution process

• The value of all variables can be seen

Disadvantages:

• Learning how to use it

• May be time-consuming for complex issues

4. two-point positioning.

Don't know where the problem is? Dichotomy.

Add a print in the middle of the code to see if the program has been implemented here.

If it is implemented, the problem is in the second half; if it is not implemented, the problem is in the first half.

Continue with two points until the problem is found.

5. Annotation method

Take some of the codes off, see if the problem is still there.

The problem disappeared, indicating that it was in the code that had been noted; the problem was still there, indicating that it was elsewhere.

6. Search for error information

Copy the misreported information into the search engine.

Many mistakes have been encountered by others and solutions are available online.

To summarize

• Print debugging: the simplest, add print to look at variables

• Using the debugger: setting breakpoints, step-by-step

• Bialogue: from the middle, narrowing the scope

• Commentation method: Commentation of parts of the code, positioning problems

• Search: Find answers online

10.4 How do I ask AI?

1. Ask the AI about their posture

One of the most important skills in AI programming: you ask AI.

Good question, AI gives you good answers; bad question, AI gives you blind answers.

2. Mistakes

"我的代码报错了,怎么办?"

This question, AI can't answer, because it doesn't know:

• What's your code?

• What's the wrong message?

• What do you want to do

3. The correct question

Provide complete context:

What do you want?

• What's your code?

• What's the wrong message?

• What have you tried?

• Can also send a screenshot of it

Example:

我想读取一个CSV文件,计算某列的平均值。 我的代码: import pandas as pd df = pd.read_csv("data.csv") avg = df["price"].mean() print(avg) 报错信息: KeyError: "price" 我已经检查了文件,确实有price这一列。 请问问题出在哪?

So, AI knows how to help you.

4. The technique of asking AI

Step by step.

The question is complicated? Break it up.

Let AI explain

Don't know a piece of code? Let the AI explain.

"Please explain what every line of the code is doing:

Let AI make a mistake.

Give the AI code and error message and ask it to help you change it.

Let AI give the solution

Describe the needs and let the AI give you a solution.

5. Don't rely entirely on AI

AI also makes mistakes.

The code from AI, you'll see. Make sure it's okay.

Especially safety-related codes, more carefully checked.

To summarize

• Ask AI to provide complete context: need, code, error report, tried

• Fragmentation of complex issues into minor issues

• Allow AI to explain, correct and give programmes

• The code given by AI must be checked. Don't believe it blindly.

10.5 Correct posture to seek help

1. when should I ask for help?

I've been trying for a while, but I can't help it.

But before we can help, do a few things:

• Search the Internet for answers.

• Check the files.

• Ask AI and let him analyze it for you.

2. Where can I go for help?

Stack Overflow

The programmer questions and answers the community. The questions are many and the answers are many.

Caution: Search before asking questions, and do not ask duplicate questions.

GitHub Issues

Issue tracking for open source projects. If you're using an open source library, check out Issues.

Chinese Community

There are also a number of questions and answers about the gold mining, the Si No, the CSDN, etc.

Technology Group

Add a few technical groups and ask the big guy in the group.

3. How do you ask questions?

Before asking questions, prepare these:

• Problem description: what do you want to do and how did it go?

• Code: minimum reproducible code

• Environment: operating systems, language versions, relevant library versions

• Attempted: What did you try?

• Reporting of errors: complete reporting of errors

Good example of a question:

标题:Python读取CSV时报KeyError 环境: Python 3.10 pandas 2.0 Windows 11 问题描述: 读取CSV文件后,访问某列报KeyError。 代码: import pandas as pd df = pd.read_csv("data.csv") print(df.columns) # 输出:Index(['name', ' price'], type='object') print(df["price"]) # 报错 报错信息: KeyError: "price" 已尝试: 确认文件中有price列 试过df.get("price"),返回None 请帮忙看看问题出在哪?

The problem was that there was a blank in front of the listing, "price" instead of "price".

4. Questioning etiquette

• Search first and ask questions then

• Be clear in the title, do not write "Help" "Help"

• The code needs to be complete and capable of reproducing the problem

• When answers are received, thank the respondents

• After the settlement, tell us how it's done, help the later ones.

To summarize

• Search, look at documents and ask AI before seeking help

• Stack Overflow, GitHub, the technology community is a good place

• Ask clear questions: environment, code, error, attempted

• Be polite and thank you for getting help

Summary of this chapter

This chapter, we've got a problem:

The wrong message is your friend, it tells you what the problem is. If you learn to read the wrong, it's half the problem.

The common wrong type needs to be familiar and see how it can be changed.

There are many ways of Debug: printing, debugger, dichotomy, comment, search.

Ask the AI to be skilled and provide full context so the AI can help you.

It's the way to help. The question is clear, so someone else can help you.

Next chapter, we talk about security and the law.

Chapter 11: Security and the law.

Opening remarks

There are security and legal issues in addition to technical issues.

This chapter, we talk about "untechnical" but important things.

Don't think it's not important. It's a problem.

11.1 Basic awareness of code security

1. what's code secure?

Codes are safe, your code is not used by bad people, it doesn't leak information, it doesn't cause damage.

Safety issues are ubiquitous, and you can step in the pit without paying attention.

2. Common safety issues

Sensible information leaks

The code was leaked and the information was leaked.

[Error Example]: The password is written in the code

password = "my_secret_password_123"

SQL injection

The user input is put directly into the SQL statement, and the hacker can construct the input to execute the malware SQL.

[Error Example]: SQL Injection

sql = "SELECT * FROM users WHERE name = '{user_input}'"

User input: 'OR' 1 '=' 1

实际执行的SQL:SELECT * FROM users WHERE name = '' OR '1'='1'

Will return all users!

Crossing Script (XSS)

User input is shown directly on the web page, and hackers can inject malicious scripts.

XSS

html = "<div>{user_input}</div>"

User input: <script>alert('I've been hacked')</scriptt>

The web page will execute this script!

File Upload Vulnerability

Allow users to upload files without checking the file type and content, and hackers can upload malicious scripts.

3. Basic Principles of Secure Coding

The principle of minimum competence

The procedure only receives the minimum privileges it requires, not much.

Never trust a user input

The data entered by the user must be checked, filtered, and escaped.

Sensitive information to protect

Passwords are stored encrypted, keys are stored securely, and do not die in the code.

Use secure library and functions

Don't write your own encryption algorithms, use mature libraries.

Updated reliance in a timely manner

Where there are gaps in the Reliance Library, it is updated in a timely manner.

4. Is the code that AI wrote safe?

AI-written code that may have security issues.

AI doesn't know your business scene, doesn't know security requirements, it just creates code for you in common writing.

So, the codes given by AI, especially those relating to security, need to be carefully reviewed.

To summarize

• Security issues everywhere

• Common problems: leaks of information, SQL injections, XSS, file upload leaks

• Security Principles: Least Permission, Distrust Input, Protect Sensitive Information

• AI wrote codes to review security

11.2 Protecting Your Code and Data

1. what's the code supposed to protect?

Intellectual Property: The code you write is your work and you don't want to be used by others.

Trade secrets: The code contains your company's business logic, which is leaked badly.

Sensitive information: codes, keys, etc. in the code, which is much more cumbersome to leak.

2. How do I protect my code?

Version Control

Managing code with Git allows you to retroactively modify records or roll them back.

Private Repository

Sensitive code in private warehouse, not public.

Code Confusion

It's confusing with important codes, and it's confusing.

Code Review

Team members cross-check the code and identify potential problems.

3. What is data protection?

User data: user information, to be well protected, leakage is a big deal.

Business data: Company business data are important assets.

Log data: There may be sensitive information in the log, which should also be protected.

4. How do we protect data?

Encryption Storage

Sensitive data are stored encrypted and, even if the database is leaking, no explicit information is visible.

Access Control

Whoever has access to what data is controlled.

Data backup

Important data to be backed up and lost can be restored.

Data dissensitivity

Non-production environment de-sensitivity data do not reveal real information.

5. Cloud services security

Now that there are many codes and data on the cloud, cloud safety is also important.

Select a reliable cloud service provider

Security measures at large factories are improved.

Configure permissions

The cloud service's clearances should be well configured. Don't go too far.

Open logs and surveillance.

There are problems that can be detected in a timely manner.

Periodic inspection

Regular checks are made on the allocation of cloud resources and any security risks.

To summarize

• Code to protect: intellectual property, business secrets, sensitive information

• Data protection: user data, business data, log data

• Protection methods: encryption, access control, backup, dissensitivity

• Cloud services should also be safe

11.3 Open Source Agreement and Copyright

1. What is the Open Source Agreement?

Open source agreements are legal documents that dictate how your code can be used by others.

Not all open source codes can be used randomly, and different protocols require different requirements.

2. Common open source protocols

MIT protocol

The most liberal agreement.

• It can be used, changed or distributed

• Just keep the copyright statement.

Apache protocol

A little tighter than MIT.

• Available, modified and distributed

• Preservation of copyright statements and licences

• To explain what has been changed.

GPL protocol

Infectious protocols.

• Available, modified and distributed

• If you use the GPL code, you have to open up your code.

• This is the feature of the GPL: the open source is "infection."

BSD protocol

Similar to mit, very loose.

• Available, modified and distributed

• Retention of copyright declarations

LGPL protocol

Less than GPL.

• The LGPL library can be linked dynamically, and your code doesn't have to be opened

• If you modify the LGPL library itself, the changes should be open-sourced

3. How do we choose open source agreements?

• Want to be used by others: MIT, BSD

• Wanting to be used by others but retaining patents: Apache

• Want to keep your code open source: GPL

4. What do you need to be aware of with open source?

See the protocol clearly

See if you can use the protocol before you use someone else's open source code.

Compliance with agreed requirements

The agreement requires that the copyright declaration be retained and that the source be opened.

Don't be ridiculous.

Even if open source code, do not reproduce paste directly and write it in your own way.

To summarize

• The open source agreement stipulates how to use open source code

• MIT, Apache, GPL are common protocols

• mit is the most liberal and the GPL is contagious

• Use open source code to see protocols and comply with requirements

• The copyright of AI generation code is unclear

11.4 Legal risks of AI programming

1. Copyright issues of AI-generated content

Who owns the copyright to the AI-generated content?

The issue is still under discussion in the legal community.

Current mainstream view:

• Content generated by AI, with unclear attribution of copyright

• After a person makes changes to AI-generated content, the person may have copyright on the modified part

• AI-generated content at risk of infringement

2. AI may "copy" someone else's code

AI was trained with a lot of codes, and might have learned other people's codes.

If AI gave you the same code as anyone else, you might have violated it.

3. How to reduce the risk?

Do not use AI-generated code directly

Understand, write it in your own way.

Check the code generated by AI

Search to see if it's the same as someone else's code.

Important code. Write it yourself.

Core codes, commercial codes, preferably self-written, are not generated from AI.

4. Compliance issues with AI use

Some companies, industries, have restrictions on the use of AI.

For example:

• The failure of the associated units to use AI for sensitive information

• Some companies prohibit the distribution of codes to external AI services

You need to know the rules of your environment before using AI.

5. Privacy issues of AI services

You send the code to the AI service, and the AI service sees your code.

Consider this risk if the code is sensitive.

It is possible to select locally deployed AIs or intra-company AI services.

To summarize

• Ambiguous copyright for AI-generated content

• AI may "cancer" other people's codes. There's a risk of abuse.

• Risk reduction: rewriting, checking and writing of core codes after understanding

• Be aware of compliance and privacy issues with AI use

11.5 Ethics and Responsibility

1. Professional ethics of programmers

Writing code is not only a technical job, but also an ethical requirement.

Don't do anything evil.

Don't write malicious codes, don't violate people's privacy, don't do anything illegal.

Responsible to users

The code you write affects the user and is responsible to the user.

Honesty

Don't pretend to understand without learning; if you have a problem, don't hide.

Respect for others.

Respect for colleagues, users, open-source contributors.

2. Ethical aspects of AI programming

Don't cheat on AI.

For example, it's immoral to write homework and test answers in AI.

Don't use AI for evil

For example, it's against the law to write attack codes and fishing websites with AI.

Responsible for the content generated by AI

You use AI to generate the code, you're responsible for the code, so there's no problem with AI.

3. Who's in charge of the problem?

You wrote the code from AI. There's a problem. Who's in charge?

Of course you're in charge.

AI's just a tool, you're a user and you're responsible for your code.

To summarize

• Professional ethics of programmers: non-deficiency, responsibility, honesty, respect

• AI programming should also be ethical: no cheating, no evil, responsible for the content generated by AI

• Something went wrong and the user is responsible

Summary of this chapter

In this chapter, we talk about security and the law:

Code security needs to be conscious, sensitive information leaked, user input trusted and AI code reviewed.

Protects codes and data, using encryption, access control, backup, etc.

Open-source agreements are clear, different agreements require different and comply with them.

Legal risks of AI programming, unclear copyright, possible infringement, compliance and privacy concerns.

Professional ethics and responsibilities, do not do evil, be responsible, be honest, be respectful, and be responsible for AI-generated code.

Here, the book's about to be written.

Appendix

Appendix A: Glossary of Common Terms (Comparation between Chinese and English)

I. Computer Fundamentals

Chinese termsEnglish termsinterpreted
Central processorCPU (Central Processing Unit)The brain of a computer, responsible for executing instructions and calculations
MemoryMemory / RAM (Random Access Memory)Where data are temporarily stored while the program is running, lost after power outages
Hard DiskHard Disk / HDD / SSDEquipment for permanent storage of data, not lost after power outages
Solid Hard DiskSSD (Solid State Drive)Hard drive stored with flashback technology, faster speed
Graphic processorGPU (Graphics Processing Unit)Processors specializing in graphics and parallel computing
Main boardMotherboardConnect all hardware core circuit boards
A visual card.Graphics CardHardware to handle graphic output
Operating systemOperating System (OS)Systems software to manage computer hardware and software resources
kernelKernelCore part of the operating system
DriverDriverSoftware to enable operating systems to recognize and use hardware

II. Programming language

Chinese termsEnglish termsinterpreted
Programming LanguageProgramming LanguageThe language people use to write programs.
Source codeSource CodeCode written by programmers
Machine CodeMachine CodeCodes that the computer can execute directly.
CompileCompilationThe process of translating the source code into machine code
interpretedInterpretationThe way the code is translated while executing it.
CompilerCompilerImplementation of compilation procedures
InterpreterInterpreterProcedures for the enforcement of interpretations
GrammarSyntaxSyntax rules for programming languages
SemanticSemanticsMeaning and logic of the code
IdentifiersIdentifierName of variable, function, etc.
KeywordsKeywordWords reserved in programming languages
CommentCommentUnexecuted captions

III. TYPE AND STRUCTURE OF DATA

Chinese termsEnglish termsinterpreted
VariablesVariablePackaging of data
ConstantConstantValues Unchangeable Amount
Data typeData TypeThe type of data, such as integers, strings, etc.
IntegerIntegerNumbers without decimal parts
FloatsFloat / Floating Point NumberNumbers with decimal parts
StringStringText data
Boolean valueBooleanTrue/False
ArrayArrayStructure for storing multiple pieces of the same type of data
ListListAn orderly collection of variable data
GroupTupleAn orderly collection of irreversible data
DictionaryDictionaryData structure of key pairs
Gather!SetA disorderly collection of non-repeating elements
ObjectObjectData structure with attributes and methods
ClassTemplate for creating objects
ExampleInstanceClass specific executory object
Null / Noneindicates no value

IV. Procedural Structure

Chinese termsEnglish termsinterpreted
FunctionsFunctionPackage a reusable piece of code
MethodologyMethodFunctions in an object
ParametersParameterVariable received when function is defined
MinorimArgumentValues passed on when calling function
Returned ValueReturn ValueResult returned after function is executed
Condition statementConditional StatementExecute different codes according to conditions
CycleLoopRepeat a code
IterationIterationOne execution of the loop
RecursiveRecursionFunction calls itself
AbnormalExceptionError while running program
Anomalous treatmentException HandlingMechanisms for catching and handling exceptions

V. Software engineering

Chinese termsEnglish termsinterpreted
ModulesModuleA separate code file
PackageA set of relevant modules
LibraryA collection of code that provides specific features
FrameFrameworkProviding a code framework for infrastructure
InterfaceInterfaceRegulation of interaction between modules
Application InterfaceAPI (Application Programming Interface)Bridges between programs
Software development toolkitSDK (Software Development Kit)Tool collection for development
Integrated development environmentIDE (Integrated Development Environment)Integrated development environment for editing, compiling, and debugging
Version ControlVersion ControlManage Code Version System
WarehouseRepositoryPlace where the code is stored
BranchBranchIndependent development line of code
MergeMergeMerge codes from different branches
SubmitCommitSave code change record
PushPushPush the local code to the remote warehouse.
PullPullGet Code From Remote Repository

VI. NETWORK AND WEB

Chinese termsEnglish termsinterpreted
NetworkNetworkMulti-computer interconnected systems
InternetInternetComputer networks worldwide
ProtocolProtocolRules of network communication
IP AddressIP AddressOnly marking of network equipment
Domain NameDomain NameGood name for the website.
Domain name systemDNS (Domain Name System)A system for translating domain names into IP addresses
PortPortPortal to web services
FirewallFirewallCybersecurity barrier
Proxy ServerProxy ServerIntermediate server to forward requests
Hypertext transfer protocolHTTP (HyperText Transfer Protocol)Web Transfer Protocol
Secure Hypertext Transfer ProtocolHTTPSEncrypted HTTP protocol
FrontendFrontendThe section of the interface that the user sees
BackendBackendServerend Program
Whole house.Full StackBoth front and back.
Web pageWeb PagePage displayed by browser
WebsitesWebsiteMultiple web pages collection
ServerServerComputers or programs providing services
ClientClientProcedures or equipment for requesting services

VII. Database

Chinese termsEnglish termsinterpreted
DatabaseDatabaseAn organized system for storing data
Relationship databaseRelational DatabaseDatabases that store data in tables
Non-relationship databaseNoSQL DatabaseDatabase not stored in table
Structured Query LanguageSQL (Structured Query Language)Language of the operating relationship database
TableTable where data are stored in the database
Data fieldFieldColumns in tables
RecordsRecordLine data in tables
Main KeyPrimary KeyUnique field to identify the record
Foreign KeyForeign KeyFields associated with other tables
IndexIndexAccelerating query data structure
TransactionsTransactionImplementation module for a group of operations
Object Relationship MapORM (Object-Relational Mapping)The technology to map objects to a database

VIII. Cloud computing and deployment

Chinese termsEnglish termsinterpreted
Cloud computingCloud ComputingProvision of computing services through the network
Cloud servicesCloud ServiceServices Provided by Cloud Service Providers
Infrastructure is servicesIaaS (Infrastructure as a Service)Cloud services for virtual hardware
Platforms are servicesPaaS (Platform as a Service)Cloud services provided for the development of the platform
software as a serviceSaaS (Software as a Service)Cloud services for software
DeploymentDeploymentPost the program to the server
PackagingsContainerTechniques for isolating running programs
PackagingContainer OrchestrationTechniques for Managing Multiple Containers
Virtual MachineVirtual Machine (VM)Simulated computer system
Load BalancingLoad BalancingAllocating requests to multiple servers
API &ndash; Content Delivery NetworkCDN (Content Delivery Network)Distributed content acceleration network
Virtual private networkVPN (Virtual Private Network)Secure encryption network connection

IX. Debugs and errors

Chinese termsEnglish termsinterpreted
ErrorErrorIssues in the proceedings
AbnormalExceptionError while running program
Leaks.BugDeficiencies in the proceedings
DebugDebugThe search for bugs, the process of making bugs.
BreakpointBreakpointSuspension of proceedings
Single StepStep ExecutionStep-by-step execution of procedures
Stack traceStack TraceFunction call chain record
LogLogRecord of program running
Syntax ErrorSyntax ErrorIncorrect code syntax
Run errorRuntime ErrorError while running
Logical ErrorLogic ErrorCode logic's wrong.

X. Safety and the law

Chinese termsEnglish termsinterpreted
Information securityInformation SecurityProtect information from unauthorized access
cryptographyEncryptionTurn data into ciphertext
DecryptDecryptionRevert the secret to the letter.
AuthenticationAuthenticationIdentification process
licensingAuthorizationGrant access
SessionSessionUser-server interaction process
DecorationTokenCertificates for authentication
Cross-post script attack.XSS (Cross-Site Scripting)The attack with a malicious script.
SQL injectionSQL InjectionInjecting a malicious SQL attack.
Open SourceOpen SourceSource code is public and free to use
LicencesLicenseLegal terms for using the software
COPYRIGHTCopyrightLegal Ownership of Works
Intellectual property rightsIntellectual PropertyLegal rights to intellectual outcomes

XI. AI and machine learning

Chinese termsEnglish termsinterpreted
Artificial intelligenceAI (Artificial Intelligence)Simulation of human intelligence technology
Mechanical learningMachine LearningLet the machine learn from the data.
In-depth learningDeep LearningA way of learning through neural networks.
Nervous networkNeural NetworkSimulate the computational model of the human brain.
Large Language ModelLLM (Large Language Model)Large-scale language processing model
Natural language processingNLP (Natural Language Processing)Technologies for handling human languages
HintPromptInstructions or questions for AI
fine tuneFine-tuningAdapting models to specific tasks
TrainingTrainingLearning with a data-based model
Rationale.InferencePredict with a trained model

XII. Other common terms

Chinese termsEnglish termsinterpreted
AlgorithmsAlgorithmSteps to solve the problem
ComplexityComplexityThe temporal or spatial cost of the algorithm
FeaturesPerformanceEfficiency of the operation of the process
OptimizationOptimizationImprove program performance
ReconstructRefactoringImproved code structure
TestTestingCheck if the procedure is correct
Unit TestUnit TestTest individual functions or modules
Integrated TestIntegration TestCollaboration between test modules
DocumentDocumentationInformation on the procedure
Open-source communityOpen Source CommunityDeveloper group for shared code
CacheCacheTemporary storage acceleration access
SyncSynchronousWait till it's finished.
Step.AsynchronousNot waiting. Carry on.
RewindCallbackFunctions Called After Completion
EventsEventSomething happened.
ListeningListen / WatchWaiting for something to happen.
TriggerTriggerActivate event
RenderRenderGenerate display content
ParsingParseAnalyze Data Structure
SerializedSerializationConvert objects to storage format
Inverse SequencingDeserializationTurn storage format back to object

Appendix B: Recommended Learning Resources

Online tutorial

• Cainiao Tutorial: Getting Started with Various Programming Languages Website:

• Liao Xuefeng's official website: Python, Git and other tutorials Website:

MDN Web Docs: Frontend Development Document (HTML/CSS/JS most authoritative reference) Website:

• Official documentation: official documentation in every language, in every library Example: Python is, React is

Video course

• Station B: lots of programming teaching videos

Website:

• Networking of classes: systematic programming courses

Website:

• Coursera: courses in foreign schools of excellence

Website:

Practice Platform

• LeetCode: algorithm practice

Website: (Chinese Community)

• Bullnet: programming exercises and interview issues

Website:

• Codewars: programming challenges

Website:

Community

• Stack Overflow: Programmer Questions and Answers Community

Website:

• GitHub: Open Source Project Hosting Platform

Website:

• Gold mining: Chinese Technical Community

Website:

• V2EX: Technology Discussion Community

Website:

Appendix C: Windows CMD/PowerShell Common Commands

CommandRole
dirLists the files in the current directory
cd directory nameInto the directory
cd ..Back to Previous Directory
clsClear
copy Source TargetCopy File
Move Source TargetMoving file
del filenameRemove File
mkdir directory nameCreate Directory
rmdir directory nameRemove Directory
type filenameShow the content of the file
ping AddressTest network connections
ipconfigShow network configuration

Appendix D: VS Code Common Shortcuts

Shortcut KeysRole
Ctrl + SSave
Ctrl + ZUndo
Ctrl + YRedo
Ctrl + CSalin
Ctrl + VPaste
Ctrl + XCut
Ctrl + FFind
Ctrl + HReplace
Ctrl + /Comment/Cancel Comment
Ctrl + `Terminal on/off
F5Start debug
F9Set/Cancel Breakpoint
F10Step over
F11Step in.

Postscript

This book is here, and it's over.

Looking back, we talked about computers, programs, data, networks, web pages, clouds, tools, AI programming, question-checking, security laws.

It's basic, not deep, but it should be enough.

It took AI 10 minutes to produce the first draft of the book, and I used my leisure time to review, modify, and last about three or four days. The AI is really working, but someone has to finalize, close and take responsibility.

By the way, he doesn't guarantee that the book is correct, because I can't guarantee it, and there's something I don't understand as an old programmer. I'm also learning from AI while writing.

Readers are advised that the book is not very rigorous and that it describes non-precision or even serious errors.

And finally, let AI help me read the book from the beginning to the end, turn it off.

Is that the last way to hand over to AI?

Or is it not? He can't see anymore. I can only ask a few more AIs.

The original purpose of this book.

I've been programming with AI for a while, and I find that a lot of people write codes with AI, but don't know the basics.

When you get the wrong report, you're in a circle. You don't know what's wrong.

The code AI gave me, I don't know what's going on.

There's a problem, I don't know how to check it out.

So I wanted to write a book about these basics.

Hope to help friends who want to program with AI.

And above all, I myself took the opportunity to revisit and learn from this knowledge, especially some of the more recent ones, which I also need to learn to master.

A little thinking about AI programming.

AI is really powerful and can help you write code, fix bugs, and interpret code.

But AI is not almighty.

Without basic knowledge, it's hard to write code with AI.

There may be a problem with the code given by AI, you have to see it.

You must be able to understand the mistakes of the AI newspaper before you can correct them.

So basic knowledge has to be understood.

AI is the tool, you are the master. No matter how good the tools are, the master will not use them.

Most importantly, even if the procedure was created by AI, the ultimate responsible person is you.

You don't understand the basic principles and structure, how can you be responsible?

For the reader.

If you're a rookie, I hope this book will help you get started.

If you have experience, I hope this book will help you sort through your knowledge.

If you feel useful, recommend it to your friends.

If there is a problem, welcome criticism is correct.

Thank you.

Thanks to AI for helping me write this book, of course, I changed a lot and added a lot.

Thanks to all the open source projects, I have learned a lot.

Thanks to the readers, you can finish the book.

And finally...

Programming is a fun game, and requires thinking and more practice.

Come on, let's go for a walk on the Vibe Coding road!

Arthur

It's a big day in 2026.

All done.