| No Comments

As I talked in the blog1, I think testing is one of the most important parts in programming. Unit testing is a method by which individual units of source code are tested to determine if they are fit for use. For example, we test our code (which is testable like a complete function or procedure) very often when we finish any part of our Iterations.
The biggest and most obvious reason for writing unit tests is instantaneous gratification. When I write code, I love to know that it works and does what it should do. If you are writing a smaller component of a big project, how are you even supposed to know if what you just wrote even works or not? Even the best engineers make mistakes.
I can write my code relieved with unit tests. Then just run my tests, within a second or two, I have the results, telling me that everything passed or what failed and at which line, so I know exactly what I need to work on. It just gives you a safety net to fall back on, so you don't have to remember all the ways it is supposed to work in. Something tells you if it is or not.
CxxTest is one way to do unit test. It provides a method to test if everything gets proper result before the programmer goes to the next step. At first, I really confused how to use it. After reading some instructions and the examples, I found it quite easy to use. If we want to do a successful Cxxxtest, we have to think about how to cover all of the cases, because it is useless that there is no bug being found. Only you find bug, can you fix it.
I remember that I used to write code without unit testing. When I test it after I finish them all, I got too many error that it is almost impossible to fix it. I really want to pull my hair out. And when I do the iteration 1&2, I do unit test a lot. So it is much more comfortable when I combine them together to get the final version. So I recommend that do unit test when you write code, although it will take you some time.


| No Comments

We have used subversion as part of developing our project. From my perspective, source control is the management of documents, projects and other information stored as computer files.

Version control system is like a "time machine". It stored every version of our projects in the repository as long as we submit it. The repository is like an ordinary file server. But the difference is that it keeps a record of the changes made over time so that we could restore the data to the previous version, then check and change the detail of it.

Subversion is one of the version control systems. So it has all the properties of Version control system. We can visit the repository via internet so that we can work on our project in different computers.

The power of source control is clear to see. First of all, we can work on our project in different computer at the same time. For instance, in interation1, my partner and I did the different part of our project, and then we just submit it to the repository. Then we could see each other's work via internet. So it can speed up the development of our projects. Second, since it keeps every version of our work, we don't worry that we make some mistakes on our project because we can roll back easily. Sometimes, some bugs only present in current version. We could use the version control system to get the previous version of it and find out what are the differences between them for fixing bugs.

If you want to use the subversion, there are some tips. First of all, you should know how it works and be familiar with the common operations. Besides, there are two things worth to mention when I use the subversion. When I want to submit iteration1 to the repository, it was a tough work, because when I copy the folder to my workplace from different location, I also copy the hidden ".svn" files. The way I solve this problem is that I just copy files which I selected rather than the whole folder. The second thing is that pay attention when you are working on a same code at the same time. You can work on it in a controlled manner or it is easy to make mistakes and conflicts.

Blog 2

| No Comments

There are a lot of differences between working together and working individually.
Obviously, there are some benefits of working together. One of them is that it can accelerate the speed of coding. Two people work on one program, so that we can take responsibility of different part. We can implement different part at the same time. Then we put different part together to get the final one. Besides, when we encounter some difficult problem we can discuss it to get a solution. If we do it alone, we might get stuck in it because of the limited of thinking.
Another benefit is that we have more choice when we solve a question. Two guys may have to different ways to solve a problem. We can determine which one is better after discussion.
Meanwhile, some challenges come to us. I think that communication would be the most challenging thing. Since we don't work alone and everyone may have different method to solve it, we have to share the idea about how to implement the scanner to each other. We can't do this project in different ways. It won't be efficiently. What's worse, we might even not be able to get the expected result.
Besides, we have to determine the specific name of each function and elements in enumeration before getting start. It is kind of waste of time to change the names after the project is done.
So the way we deal with the challenge is that we get a framework before getting start and we do the enumeration part first, so we can name elements properly in different functions.
We think this method works well. After thorough preparations, we can do different part of the project at the same time. And when we put them together, they work well at last.
About communication during programming, another important thing I want to mention is good comments. Sometimes we have to read partner's program when we do our part. So, good comments would be very important. We can't read and use others function efficiently without a good comments. So when we write the program we attempt to write clear comments.
Another challenge comes to us when we want to combine different function together. Since we write these functions separately and we are not familiar with partner's code , when we put them together, there is a lot of error to debug. Some are caused by the head file. Some are caused by using different variable name when a function calls another function and so on.
It is hard to avoid. One thing we can do is improving our skill of programing. The other way is also writing good comments. I think we can add comments about what is the input and output of the function. It is clearer so that we would not call the function in a wrong way. This would solve the problem to some extent.

Blog 1

| No Comments

After reading course description, I got a general understanding of this course. It is interesting. And I am eager to learn most of them. And actually, I have already know some of them before this course, like adherence to program style and layout specifications, and writing loops, and code in general, that are easy to understand. When I take a class introducing program language C++ in my previous university, professor Xu always emphasized that we should write our programs in a good program style and write loops, and code in general. He said that a good program style could help programmers to read and understand the source code, and it could eliminate errors. So we are asked to write programs in the way he showed us. And I think it is really useful for programmers. I impressively realize the advantage of it when I read someone else's program. If she/he write it in a comfortable style, it is easy to read and understand. If not, although it works, it is hard to understand. So I like writing programs referring to the sample in the text book.
After read the description of this course, I think "testing frameworks, writing good tests" would be very interesting. Last semester, my partner and I write an AI for a game. After we finish it, we write many test code to run it, and take part in the tournament. And we didn't find any bug. However, when it participates a formal game, it crashes. So I was really confused. I want to know how to write a testing code. I believe that there must be an effective method to write a testing code which covers all of the possible situations so that we could avoid cutting down the chain at the critical moment once more.
Besides, I am interested in writing effective comments. Sometimes, I have to read my program again to figure out what I am doing. So I realize that if I can write clear comments, I could save much time. Since I am from non-English speaking country, I have to give writing effective comments more attention.

Recent Entries

Find recent content on the main index or look in the archives to find all content.