Tuesday, November 27, 2012

The Essential Process of Debugging

According to Chapter eight (“Defensive Programming”) of Code Complete, it talks how we can protect our program and how we can avoid error. It talks about the ways to make defensive program, such as Assertions, Exception, and Debugging. I think that the most important thing of Defensive programming is debugging because debugging is essential part of programming. I think that programming is rare to complete and run perfectly at once. It means that writing code perfectly is almost impossible. It usually has some errors because of lack of code. Of course, debugging is not only needed to complete writing code good to learn how we got wrong and to fix it. The reason why it is also good to learn is based on process of debugging.

What is process of it?

  1. Check the bug exists or not.
  2. Check where bug is in program.
  3. Check why error occurred.
  4. Make sure of way to fix it/ concern about correct way to run program.
  5. Fix and test it.

1, Check the bug exists or not:
 The purpose of this step to identify or find sigh of bug and knowing a situation that error occurred and knowing the way to avoid error.

2, Check where is bug in program:
In this step, we need to find and identify which program cause error.

3, Check why error occurred:
After we find a bug, we will need to know how error occurred. For example, the situation is program stops because of failure of data field. In this case, finding error of data field is purpose of this step.

4, Make sure of way to fix it/ concern about correct way to run program:
After we know the reason that program stops, we need to think about how to fix it. In this step, we need to know detailed information of what program is made for because some solution could change its purpose even if error is fixed. 

5, Fix and test it:
After we find correct way to fix the bug, we need to test it and make sure that the way we try to fix deal with the bug or not and it cause undesirable side effect or not.

Thus, each step is important to complete code and fix program. In addition, those steps can tell us what, where, and how we got wrong. If we learn how we got wrong and fix it. We can avoid similar error next time.

Wednesday, November 21, 2012

What is difference between BDD and TDD?

When I read chapter 5 and chapter 6 of Engineering Long-lasting Software. Those chapters talk about BDD (Behavior-Driven Development) and TDD (Test-Driven Development) again and again. However, I did not see exactly difference between BDD and TDD because most technical blogs, and books say that “BDD is the diversity of TDD”, “BDD is an extension or revision of TDD.” By search and search, I just understand one difference between them.

TDD is for developers, and BDD is for customers. Those results are based on developer testing and customer testing

What are developer testing and customer testing?
Developer testing is that developer makes way of test for only developer.
Customer testing is that developer makes way of test for customer’s position.
Those testing are tested different ways. Developer testing runs program by bottom up to test step by step. On the other hand, customer testing runs program by top down to understand how entire program goes for customers.

As you see, ATDD (Acceptance Test-Driven development) is placed in Customer, and BDD is between TDD and ATDD on the picture. The reason why ATDD is placed in Customer is that ATDD is a one of cycle of testing and repeat testing to implement an application. If testing is passed, it will be the same meaning of implementation of the application. It is easy to make sure that complementation of the application and its progress by client’s Position. The reason why it is easy to make sure them is that BDD is using ubiquitous language. TDD is not using ubiquitous language because it is for developer. In case of BDD, a test and progress are described by ubiquitous language. So, BDD is more understandable than TDD to clients. So, this is the benefit to use ATDD on BDD for client. Therefore, BDD is for customers. I think that that is one of difference between TDD and BDD. I want to share this idea to understand difference between them. However, I could misunderstand about that. If so, Please let me know what I got wrong.

What is More Important Thing Than Coding?

 Considering appropriate name is important for programming. When I read Chapter 7 of Code Complete which talks about High Quality Routines, I strongly agreed with idea of Good Routine name. It gives us few key points for naming routine and it is divided into eight:

  • Everything describe the routine does
  • Avoid meaningless, vague, or wishy-washy verbs
  • Don’t differentiate routine names solely by number
  • Make names of routines as long as necessary
  • To name a function, use description of return value
  • To name a procedure, use a strong verb followed by an object
  • Use opposites precisely

It talks about that appropriate name helps us to understand what routine does. Conversely, improper name routines could make us confused. For example, short name of routines could be easy to write, but it will be highly possible that name of routine might be weak name. However, too long name of routine is improper as well. The book says that “Research shows that the optimum average length for a variable name is 9 to 15 characters.”(171) I think that too much described names can be too long name. In addition, Avoiding wishy-washy verbs is important to name routine because some term of words has several meanings and covers huge meaning such as calculate, call or so on. Those wishy-washy words will not be appropriate name for routine.

Of course, appropriate name is good not only routines but also other objects. As I mentioned above, Weak naming variable makes program harder to understand. If we use weak name for other, it makes us confused as well. In my case, I used to write too short names because it was easy to write. Of course, it did not describe what object does. I just described number or string. We can use any term of words for them such as num1, DailyPay, or etc. So, this is why I used to write short name for them. However, if we use any term of words for variables, program can run. However, it can make our brain confused. One day, I wrote a little long program with short variable names. Finally, I got confused. So, nice described variable name is important for programming.


1:Answer = number1 + number2

2:TotalSalary = NumberDayWorked + NumberHoursWorked

As you see, second example is absolutely better than first one. First one can run, but we do not know and expect what number1 and 2 do. On the other hand, we can expect what Number DayWorked and NumberHourWorked somehow.

Friday, November 9, 2012

The World's first RDBMS!

Nowadays, most people have heard term of database and some of them have known function of database. In my case, I had learned basic things of database. However, I do not have enough knowledge of it. According to Chapter 2 of Engineering Long-Lasting Software, "Database have historically provided high durability for stored information." I am very interested in history of relational database because I know how to code for relational database, but I do not have a history of it.

Recently, Oracle, IBM, and Microsoft are famous for Relational Database. those three companies mostly keep 90% of the market share of database. However, question came up.
Which company did develop it and start servicing it?

Edger F. Codd who worked at IBM wrote a essay titled "Derivability, Redundancy, and Consistency of Relational Store in Large Data Banks" in 1969. Database is based on contents of that essay. It talks about definition of relational algebra and calculus, and using predicate logic for controlling database. this is the origin of Relational Database.

in 1973, IBM launched project "System R." at the same time, Michael Stonebraker who was in University of California, Berkeley launched original project INGRES(Interactive Graphics Retrieval System), inspired by essay of project System R.

INGRES by Stonebraker had developed gradually and it had supported to create  other RDBMS such as Sybase, SQL server, Informix, and so on.

Larry Ellison who was in Ampex cooperated with his bosses to establish a company Software Development Laboratories in 1977. it had changed name of company to "Relational Software Inc." in 1979 and it had changed its name again to "Oracle Corp." in 1983. They made the world's first relational database management system(RDBMS) on UNIX in 1979. IBM made RDBMS which ran only on VSE in 1981 and another type of RDBNS which ran on only MVS in 1983. As diffusion of UNIX in 1980s, Oracle's RDBMS became popular because its RDBMS is based on C which is highly portable language. on the other hand, IBM's RDBMS could run on only IBM's OP.