Suite101

Object-Oriented Simulation


© Adam Hughes

One of the hottest concepts in software development these days is object-oriented (OO) design technology. While there is more than one brand of OO language out there, Java's popularity seems to be growing by leaps and bounds, particularly among the e-commerce and internet sets. But while Java's unique features make it a natural for these fields, does it have anything to offer the computational scientist? Why don't we try to find out?

Before we can hope to understand what Java might mean to a scientist, we need to know what Java IS. And before we can know much about Java itself, we need to know what object-oriented technology is all about. The best way to accomplish the latter is probably to contrast it with its predecessor, procedural programming, so here goes.

Procedural programming is what most people think of when they envision a developer writing some lines of code. As the name indicates, instructions in a procedural program are carried out in order, and everything is laid out before you in a quite concrete way. If you wanted to write a program to calculate the area of a triangle, you'd carry out steps similar to the following :

1) ask for the height of the triangle 2) ask for the base of the triangle 3) calculate the area based on the inputs

And that would be that. If you later decided you wanted to to find the perimeter measure of all triangles that yield a certain area, you could write a subroutine to accomplish this. Clearly, the focus here is on action : you define a triangle's sizes, and then you spend your time worrying about how to manipulate the data to yield what you want.

An object-oriented programmer, however, might take a different approach to the problem. In particular, he would attempt to gather all of the information and methods pertaining to a triangle into one entity called an object. In his triangle object, our programmer would undoubtedly have variables to hold the height and width, but he'd likely also have methods to retrieve each of those values. There would almost certainly be a method to retrieve the area as well as some to perform perimeter manipulation. While all of this may seem quite similar to what happened in the procedural case, the big difference is that this object is completely encapsulated and can be passed to other developers or users, in its entirety, so that they might use it in their larger programs. Such a task often becomes quite unwieldy with procedural languages, such as C.

To build a complete software package using procedural language

Go To Page: 1 2


The copyright of the article Object-Oriented Simulation in Scientific Computing is owned by Adam Hughes. Permission to republish Object-Oriented Simulation in print or online must be granted by the author in writing.

Post this Article to facebook Add this Article to del.icio.us! Digg this Article furl this Article Add this Article to Reddit Add this Article to Technorati Add this Article to Newsvine Add this Article to Windows Live Add this Article to Yahoo Add this Article to StumbleUpon Add this Article to BlinkLists Add this Article to Spurl Add this Article to Google Add this Article to Ask Add this Article to Squidoo