Hello everyone, this is BinaryBang.

Preface

There's a saying "what exists is reasonable." The stable version 1.0.0 of Cangjie language has been released. I won't comment on what the future holds for Cangjie, but Cangjie is a young language, perfect for young people to learn.
So starting today, I plan to teach a programming beginner course using Cangjie language, consisting of 15 lessons in total.

Course Introduction

Language Used

Cangjie Programming Language, version 1.0.0

Target Audience

  1. Complete beginners with no programming experience.

  2. Those who have experience with other programming languages but want to learn Cangjie.

Development Tools

VSCode

Operating System

Windows

What is Programming

Since we're learning programming, what exactly is programming?

We know that cooking is the process of transforming vegetables, meat, eggs, ginger, garlic and other ingredients into dishes.
Cooking is according to the recipe, transforming ingredients into dishes.
Ingredients is the initial state, dishes is the final state, and recipe is the method of transformation. We express this as: Final State = Transformation Method(Initial State)
That is: Dishes = Recipe(Ingredients)

Similarly, programming works the same way. The ingredients in programming are input data, the recipe is algorithm, and the result is various forms of output data.
That is: Output Data = Algorithm(Input Data)
Programming is the process of transforming input data into output data according to an algorithm.

Setting Up Development Environment

Cooking requires a kitchen environment with all necessary tools. Similarly, programming requires a development environment with all necessary tools.
To do this, we need to prepare two main things: SDK and IDE.

Setting Up SDK

First, what is an SDK?

Let's use cooking as an example again.
We need a set of cookware, including pots, bowls, and knives.
We need some seasonings, like oil, salt, and pepper.
Similarly, programming based on a language also requires a supporting infrastructure, which is the SDK for that language environment

Download

Click here to go to the download page: Cangjie SDK Download Address
Click the download button next to cangjie-sdk-windows-x64-1.0.0.zip
image.png

First, put the downloaded zip file in a designated directory, for example:
D:\00-Programming\01-CjSdk\01-Source.
The download is complete.

image.png

Installing the SDK

Find the downloaded zip file and right-click to select Extract/Extract to cangjie-sdk-windows-x64-1.0.00.zip:

image.png

This gives us the extracted SDK.

image.png

After extracting the SDK, you can delete the original zip file and keep only the extracted directory.

image.png

The installation is complete. Now let's configure it.

Configuring the SDK

What is configuring the SDK?

Earlier we said that SDK provides the infrastructure for development. We now know where this infrastructure is located, but the computer system doesn't.
Configuring the SDK means telling the computer where the SDK is located.

  1. Open My Computer properties

Find the My Computer icon on your desktop.

image.png

Right-click the properties button.

image.png

  1. Open Advanced System Settings.

image.png

  1. In the popup panel, select Environment Variables.

image.png

  1. Understanding Environment Variables

image.png

The box below will display a list showing the current system's environment variables.
Environment variables are like an address book, used to represent where tools are stored.
For example, in daily life, we set a delivery address, like Cainiao Station, at xx Province, xx City, xx District, xx Street, xx Number. So if I say I sent you a gift addressed to Cainiao Station, you immediately know where to find it.

Now, we need to create an address entry for the Cangjie SDK.

  1. Create CANGJIE_HOME Environment Variable
  • Click New.

image.png

  • Set the variable name

Enter the variable name CANGJIE_HOME in New System Variable. This represents the home directory of the Cangjie SDK. This name cannot be changed and must be exactly this.

image.png

The variable value is the specific location of the Cangjie SDK.

Remember the path we saved earlier? Let's find it.

image.png

Double-click to go one level in.

image.png

Double-click again.

image.png

We find a bin directory inside. Don't navigate away, click the blank area of the path bar above.

image.png

Now we see the full path of this directory. Copy this path, go back to the new variable window, and paste it.

image.png

Click OK, and the CANGJIE_HOME variable is created.

image.png

  1. Add CANGJIE_HOME to the Path Environment Variable

What is the Path environment variable?
When the system looks for something, it only searches in the Path address book. So we need to add CANGJIE_HOME to the Path directory.

Select the Path variable and click Edit.

image.png

In the popup, click New.

image.png

An input box appears at the bottom.

image.png

Enter the first path:

1
%CANGJIE_HOME%\bin

image.png

Next, create these three paths in order:

1
%CANGJIE_HOME%\tools\bin
1
%CANGJIE_HOME%\tools\lib
1
%CANGJIE_HOME%\runtime\lib\windows_x86_64_llvm

Make sure all 4 paths are created:

image.png

Finally, click OK to close the popup.

image.png

The SDK configuration is now complete.

🎓 AI 编程实战课程

想系统学习 AI 编程?程序员晚枫的 AI 编程实战课 帮你从零上手!