# Introduction

## What is Computer Science about?

Practicing Problem Solving

Getting a better understanding of the programs that we write.

Geting a better understanding of mathematics using programming.

Realizing that computing and mathematics are closely connected.

## About Computer Programs 关于计算机程序

1. Purpose:
Computer programs are writen to solve real-world problems
计算机程序是用来解决现实世界的问题的
2. Typically describe
• They model real-world objects that change over time
• The way they change is reflected in their ‘state’ (Real-world objects have a state)
• Variables are used to model these real-world objects
程序模拟真实世界中的随着时间变化的对象，他们通过“状态”反应改变情况，使用变量用用于对现实世界中对象的建模。

## Program state 程序状态

Key word：Changes over time

### Domain Variable 域变量

Definition: An element in the program that represents a relevant aspect or an object of the real-world that changes over time.

Domain Variable 表示的是一个对象，而非一个具体的值（区别于下面的 Variable Domain），更通俗的讲就是数量（状态）可以发生变化的一些对象，例如人的数量，桌子的大小，花的颜色。

### Computation Variable 计算变量

Definsition: An element in the program that represents a relevant aspect in the program that changes over time

Computation Variable 是程序运行时计算产生的，而非人为产生的，例如 a==b 作为表达式产生了一个计算变量，当a=1 b=1 时计算变量为 True 而 a=1 b=2 时计算变量的值为 False ， 其他在程序中常用的如 sum flag 等等也属于计算变量。

### Constants 常量

Definsition: An element in the program that represents a relevant aspect or an object that does not change over time.

### Variable Domain 变量域

Definsition: Represent the set of values that the variable may assume.

Variable Domain 表示的是一个集合，集合中的值是这个变量可以取到的具体的值。注意，这里是一个集合，仍然不是具体的值。

### Variable State 变量状态

Definsition: Is a configuration of the variable: an assignment of the variable a value from its domain.

Variable State 是变量的具体值

### Program state 程序状态

Definsition: is a configuration of the program: an assignment of every variable a value from its domain

Program State 是指的所有的变量的具体值。

#### 小总结：

1. x，y 就是 Domain Variable；
2. {x∈R}，{y∈R ∩ y≠0}就是 Variable Domain ；
3. x=1 或者 y=2 是 Variable State ；
4. {x=2，y=2} 是 Program State ；
5. 当{x=2，y=2}时，其计算结果 “6” 以及“x/y”的结果 “1” 均是 Computation Variable；
6. “5” 作为不变化的值，就是 Contants 。

## Initial State 初始状态

Definsition: Is the initial state of the program

The local variable xxx may not have been initialized

## Identify Domain Events

### Domain Events 域事件

Definsition: The different events that can occur in the domain.

### Computation Events 计算事件

Definsition: when variables should be updated.

## Program Behavior 程序的行为

Definsition: How the state of the program evolves(How and when the state variables are updated)

int n=10;
int sum=0;
for(int i=0;i<n;i++>)
{
sum+=i;
}


## Pseudo Code 伪代码

Definsition:A high-level description of the operating principle of a program that utilizes real programming languages constructs (e.g. if …then…else, while …) with natural language to allow solutions to be expressed without needing to understand the precise details of a programming language.

Two keys:

1. Use the real program language constructs.
2. Describe with the natural language.

Pseudo Code 是一种非正式的描述。

## Program Evaluation

From Functional Criteria and Nonfunctional Criteria

## 发送评论编辑评论

|´・ω・)ノ
ヾ(≧∇≦*)ゝ
(☆ω☆)
（╯‵□′）╯︵┴─┴
￣﹃￣
(/ω＼)
∠( ᐛ 」∠)＿
(๑•̀ㅁ•́ฅ)
→_→
୧(๑•̀⌄•́๑)૭
٩(ˊᗜˋ*)و
(ノ°ο°)ノ
(´இ皿இ｀)
⌇●﹏●⌇
(ฅ´ω`ฅ)
(╯°A°)╯︵○○○
φ(￣∇￣o)
ヾ(´･ ･｀｡)ノ"
( ง ᵒ̌皿ᵒ̌)ง⁼³₌₃
(ó﹏ò｡)
Σ(っ °Д °;)っ
( ,,´･ω･)ﾉ"(´っω･｀｡)
╮(╯▽╰)╭
o(*////▽////*)q
＞﹏＜
( ๑´•ω•) "(ㆆᴗㆆ)

Emoji