G4 Project Group-13 Reflection Day3

Describe the importance of self-motivation and perseverance in a team setting. Describe the importance of teamwork and collaboration. Describe the importance of reflecting. Remember to give specific examples from these last 3 days.

EMMA: I think self-motivation and perseverance can help keep our efficiency on track. Although we are worked in a group, we had to do our tasks individually after we set our goals and divided our works. Each individual must be concentrated on their tasks so that we could have enough time integrating and revising our works together. For example, we designed that we should begin making video and poster on the third day, then I must finish all the biological explanation in the script for our data on the second day. Because of this, I was able to spend almost most of the time between 9:30-11:00 today on making our poster.

The teamwork and collaboration can help a group improve efficiency and reduce possible mistakes. For example, after choosing the area of interest on the first day, we had some difficulties in specifying our research question. We knew that we wanted to study air pollution, but were not sure which specific air pollutants we want to study. The teamwork helped us to solve this problem: as a biology student, I read our biological textbook and conduct research on external sources such as published papers, aiming to find out which pollutant or pollutants have the most significant effects on lung cancer. After that, I told my results (SO2, NOx, PM) to Lily (chemistry student), and she conducted found out some evidence that further verified the validity of my results and explained the results in the perspective of chemical reactions. Based on our research, we finally decided to study SO2 and NOx, and Johnson (CS student) was able to found the relevant data and create model for our analysis. Compared to the situation when we had not decide which air pollutants to study and all of us were searching aimlessly, our research was more focused and targeted on the second and the third day.

Reflecting was really, really important since it helped us find out where we can improve to make the next day better. We had big difficulties in finding topic on the first day, because we didn’t know how to find good database and how to select a topic that is suitable for research. All of us were just searching and searching and getting no valuable results, instead of communicating our confusions with the teachers, who were experienced at G4 projects. We missed the deadline for approval and after we were asked to talk with Ms. Shuo, we found out that her advice was really helpful and we quickly determined our topic after meeting with her. At the end of first day, all of us agreed that “asking questions more frequently” was what we should improve most, and we wrote this idea into the reflection part in our daily presentation in Day One. On the second day, we asked Dr. Chun and Ms. Shuo a lot of questions (such as what exactly does historical or current trend requires us to include, what are the exact mechanism that air pollutants react with substances in our body…) if we cannot figure it out by ourselves, and their suggestions were really helpful and our efficiency was greatly improved.

LILY: Over the last three days we have been working as a group to complete a project with each member expert in a certain field. Online communication was a big barrier that we have to overcome to complete this project. We went through the process of brainstorm, database research, content research, information gather and final production. 

 In the brainstorm and research stage, we met a few problems of efficiency and decision making. We first settled our general topic to be about pollution and then went for research of data, but we were struggling to get the appropriate data because the topic was too general to help us pin down the exact ones that we need. We changed our topic from land pollution to water pollution and lastly to air pollution due to the available databases that we found. This taught us about the importance of determining the sequence of tasks when doing a project, when the resources are limited, we should determine our investigation area according to the resources, if not we may take a long time to gather the evidence for our research.

 Also, another reason that we choose this topic is that our team members are all interested in this topic and our area of experts all have places to research on related to pollution. This way we can encourage ourselves when we meet problems and troubles, and we will have the motivation to keep on working. For example, when we found out that land pollution is not suitable for doing research, we could quickly shift our topic to water pollution, and when we found out that there was no appropriate database with water pollution and we used a lot of time, we could still shift our topic to air pollution.

 We were collaborated and communicated well during the research process. Even though this might be the first time we are working together through internet, we could still help each other using our own knowledges and resources. For example, initially, Emma provided a website that contains many databases of different topics to open our minds and help us search for an appropriate topic. Whenever a group member found an useful website online, we would immediately share it with the group and discuss our ideas with them. When I went through each website and searching for data related to water pollution and found out there weren’t much data related to it, my groupmates discussed it with me together immediately so we decided together that we should change our direction to avoid waste of time.

 During the last three days, we were required to do written and live reflections every day. This form of reflection helps me conclude very well for what we have done in the day and reminds me of the progress of our project. Also, reflection is also a kind of prediction, it can help us set up the goals and targets for the next day. For example, on the first day, Mr. Vivas told us in online reflection that we need to specify the kind of pollutants that we need to discuss about, so the targets that we set for the next day would be to be sure about which particular substance would we investigate on. In that way we related the pollutants (SO2, NOx, etc) to the disease of lung cancer and came up with our final research question.

 Overall, I believe that the group 4 project trained my ability of teamwork and collaboration. It reminds me that it is important to often reflect on what we are doing and set appropriate goals for the future.

JOHNSON: These three days have been really tensed and tough. One of the difficulties is that  we are doing this teamwork distantly, and it slightly makes the communication and efficiency not as good as face to face communication. I think there is quite a lot of workload in the G4 project, brainstorming the topic, searching for reliable and appropriate database, choosing appropriate pollutants and research about the relationships with lung cancer. Each of these process takes a lot of time to accomplish and it contributes to most of our first two days. For me personally, I think self-motivation and perseverance is really important. I started to analyze the data on the second day, I choose to use a software (Matlab) that I am not really familiar with before. It takes me several hours on the second day, and I still couldn’t figure out how to write the code to make appropriate plot diagrams and regression lines. I think I panicked a bit, but I know that our later research is highly dependent on the data trend we find, and we have to use it to predict future data. This is the time when I almost give up, but thinking about the importance of these data, I motivate myself and carry on the work. 

Secondly, the group 4 project is meant to promote teamwork and collaboration by making a group filled with a representative of a science subject. All of us have to devote our own knowledge from the subject to help moving on this research. If any of the group members get lost or not working persistently, the whole research will fail. For example, we are doing a research question about how the pollutants impact the lung cancer in the United States. Though I don’t know the situation of the other groups, our topic is highly chemical and biological related. I do not have much knowledge about these molecules and the reactions, so the theoretical explanation requires students from chemistry and biology. Similarly, for the flowcharts and data analysis, I can use my knowledge from the CS class. Each of us has specific roles and responsibilities, only with effective communication and collaboration, this project can move on.

For the reflecting part, we made a mistake on the first day. We spend too much time deciding the topics and still not having a clear thought. We asked for help from Mrs.Shuo, and her advice immediately helped us to narrow down our topic. So, we reflect about this on the second day, and we decide to ask questions more frequently. We asked a lot of questions associated with molecules and reactions and it largely speeded up our process of research. For example, thanks for their help, we were able to narrow down the pollutants to NOx, SO2, and PM 2.5. So I think the reflecting process is really essential in a teamwork. Because this is the first time for the three of us working together, it’s the first time we distantly working on a project and the first time to do a project incorporating different subjects. There are a lot of difficulties, and we improve everyday by finding more efficient approaches. For example, throughout these three days, we tried wechat audio, zoom meetng, Tencent screen sharing, Shimo document to make sure we are doing things as efficient as possible, and that benefits a lot.

G4 Project Group-13 Reflection Day2

Q1: What were your contributions today to your group? How was your energy level throughout the day? 

Personally, I determined the number and types of pollutants that we are going to investigate on and did my research about these substances in the case of chemistry. Also, I helped with communication with advisors about questions we met during the research. I think we communicated effectively today.  I think I was in a good mood and a good status today but energy level dropped a little closing to noon. (Lily)

I was in charge of the biology part. After researching published papers and online websites about which air pollutants can have significant effect on human body, I helped to specify the pollutants we would discuss (SO2, NOx, O3) at the beginning of the day. Then I began to analyze our data in the perspective of biology and tried to explain the biological mechanism of lung cancer. I distribute most of my energy between 8:00 to 11:00 on researching, analyzing, and writing our script for the final video. In the afternoon, I wrote blogs and prepared presentation with my group mates, since these tasks are more relaxing… (Emma)

Today after we finished our discussion of the pollutant that we are going to choose, we each separately did our own research on our area of interests.  As we have finished the discussion of the plans, I made the flowchart to show the overall thinking process. I also researched about the approaches that the US has taken to effectively reduce the air pollution. Overall, these three days are really tense, and I feel a bit more stressed compared to yesterday. In the morning, I finished the flowchart and analyzed the data, in the afternoon, finished the blog and prepared for the meeting. (Johnson)

Q2: Which area did you put the most motivated today? 

I think I was most motivated gathering data and resources for the video plan. I was motivated at going through different resources and making decisions about what we should include and what we should not include in the final video. (Lily)

Researching for the relationship between SO2, NOx, O3 and lung cancer. Although we have not learned the gas exchange system in biology yet, I thought it was interesting so finished reading the relevant chapters on biology book. I also found several published papers that could be used as our experimental references for our investigation. (Emma)

I feel most motivated today making flowcharts. It’s basically a visual representation of the thinking process that we have gone through these two days, and it makes my understanding to this research question more logical. It took me a few hours to complete the flowchart. (Johnson)

Q3: Which area did you feel the least motivated? Why? 

However, things get harder when I need to compile those resources and sort out the information I need. I need to collaborate with my groupmates and communicate frequently to know what they are working on to make sure that we are focusing on the same detail. Also due to the time limitation of the final video, I would have to limit the amount of information that I put in and make it as concise as possible. (Lily)

Writing the script for the video. Writing it was not boring, but I found it difficult to decided which information should I include so that my analysis would neither be too broad nor too complicated. (Emma)

I think dealing with data is the least motivated part. Because there are tons of data associated with air pollution and lung cancer it is quite stressful to look through them and establish model between the pollution data and the lung cancer data. (Johnson)

Q4: What are some ways you could have persevered through these times? What are your own personal goals for the final day?

If I met some problems during research I would ask questions to my groupmates first. Usually they will be able to give me good answers from other perspectives to help me solve it. If my groupmates could not answer the question, I would then go for our advisors. Personally, I hope we could be more effective tomorrow and complete our work with quality on time. I hope we could start early on making video and poster so we try not to rush the deadline. (Lily)

I was not distracted throughout the time I carried out research, which I thought was really important to improve my efficiency. Also, we asked more questions and communicated our confusions more to the teachers than we did yesterday, which I thought was really good to our progressing. For the final day, I wish I can finish drawing the diagrams, charts, and cartoon pictures (which will be used in our final video) in the morning. In the afternoon, I hope I can finish my ppt, record my script, and edit my parts into video. (Emma)

I keep myself motivated to persevere, because I regard the Group 4 project as a great way to incorporate different subjects together to research about a real-life issue. I have done similar things in grade 9, of which we combined Biology, Human geography and Economics together to do a 20min long video. I found it very interesting, so I really enjoyed the process. For the final day, I really hope that we can come up with some meaningful results and present all our hardworks into the video and the poster. (Johnson)

The flowchart we made

G4 Project Group-13 Reflection Day1

Q1: What category and sets of database did your group decide on? (We combined all our answers in the first question)

We chose to analysis the pollution of a few substances of the US over a few years and its relations with a specific kind of disease (lung cancer). The links and screenshots are provided below:

1. Emissions of air pollutants in the US, 1970 to 2016 (https://ourworldindata.org/outdoor-air-pollution)

2. rate of lung cancer in the US, 1999-2016 


Data from ourworldindata.org

Q2: What do you think can be the implications of your analysis specifically in your field? In the world? 

In the field of biology, I could analyze the relationship between air pollutants and lung cancer, trying to explain how does certain pollutants affect blood vessels, blood circulating and metabolism.  (Emma)

I think our analysis can help to find out the different sources  of these pollutants. I can specify down to the basic chemical mechanism of the formation of these substances and find ways to cut them down from the source. (Lily)

As for computer science, the main task is to analyze the data of air pollution in US and lung cancer. If necessary, programming and modelling might also be used to examine the trend of the disease and pollution, thus predicting the future situation. Other than that, the technological and moral side should also be analyzed. It’s necessary to research about the particular actions that countries have employed to effectively control the air pollution, and whether or not these actions are morally correct. (Johnson)

As for world implication, this analysis can alert people of the effect of air pollution on their personal health. In this way, people can have better awareness of protecting the environment, meanwhile, also protecting themselves.

Q3: How do you feel about your group mates and the expertise that they will be bringing into the group? Are there possible conflicts? How does your group plan on resolving conflict?

I think my group mates are excellent, and we all have deep understanding in our subjects. Our cooperation is nice and peace: although we experienced difficulties in forming our research question and finding appropriate database at the beginning, we solved this problem after doing more research and talking with our advisor. (Emma)

I think my group mates are knowledgeable in their fields and good at exploration about possible topics that they could done in their fields to support our study. They can use their knowledge to expand different aspects of our research and come up with possible research questions. There are not much conflicts in the discussion within our group but we have met some problems with data at the beginning of the research. We were hesitated about which data were the to choose and use to connect with our topics. For future discussion, we will need to make our decisions faster and assign works to each member clearly. (Lily)

Our research question is a great combination of the three subjects, thus each of us can analyze this question from different angles, chemistry, biology and computer science. Their knowledge about diseases, pollutant molecules will be extremely beneficial for our analysis of the correlation between air pollution and its effect on diseases. There wasn’t any conflict yet, we just spend quite a long time to decide our final research question. For example, we discussed about what pollutant and what disease specifically to choose, we both researched online and later on exchanged our opinions to come to a final solution. If there are any possible conflicts in the future, we are going to have a phone call to discuss our opinions. (Johnson)

Standard Algorithms and Sub-programme

In the past few weeks, we focused on learning basic algorithms in Java as well as sub-programme (method or function) and arrays.

Four key algorithms
In Java, we have four important algorithms that help us to search and sort in different approaches based on different situations:

  • Sequential search
  • Binary Search
  • Bubble Sort
  • Selection Sort

Sequential search

  • Sequential search can be known as linear search. We first get in touched with sequential search in the “battle ship” activity. Linear search is just simply examining through all elements in sequence and comparing them with the targeted element.
  • This algorithm is usually used for file reading
  1. Create an array with names inside
  2. Receive user’s input
  3. Assign variable i and found with value 0 and -1.
  4. The program will continue looping if value of i is smaller than array’s length and found is equals to -1.
  5. If user’s input is matched with one element in the array, value of found will be changed to i
  6. After the loop ended, using if statement, the program will decide what to output

For further explanation, we created a sequential sort program.


Binary Search:
This can only be used when elements are already sorted. This algorithm helps us to increase efficiency by halving searching range after every comparison.

Steps are shown below:

  • Designated variables with value of first, middle, and last index of the array
  • Compare search number with element located at position of the middle
  • If middle is bigger, move last to middle index – 1
  • If smaller, move first to middle index + 1
  • After the loop is ended, if found still equals to -1, the program will output that user’s input is not found in the array; otherwise, it will output user’s input is found in the array index found.
Java code

Sorting an array:

In order to increase the efficiency and avoid using sequential search for large arrays, we have bubble sort and selection sort. With these two algorithms, we are able to sort elements of an array in ascending or descending order, enabling usages of binary search.

Bubble sort:

  • This algorithm compares elements in pairs and swaps them if these two elements are in wrong order.
  • It will continue looping until everything is in the right order
Java code

We also created a trace table for Bubble sort:

Trace table

Selection Sort

  • Divide the array into two portions: sorted and unsorted parts
  • Variables for index of first unsorted element and the smallest (or largest) element
  • Only sort elements within unsorted range will be compared and swapped based on specific conditions
  • For every single loop, the value of index of smallest element will be assigned to variable “smallest”.
Java code

To compare selection sort and bubble sort:

Selection sortBubble sort
Fast and efficientSlow and inefficient
Item selectionItem swapping

One-dimensional Array
In Java, array can be used as a container that contains sequence of variables. Array contains variables of the same data type, which are called elements. Index is used to represent each element’s position (start counting from 0).

Declaration and Initialization of Arrays
We need two steps to create an array:
Declare a reference (specific address of the block) to the array:
dataType arrayName[];
Instantiate an array:
arrayName = new datatype[size];

Two-Dimensional Array (HL)

Two-dimensional arrays are arrays of arrays. We have arrays as elements in the array.

  • DataType[] [] arrayName = new DataType [] [];
    • First []: row
    • Second []: store column data in a row

As practice, we did some exercises on 2D array.


  • Methods:
    • It has header and body parts (containing declarations and statements). For the header part, it tells us the visibility to objects of other class (whether private or public), whether the method returns a result (having specific type or void), method name, and whether the method takes parameters.
    • Sub-program contains instructions in sequence that perform a specific task, which is predefined before we write the main program.
  • We have other names for different computer programming languages: sub-procedures, function, routine, method, modules…
  • Parameters: They are another sort of variables inside bracket of methods’ headers, which receive values from outside of the method.
  • Arguments: values of expressions passed to a method, corresponding with parameters of the method.

We have three types of method:

  • Accessor: being used in order to return current values of object data in fields. In this case, they return String value of title and author to the main program.
  • Mutator: “Set” method that can change values of object data
  • Utility: other sorts of methods that accomplish a variety of tasks.

Benefits of Methods:
1.Reducing programme duplication
3.Easy for team to cooperate: People can work on different parts of the program and combine them together
4.Code reusability: When we are writing sub-programs, they can still be used in future projects.

We also did some exercises on OOP and methods:

This part of Java starts to get interesting because we can add more function to our code and can have more user friendly interface. But still, I am not very familiar with OOP concepts and methods, and that’s something I need to improve in the future.

Java Looping

This week, we focused on the input function—Scanner class and the looping of Java. The pace is getting faster and faster, so I think it’s really important to read ahead the Java illuminated book.

Scanner class
Scanner class can read byte, short, int, long, float, double, and String data types. It uses java.util package, thus enables users to enter the numbers to the program. Here is the typical example of how to use the Scanner class.

import java.util.Scanner;
Scanner keyboard = new Scanner (System.in);
num = keyboard.nextInt();

By writing 3 statements above, we can use Scanner class in our program to allow user to enter input. There is an exercise that we did in class to calculate the average score for students in the class.


Looping methods

  • While:
    By using while statement, algorithm within the while code block will continue to be implemented until conditions in parentheses after “while” is not true.
  • Do-while:
    It is similar with while statement. The only difference is that do-while will first perform the calculation once no matter the condition satisfies or not, whereas while statement checks conditions first.
  • For loop:
    For loop simplifies the content in while and do-while loop. Because for loop can be used for definite loops when the number of iterations are known.

hasNextInt() method can check if users’ input satisfies the requirement. It will returns true if the number entered is an integer. Similarly, there are also hasNextBoolean() and hasNextDouble().
int or boolean or double value, the program won’t stop and display the error; instead, it will continue asking the user to enter a String value until the input is a String value.

Guessing game

I used two loops in this guessing game, while and do-while, also here the random method was introduced.

As shown in line 8 and 16, I firstly imported Random, then typed “Random ran = new Random();”. System will randomly pick a number between 0 to 100;

Guessing game

We also created a program that output estimated height of a male or female child based on height of mother and father.


Java escape sequence

In Java, we have different escape characters to perform different following outputs:

Escape SequenceDescription
\tInsert a tab
\nInsert a new line
\’Insert a single quote
\”Insert a double
\\Insert a backslash

Implicit casting: when two types of data are compatible, java will automatically convert one data type to another when one type of data is assigned to another.

Explicit casting: In order to promote precision whenever required, we use this syntax: (dataType) (expression) For example,

average = (double) total / count;

Shortcut Arithmetic Operators

Shortcuts and simplify our code and make it looks better.

  • (++): increment by 1
  • (–): decrement by 1
    • Postfix: (var++, var–): use original value in expression, and then do the increment or decrement
    • Prefix: (++var, –var): increment or decrement first, then do the operations. e.g.
for ( int i = 0; i <= 100; i++ )

Logical operators
This part is highly related to the logic gates that we learned few weeks ago. It can be used to compare the true or false of statements.

See the source image
Logical operators

Here is how we perform logical operators in BlueJ.

Logical operator

Some exercises that we did are shown below:

Calculate cost with inflation rate
Convert meters to feet
Print out prime numbers from 2 to 100

The looping part for java is quite straightforward, because I’ve learned those in c++ and python, so it would be quite easy to understand. However, some of the problems may have various approaches, and it’s difficult to determine which one is the best or the most efficient way, so this is something that I need to improve in the future.

Pseudocode, Trace Table, and Intro to Java

In this week, we further developed our understanding about pseudocode and flowchart, which we have learned a bit in grade 10. Also, we finally start learning the high-level programming language, java.

Here are some definitions of key terms that we learned this week.

  • Algorithm: It is a set of step-by-step instructions that is used to solve problem.
  • Properties of algorithm:
    • Finiteness: The algorithm should be able to be completed in a reasonable number of steps.
    • Definiteness: Each step of the algorithm should be unambiguously and rigorously defined
    • Input: Before the algorithm begins, there should be quantities given initially
    • Output: After certain steps of algorithm finish their implementation, there should be quantities that have special relationship with inputs
    • Effectiveness: the algorithm should be able to be done with basic principles in a finite range of time
  • Expressions for algorithm:
    • Natural language: Expressed in simple english. It can be easily understood by human beings.
    • Flow chart: Use graphical elements to show the logic of code. For example, rectangles, parallelogram, etc.
    • Pseudocode: Generic artificial language. It’s useful for users to pre-design the code before they actually write it.
    • Programming language: It is a type of artificial language that is used to communicate the computing system, such as Java, Python or C++.

Decision making process:
In order to generate algorithm, the decision-making process has always played an important role. The decision-making process includes four steps:

  1. Identification: To recognize, understand, and formulate the problem
  2. Development: During the process of seeking solutions to the problem, we can explore different approaches to the problem
  3. Selection: In order to address the problem in the most efficient way, we need to choose the most suitable alternative as final solution
  4. Implementation: After we choose the solution, the only thing we need to do is to carry it out.

There are some exercises of pseudocode on the slides, but because we already did them in grade 10, we skipped it.


Linear&Binary search

We did some activities on battleship in this class to explore search methods.
As the picture shown, each student has 26 ships, labeled with specific letters and numbers. By having two students in a group, student A will first give student B a number, and student B will do the same thing. Then, two students start to guess which letter the ship has, corresponding to the number given by the other initially. If the guessed letter is wrong, the other student will tell the guesser what number the ship with guessed letter has. If the letter is correct, then the guesser wins the game.


When numbers are arranged in ascending orders, we are able to compare the inquiry number with original number, and then narrow down the potential range of ships. By halving intervals, binary search greatly helps us to enhance our efficiency for sorting.

Trace table:
In order to test whether the algorithm is valid or not, we use “trace table”, a technique that includes all conditions and variables of the algorithm and records outcomes of the trial test process.

Trace table

So the steps to create a trace table is to first write down all the variables in the code, then put the initial value in the first raw. Follow the logic of the statement and write the result after each statement, then output the final value.

This is also a concept that we have learned in grade 10. But we add two new concepts here.

  1. Method Call: We use a name to represent a function of a group of instructions, instead of more detailed content (abstraction).
Screen Shot 2018-10-27 at 11.12.05 PM.png

2. Connector: If there is no enough space when we are drawing flowchart, we can use connector by drawing two dots at two different places to connect separate parts and continue the flowchart.

Screen Shot 2018-10-27 at 11.12.09 PM.png

The picture above includes all the representations for flowchart.

Flowchart Homework

Intro to Java:

What is Java?

  • It is a high-level programming language
  • Source codes are written on a plain text with java. extension
  • It has Java Virtual Machine (platform dependent), including compiler and interpreter, to run source codes on computers:
    • Compiler: converts source into bytecodes (.class file)
    • Interpreter: converts bytecodes into machine language
    • Has API (application programming interface): contains a collection of packages, providing useful capabilities (arithmetic calculations…)
    • Case sensitive & strictly typed: For example, a and A is different in Java

In-class Quick Search
Java SE vs. Java EE:

  • Java SE stands for Java Standard edition, mainly used for designing desktop applications
  • Java EE is built based on Java SE platform, which provides API and runtime environment for developing and running applications

JDK vs. JRE:

  • JDK stands for Java Development Kit, which includes everything of JRE, compiler, and other tools, capable of creating programs.
  • JRE stands for Java Runtime Environment, it is a package including various things: JVM, Java Class Library, Java command, and other infrastructures.

Integrated Development Environment (IDE)

  • It is a software application that consist of compiler, program compiler, and a run-time environment. All these components are combined by Graphical User Interface.
  • With all these facilities, IDE is used to develop programs.

I tried Eclipse during summer holiday. In our class, we use BlueJ.

As usual, our first program is called HelloWorld.

  1. The first 7 lines are basic descriptions of this program, which are convenient for programmers to know the main purpose, author, and also version.
  2. The section between {} is called code block. For example, section between line 10 and line 15.
  3. In line 10, we have “public static void main(String [] args)”. This is necessary for all Java programs.
  4. In line 12, we have a statement ends with a semicolon: system.out.println(); to print out the result.

Three types of error:

  1. Compiler errors:

Usually caused by syntax error. For example, for the “HelloWorld” program, if I delete the semicolon after the “System.out.print()” statement, it will appear an error message.

Screen Shot 2018-10-30 at 9.04.28 PM
  1. Run-time errors:

This type or error occurs during the process of running the program, this error is caused by invalid data or incorrect use of prewritten classes.

  1. Logic errors:

This type of error causes the program to be operated incorrectly.

Typical Program Structure

  • In a program, we have input, processing, and output.

General steps of writing and implementing a program:

  1. Identify data we know
  2. Identify data we need
  3. Declare variables’ names
  4. Initialize the value of any possible identifiers
  5. Processing the data
  6. Output the final result

Good Programming Conventions
Similar with previous parts, in order to have an efficient programming process, we need good practices:

  1. Beginning of every program should include description of program’s general purpose, author’s name, and the latest modification date.
  2. // for single-line comment and /* for multiple-line comment
  3. Use white space (space, tab, newline) to increase readability
  4. First letters of all words in class names should be capitalized, and there should be no space between words.


Identifiers are names given to things like variables, methods, and classes.

  • Declaration of a variable: In order to declare a variable, we need to include name, type (int, double, boolean…), and specific value that is assigned to this variable.
  • Name: It must begin with a lower-cased letter, a dollar sign, or an underscore (_). In addition, except the first word, all words’ first letter should be capitalized. Numbers are permitted, but no space and other special characters.

Java Keyword

In order to carry out different functions to attain different purposes, we have different keywords in Java, which cannot be used as identifiers. Here is a chart of frequently used keywords:

See the source image
Java keywords

Primitive Data Type
Primitive data includes following 8 types:

  • byte: shortest integer number we can declare (8 bits)
  • short: (16 bits) medium integer
  • int: (32 bits) longer integer
  • long: (64 bits) longest integer
  • float: (32 bits) for decimal numbers
  • double: (64 bits) compatible with all primitive data type except Boolean
  • boolean: true & false
  • char: stands for character (16-bit Unicode)

Java Operators:
Java operators are special symbols that are used to perform special operations. There are four types of operators:

  1. Arithmetic operators: carries out calculations
    1. Add, subtract, multiply, divide
    2. Operation precedence (same with precedence in math)
  2. Concatenation (+): used to connect Strings
  3. Logical operators: operating on Boolean values
    1. &&(AND): if both conditions are true, the result is true; otherwise it is false.
    2. ||(OR): The result is true if both or one of conditions is true.
    3. !(NOT): if the condition is false, then the result is true
  4. Assignment operator (=): we use this operator to assign value on the right side of the operator to variable on the left side.

Computer science continues to make more sense as we can connect all different knowledge together, like logic gates in Java. It’s so excited to get in touch with Java, I hope I could continue improving my programming skills so that I can be better prepared for IA.

Computing Components

We learned some basics about computing components last year in grade 10. In the past few weeks, we dig deeper into the CPU and learn its structure and how data flows in CPU.

Input, process, storage, and output concept

Input Process Storage Output concept

The only thing, compared to the IPO model that we learned previously, that adds to this diagram is the storage part. Storage part enables computers to either store the data in storage or fetch data from it during processing step.

The main term for this unit is the CPU. The central processing unit is the key component of the computer because it contains circuitry that can interpret and execute program instructions.

Main components of a CPU

  • Control unit (CU): It is like the commander of the CPU that decodes instructions and controls other components for example ALU
  • ALU: It is the core of the CPU that carries out arithmetic and logical calculations for example AND, OR and NOT.
  • Registers: Registers are fast temporary storage inside the CPU. Also, by using different logic gates, CU decode instructions into signals; then, it directs data flow and operation of the ALU.
CPU block diagram

Primary and Secondary Memory

Primary memory directly connects to CPU, which includes register, cache, RAM, ROM, and also virtual memory. (Register will be discussed later in this post)

  • RAM: it stands for random access memory, which contains addresses representing instructions, numbers, and letters. The data stored in RAM can be overwritten. However, RAM is a volatile memory, which means the data will lost if power is turned off.
  • ROM: Read-only memory. ROM is used to store data that cannot be overwritten. ROM is non-volatile memory, and because the data stored cannot be changed, it’s mainly used to store data that do not need to be updated.
  • Cache memory: Cache memory is small in size, it has high speed and used to hold frequently used data inside the CPU. It can also be known as SRAM (static RAM). There are three different levels of Cache: L1, L2 and L3. L1 Cache is usually inside the CPU, it’s small and can be fast to access. L2 and L3 Cache are bigger in size and takes longer time to access. Cache memory saves fetching the instructions and data repeatedly from RAM so that it can speed up the process.

We later on compared RAM and Cache memory in class.

Virtual Memory:

  • A type of memory technique that utilizes storage available on a machine to free up spaces in RAM to store more data. With virtual memory, the computer is able to look for areas of RAM that have not been read or written recently.
  • Virtual memory uses secondary memory to extend the capacity of Primary memory.

Secondary memory(or can also be called as auxiliary storage) are non-volatile memory that includes HDD/SDD (Hard disk drive and Solid state drive), Flash, and CD/DVD. Here are come characteristics of secondary memory:

  • Slower speed compared to primary memory
  • Higher capacity
  • Not directly connected to CPU
  • Cannot function without the existence of primary memory

The need for persistent memory

Persistent memory is necessary and important for the computer. Because primary memory can only be used temporarily, which means data will disappear from the computer when the power is turned off.

Later on we talked about the booting process.

  • Fire up power
  • Look for address in BIOS
  • BIOS starts checking
  • If everything is OK, finds hard drive and finds operating system
  • Loads up kernel to the RAM
  • Kernel loads up operating system
  • GUI (graphic user interface)

There are five registers inside the CPU

  • MAR: MAR stands for memory address register, which is a one-way register that contains address that is currently being read or written.
  • MDR: MDR stands for memory data register, which is a two-way register that contains data that is fetched from memory or is to be stored in the memory.
  • Accumulator: It holds the immediate result of the ALU.
  • Program counter: It holds the memory address of the next instruction
  • Current instruction register (CIR): The memory that was just fetched from the memory and currently being decoded by CU.
CPU diagram

Through this connection, CPU fetches data from memory, performs instructions, and stores information back to memory.

In class, we watched a video on Youtube about how computer CPU works.

3 video.png
Youtube video

CPU reads memory:
1. CPU sends address to the RAM
2. CPU turns on the enable wire
3. RAM sends data of that address back to CPU through data bus

CPU writes memory:
1. CPU sends address
2. CPU sends data
3. CPU turns on set wire
4. RAM replaces original addresses with new data

Machine instruction cycle

Machine Instruction Cycle can depict the process of how CPU runs a computer program:

  • Fetch instruction from primary memory to CU
    MAR –>Primary memory–>CU
  • Decode instruction in CU
    Fetch additional data if needed
  • ALU executes instruction
  • Store results in the memory and continue the cycle
Machine instruction cycle (Mr.Pete slides)

Little man computer and programming in Assembly language:

Little man computer is a website that can test our understanding of the working process of CPU. We use assembly language to perform arithmetic calculations in LMC.

The left column is the place where we write code, and the right column shows the step, instruction, and correspondent registers. The right side of the graph contains input, output, CPU (containing program counter, IR, address register, and accumulator), ALU, and 100 registers.

When writing code, we use stipulated abbreviation to represent instructions:

  • Inp: input
  • Sta: store data to specific register
  • Add: add number in accumulator with data that is stored previously into the register
  • Out: output
  • Hlt: halt. Stop the program
  • Dat: data. We need to write “a sta” to tell the computer that “a” is a data.
  • LDA: standing for “load”, which instructs CPU to load and store data being fetched from specific register into accumulator.

TASK 1: A + B + C: I input A as 1, B as 2, and C as 3.

EXAMPLE 3 (1).png
Task 1

TASK 2:(A+B) + (B+C): A is 1; B is 3; C is 5; D is the sum of A and B

Example 3 (2).png

TASK 3: A multiply B


TASK4: A divided by B


To sum up, compared to grade 10, we dig much deeper into how CPU works ,we finally know how exactly the computer receives input, generates data flow, and outputs results. And this is the part that I thinkI need to constantly spend time to review in the future. The LMC activity is really fun!! Looking forward to JAVA!!!

Boolean Expressions, Logic Gates and Truth Tables

This week, we learned about how the computer thinks. That is, how computers logically process the information by using logic gates. Later on we learned transistors in the computer and how computer add numbers.

But before I start to talk about the main topic, I’m going to briefly mention the poster that we made, which is about image, audio, and video representation. I was in charge of numbers and small portion of characters, as well as the connection between those two. Our goal is to display as many key terms as possible on the poster, thus we choose roughly 3-5 from each topic and combined together to find the relationship among them. About making this poster, the primary purpose was to learn and to reinforce our memory about these key concepts. Besides, I also learned how to cooperate with other people, as there wasn’t much time for us to spend time together to discuss and plan the poster, thus the ability to use time wisely became extremely important.

Now, it’s time to introduce the main topics of this blog: Boolean Expressions, Logic Gates and Truth Tables.

What is “thinking” and how can a computer “think”?

Regarding to computers, in order to make them more efficient of solving problems, they also need to have their own logic to process and make decision. Based on this approach, accordingly, Boolean algebra was introduced by George Boole, an English mathematician, in 1847. For binary code that computer uses, Boolean algebra has two values for variables: true (1) and false (0).

Boolean Expressions, Logic Gates and Truth Tables

Here comes some key terms for this topic.

  • Gate: A device that receives input, performs calculation and then gives output
  • Boolean expression: A notation for expressing two value logic
  • Logic diagrams: The graphical representation of a circuit
  • Truth tables: A table that indicates all possible values of output

Types of Logic Gates

  1. NOT gate: This gate returns the opposite of input
    Boolean expression: X=A’

    Truth table
Image result for not gate
NOT gate

2. OR gate: This gate receives two input; if either one is 1, the output will be one; otherwise the output will be 0
Boolean expression: X=A+B
Truth table

Image result for or gate
OR gate

3. AND gate: This gate receives two output, if both of them are 1, then the output will be 1; otherwise it will be 0.
Boolean expression: X=A*B
Truth table

Image result for and gate
AND gate

Based on these three gates, we did some extra exercises.



4. NAND gate: This is the combination of AND and NOT gate; if both are I, the output is 0; otherwise, the output is 1.
Boolean expression: (A*B)’
Truth table

Image result for NAND gate
NAND gate

5. NOR gate: If both signals are 0, the output is 1; otherwise the output is 0
Boolean expression: (A+B)’
Truth table

Image result for nor gate
NOR gate

6. XOR gate: Similar to OR gate; if both two signals are 0s or 1s, the output will be 0; otherwise, the output is 1. (Key word: neither & exclusive)
Boolean expression: A(plus sign and circle)B
Truth table

Image result for XOR gate
XOR gate

Later on we did other exercises to strengthen our knowledge in logic gates.


Real Life Examples of gates

NOTAutomatic door: if there is no people, close the door.
ANDWhile going out of the house you set the “Alarm Switch” and if the burglar enters, if both switch and detector are on, the alarm will perform its function
OREither FaceID or password can open IphoneX
NANDIf both finger print and password are correct, the computer will be unlocked
NORIf either water level or temperature, or both are not reached, the cooker won’t stop cooking.
XORThe light switch at front door and back door can both be used to control the lights.

Transistors & Combined Gates

A transistor is a semiconductor that acts like a switch in the circuit.  Being consist of three terminals, transistor switches electronic signals.

By using transistors, we can construct logic gates and we simplify boolean expression. That is we can put lots of values altogether by calculation to a single output. Gates are combined into circuits by using output of other gates for inputs.

I will mention three properties of Boolean algebra to simplify Boolean expressions.

  • DeMorgan: Not a or Not b = Not (a and b)
  • Distributive: a and (b or c) = a and b or a and c
  • Simplification: A or A’ and B = A or B

Adding Number in Computers

Using all the gates above, computers can create XOR, half adder and full adder to add numbers in computers.

XOR: It’s called here “equivalent circuit”, because the circuit does not directly use XOR gate but uses other gates to make one up.

Half Adder: A simple half adder consists of one XOR gate and one AND gate.

Image result for half adder
Half adder

Truth table is below


Full Adder: By using an additional OR gate, two half adders can be combined to form a full adder.

We also did some demo on Logic.ly/demo to create our own ladder.


After learning this section of computer science, it’s quite a shock for me. I learned a little bit about logic gates in grade 10 while doing project, and I thought it was only used to determine whether a statement is true or false. I didn’t notice that those logic gates can combine together to do calculations for the computer. This week’s lesson is not only useful for us to learn how computer thinks, but also makes me more logical when facing issues.


This week we mainly focused on data representation, to be more specific, how to convert numbers to different bases; how does computer store the information and data.

We start off by introducing the categorization of numbers, in which consists of natural number, negative number, integers, rational number, and irrational number, and real number. But computers does not involve much with irrational numbers.

Number classification

Positional notation: Based on different bases, different numbers will have different value for their digit number and value of digit positions.

For example, decimal number 145, 1 is on the third position, 4 on the second position, and 5 is on the first position.

Here is the formula:

Positional notation (PETE 8)

Because of the positional notation depends on different base, there are binary numbers (base 2), octal numbers (base 8), decimal numbers (base 10), and hexadecimal numbers (base 16).

  • Decimal is base 10 and has 10 numbers: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9
  • Binary is base 2 and has 0, 1
  • Hexadecimal is base 16 and has 10 numbers and 6 letters: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F. Letters A to F represent 10 to 15 repectively.

if we want to convert a number from other bases to decimal, we use the equation mentioned above.

Binary to decimal

Arithmetic in Binary:

Just as same as doing calculations in decimal, binary arithmetic will also include carry and borrow.

Addition in binary

Converting binary to octal and hexadecimal

It is related to the power of two. We all know that 8 is equal to 2 to the power of 3, and 16 is the power of 4. when we want to convert binary to octal or hexadecimal, we can simply divide all the numbers (binary) into 3 or 4 in a group, and then convert them. For example, converting 011010110 into octal.

Binary to octal

Converting decimal to other bases

  • Divide the decimal number by the new base
  • Place the remainder at the right
  • Write the remainder from bottom to top

An example is given below:

Decimal to octal



The storage units for computer is called binary digits, or bits. When we are referring to speed of sending and receiving information, we use bits.When referring to volume, we use byte.

Byte = 8 Bits

Bit & Byte

Representing negative values — Two’s complement

  1. Use 8-bit register to firstly convert the decimal value into binary (the 8thposition is reserved for positive or negative sign)
  2. Replace all 1s with 0s and 0s with 1s for the first 7 positions
  3. Add 1 (first 7 positions)
  4. Change the 8thposition from 0 to 1 to have the negative sign
Two’s complement

Representing natural numbers

In order to prevent overflow (bits are more than computer can process), computers store data in fixed-size chunks, which conventionally is 8 bits. We can simply convert decimal number in to binary when we are storing natural number.

Data Representation

In computer science, we kept learning what exactly is a computer. A computer is not only a machine that can process the data from input and provide output, but also a multimedia that can represent and store various types of media by using binary digits. For example, texts, image, audio, video, etc.

  • Analog data: A continuous representation of actual information in daily life. For example, if we want to record the change of the hight of surface of water, because the data is constantly changing, it’s continuous.
  • Digital data: A discrete representation of data, which breaks information to separate elements. Digital data only has high and low state, corresponding to the binary digits.

In addition, in order to let computer “understands” analog signals, we digitize them, breaking them down and representing them separately.

PETE (9)

Representing Text:

  • Character sets: Characters and codes to represent each other
  • ASCII character set: American Standard Code for Information Interchange. Originally uses 7 bits, allowing 128 characters. Later on it evolved to 8 bits.
  • Unicode character set: uses 16 bits per character, allowing more characters to be involved and represented.

Representing Image:

  • Bitmap
  • Vector
  • Colour depth
  • Resolution
  • Metadata

Representing Audio:

  • Sample rate
  • Bit depth
  • Bit rate
  • Codecs

Converting analog audio to digital

  • Pulse code modulation
  • Sampling
  • Quantization
  • Encoding


  1. Reduce space required
  2. Faster transfer
  3. Encoding using fewer bits
  4. Compression ratio: Size of compressed data over original data
Does not return data to original
Returns data to original content
Information loss is tolerableNo reduce in quality
Used by images, videosUsed by databases, emails
JPEG, MP3Huffman, Run-Length

Compression advantage:

  1. Storage
  2. Speed
  3. Protection
  4. File transfer
  5. Archiving
  • Keyword encoding: replace constantly appearing patterns with special characters.
  • Run-length encoding: replace repeated sequence with a flag. e.g. *c6kkk*o8
  • Huffman encoding: listed in decreasing order of use. Use a tree to represent.
Huffman encoding

Poster assignment

The end of this unit is to create a poster that includes all the crucial information in data representation. I am in charge of numbers and a part of character, as well as the connection between those two. It was quite hard to put all those separate information and keywords together and connected at first, so we spend quite a long time on planning and designing. But eventually, we still miss some keywords and definitions, as well as it is not very visually attractive. (We forgot to take a picture of our poster)


This unit is quite important for future understanding of more complex topics. Because computers heavily rely on representing data in binary, as well as compression of data. I believe those knowledge will be a foundation for future learning.


WEEK 1: The Big Picture

I am always excited to explore something new in my life. Specifically, the upcoming two-year learning of IBDP computer science provides me with a perfect opportunity to to learn every detailed information about computers and how to use computational thinking in my daily life. Spending hours reading sample IAs during vacation really stimulates me and lead me to be even more interested in this subject.


This week started off by learning fundamental terms in IB computer science. All of them play an important role in helping us to express the idea more precisely in tests. Among all the words, I consider three of them to be especially essential.

  • Discuss: Offer a considered and balanced review that includes a range of arguments, factors or hypotheses. Opinions or conclusions should be presented clearly and supported by appropriate evidence.
  • Evaluate: Make an appraisal by weighing up the strengths and limitations.
  • Interpret: Use knowledge and understanding to recognize trends and draw conclusions from given information.

I believe that these three terms are vital for us to understand the requirement of the question. In real tests, it’s possible that the question will ask us to give definitions to certain terms and expand it, different verbs usually stands for different requirements of details. For example, if the question asks us to ‘discuss’, we usually have to expand the explanation in a detailed and structured format.


  • Decomposition: To break down a issue to several smaller parts in order to solve more efficiently and effectively.
  • Abstraction: To select relevant information to the problem.
  • Pattern Recognition: Find the similarities among smaller parts of the problem.
  • Algorithmic Thinking: Use logical instructions to solve the problem effectively.


The majority of knowledge in this part has been covered in grade 10 Computer science, so there isn’t much difficulty learning this aspect.

  • Computer: A Device
  • Computing system: A dynamic entity, composed of hardware, software and data, to solve problems and interact with environment.
  • IPO model: Input-Process-Output model.
  • Hardware: The physical components of a computing system.
  • Software: Programs that provide instructions for computers to follow.
  • Information&Data: Information is the processed output of data, while data is the raw material for the computers to process.


  1. Information: Data represented by machine language, binary numbers.
  2. Hardware: Physical elements of computer (e.g. CPU, logic gates, circuits)
  3. Programming: Instructions that help to do computations and manage data.
  4. Operating systems: The platform that manages resources and interact both users and software.
  5. Application: Programs that help users to solve real-life problems.
  6. Communications: Computers share information and resources with each other.

ABSTRACTION: Model that removes complex details. This model will filter out the details and characteristics that we do not need.


-Computer Generations-

  1. First Generation: “vacuum tube”— requires a lot of space, also generates heat that made it unreliable. The primary memory device was a magnetic drum, an input device was a card reader and finally the output device was pubched card or a line printer.
  2. Second Generation: Transistors — smaller, faster, cheaper, more reliable and durable than the vacuum tube. This generation used memory made from magnetic cores, which made information available instantly.
  3. Third Generation: Integrated Circuits — solid pieces of silicon that contained the transistor. The adaptation of silicon pieces made it become more reliable and efficient. Later on, Moore’s law appeared, which was defined as “the number of circuits that could be placed on a single Integrated Circuit was doubling each year”. This is quite unbielievable that computers are able to develop so rapidly in a century.
  4. Fourth Generation: Microprocessor —  a whole microcomputer was moved on one chip. By the late 1970s, personal computer became more popular, microcomputers enable people to have one computer of their own.
  5. Fifth Generation: Artificial Intelligence

-Computer Software Generations-

  1. First-generation software: During that time, machine language and instructions were built into electrical circuitry. At that time, programmers were mathematicians and engineers, programming was both time-consuming and prone to errors because of machine language. So later on, the first artificial programming language was developed—assembly language. Programmers that wrote tools to make programming easier were the first systems programmers.
  2. Second-generation software: The invention of high-level languages, allowed programmer to write instructions using more English-like statements. Two main languages during that time were FORTRAN and COBOL, and they are still being used today. During this generation, the roles of programmers have been defined into two types: System programmers and application programmers. System programmers wrote tools like assembler and compiler, and application programmers used the tools to build programs.
  3. Third-generation software: In this generation, system software has been developed. The separation between user and the hardware was growing wider. The computer system–a combination of hardware, software and data– had emerged.
  4. Fourth-generation software: This generation saw the introduction of programming techniques called structure programming. For example, C++, PASCAL allow users to access to both low-level and high-level statements. New application software for users also appeared, for instance spreadsheets, word processors.
  5. Fifth-generation software: In this era, three things have developed. The tech giant, Microfost, together with object-oriented design and world wide web. Moreover, users do not have to have any computer knowledge in this generation.


At the end of the first generation, systems programmers developed tools, while application programmers used those tools. Except those tool makers, everyone is using the computer as a tool. As practitioner, they must be skilled in four areas to use computer as a discipline.

  1. Algorithmic thinking: Express problems in a logical and step-by-step procedures.
  2. Representation: Store data that it can be processed efficiently.
  3. Programming: Combine algorithmic thinking and representation into computer software.
  4. Design: Software serves a useful purpose.


Digital divide is a term stands for the gap between different places and people that can or cannot have access to technologies.

With the development of programs like one-laptop-per-child and E-rated program, people from rural areas are more likely to get access to computers and internet. Without the help of the internet, those people will be invisible and unknown to the rest of the world. For most of the developing countries, the percentage of people having no access of technologies is high. With the technology continually advancing, the issue of the “digital divide” cannot be ignored. In our society, where the distribution of wealth is already heavily unbalanced, access to computers and the Internet is unbalancing the situation even more. 

Speaking of my own plan, as a matter of fact, I don’t have much funds and reputation to establish such well-known programs. But I think it’s really essential to change people’s perspectives on computers and internet. It is highly plausible that people from those poorer regions consider internet as an useless tool. So I believe this issue can be solved in two steps. First, it’s important to let people know that there is a group of students and citizens that are unable to get access to those technologies. No matter by posters, videos or websites, people should all be awared of the current situation. Second, I think we should get in touch with those people in rural regions and give them a chance to experience technologies. It’s likely that they will realize the importance of technologies.

The picture below is a word cloud we made after watching the video and reading the textbook.


  • Control system: by using control loop, a control system is a device or set of devices that manages and commands behaviors of other devices.
  • Physical quantities are inputs that when be then converted
  • Transducer (sensor): It converts physical quantities into electrical signals.
  • ADC: stands for Analog to Digital converter that converts analog signals (speed, temperature, etc.) to digital signals.
  • Processor
  • DAC: it converts digital signals to analog signals, which is exactly the opposite to ADC.
  • Transducer (actuator): this transducer converts electric current into motion that leads to following output.
  • Output: physical quantities
The control system graph

There are mainly two types of loops: open loop and closed loop.

Open loop: its control action is independent of output of the system. For example, we set a washing machine, it will not stop until the time run out.

Closed Loop: Different from open loop, it generates feedback itself that will go back and function as an input quantity; For example, for a air conditioner that has temperature sensor, if the room temperature higher than setted, it will automatically turn on.