Java Reference
In-Depth Information
easily track bugs down and correct them. It is possible to debug your program without the use of
such tools, but in either case, you should follow a structured and systematic review to be sure you've
identified any bugs before your program is deployed.
Once a program has been thoroughly tested, it can be deployed. This means that the program will
be brought into production and actively used to solve the business problem. Remember, users of
your software don't usually understand as much about programming as you. Try to keep them in
mind throughout the process to make this deployment step as seamless as possible.
Finally, programs should be maintained on an ongoing basis. There are many reasons for regular
maintenance, namely correcting newly discovered bugs, accommodating changing user needs, pre-
venting erroneous user input, or adding new features to existing programs.
It is important to note that programming is not a strict, sequential, step-by-step process. Quite to
the contrary, it often occurs as an iterative process, whereby the original business problem is refined
or even reformulated during the coding process.
object-oriented programming: a sneak previeW
In object-oriented (OO) programming, an application consists of a series of objects that ask services
from each other. Each object is an instance of a class that contains a blueprint description of all the
object's characteristics. Contrary to procedural programming, an object bundles both its data (which
determines its state) and its procedures (which determines its behavior) in a coherent way. An example
of this could be a student object having data elements such as ID, name, date of birth, email address,
and so on, and procedures such as registerForCourse , isPassed , and so on. A key difference
between OO and procedural programming is that OO uses local data stored in objects, whereas pro-
cedural programming uses global shared data that the various procedures can access directly. This has
substantial implications from a maintenance viewpoint. Imagine that you want to change a particular
data element (rename it or remove it). In a procedural programming environment, you would have
to look up all procedures that make use of the data element and adapt them accordingly. For huge
programs, this can be a very tedious maintenance exercise. When you're using an OO programming
paradigm, you only need to change the data element in the object's definition and the other objects can
keep on interacting with it like they did before, minimizing the maintenance.
OO programming is the most popular programming paradigm currently in use. Some examples of
object-oriented programming languages are Eiffel, Smalltalk, C++, and Java.
The following code example demonstrates how to implement the BMI example in Java. Contrary to
the procedural programming example, it can be clearly seen that the data ( weight, height, and
BMI ) is bundled together with the procedures ( BMICalculator, calculate, and isOverweight )
into one coherent class definition.
public class BMICalculator {
private double weight, height, BMI;
public BMICalculator( double weight, double height ){
this.weight = weight;
this.height = height;
}
 
Search WWH ::




Custom Search