Object Programming  «Prev 

Defining Objects with Classes

General Syntax

Syntax for defining classes
Syntax for defining classes

ClassName

An identifier that specifies the name of the class

ClassBody

The Classbody contains the code that defines the functionality of the class and includes
  1. member variables and
  2. methods for the class.
In the "real" world, objects are the entities of which the world is comprised.
Everything that happens in the world is related to the interactions between the objects in the world. Just as atoms combine to form molecules and larger objects, the interacting entities in the world can be thought of as interactions between and among both singular ("atomic") as well as compound ("composed") objects. The real world consists of many, many objects interacting in many ways. While each object may not be overly complex, their myriad of interactions creates the overall complexity of the natural world. It is this complexity that we wish to capture in our software systems.In an object-oriented software system,objects are entities used to represent or model a particular piece of the system.

Principles of Software Testing

Static testing procedures test the program not by executing it, but by inspecting and reviewing the code and performing detailed walk-throughs and is aimed at verification. On the other hand, dynamic testing procedures test the program by executing it with carefully selected test cases. It is thus more related to validation. The test cases can be chosen according to a white box or black box strategy.
In white box testing, they are selected by thorough inspection of the source code of the program; for example, by making sure all the branches in an if-then-else selection are covered, boundary conditions for loops are verified, and so on. One popular approach is to intentionally inject faults in the source code, which then need to be tracked down in a follow-up step.
Black box testing considers the program as a black box and does not inspect its internal source code. One example is a procedure that tries to test all possible input parameter combinations. It is especially important to also test what happens when impossible values are entered (such as a negative value for weight and height, value of 0 for height, missing value for gender, and so on). Obviously, this becomes computationally infeasible in case many inputs are present and intelligent sampling procedures could be adopted to test as many useful input combinations as possible. Software development typically has two phases of testing. Alpha testing is done internally by the application developers before the software is brought to the market. In beta testing, the software is given to a selected target audience and errors are reported back to the development team.