Archives
 
 
 
  Special
 
 
 
  About Us
 
 
 

Newsletter
Free E-mail Newsletter from BYTE.com

 
    
           
Visit the home page Browse the four-year online archive Download platform-neutral CPU/FPU benchmarks Find information for advertisers, authors, vendors, subscribers Request free information on products written about or advertised in BYTE Submit a press release, or scan recent announcements Talk with BYTE's staff and readers about products and technologies

ArticlesVisix Gives Java a Jump-Start


September 1997 / Javatalk / Vibe Jive / Visix Gives Java a Jump-Start

If you're serious about Java, the Java Developer's Kit (JDK) leaves much to be desired, including a need for more containers and generic algorithms to help you more quickly develop and deploy applications. ObjectSpace's Java Generic Library (JGL) is a collection of containers and algorithms that's the Java equivalent to the C++ standard template library (STL). JGL is bundled with Visix's Vibe and is also free for the downloading from http://www.objectspace.com .

JGL consists of over 100 classes and interfaces that define data types and associated algorithms. All the data types in JGL descend from a parent abstract data class that's known as "containers." Five different kinds of "base" containers exist in JGL: maps, queues, sequences, sets, and stacks.

Each type of container has its own characteristics of access and element storage. For example, a queue implements a linked-list structure; a stack implements a first-in/last-out structure, and so on. (I'm using the "base" classes designation loosely. The map class is an abstract class, queue and stack are concrete classes, and sequence and set are interfaces. Think of them as the five main branches of the JGL container-class tree.)

But the container classes are only part of the JGL fabric. Algorithm classes provide the necessary mechanics for operations on containers. JGL includes algorithms for sorting, searching, counting, repl acing, applying, and more. In addition, JGL defines a set of iterator classes for each container class so that you can easily program tight loops that process elements within a container.

But the real power of JGL is unleashed when containers, iterators, and algorithms are combined. The combination allows you to turn an algorithm loose on a container with just a few statements. For example, the following code shows how you might sort the first 10 elements of an array container:

ArrayIterator first =
     array.begin(); 
ArrayIterator last =
     array.begin();
last.advance(10);
Sorting.sort(first,last);

The first iterator is set to the front of the array. Then the last iterator is created and moved to just past the tenth element. Finally, the sort method is called to sort the subset of the array. Note that, with little modification, you could easily sort subsets within the array, as well as the entire array itself.


Up to the Javatalk section contentsGo to previous article: Visix Gives Java a Jump-StartSearchSend a comment on this articleSubscribe to BYTE or BYTE on CD-ROM  
Flexible C++
Matthew Wilson
My approach to software engineering is far more pragmatic than it is theoretical--and no language better exemplifies this than C++.

more...

BYTE Digest

BYTE Digest editors every month analyze and evaluate the best articles from Information Week, EE Times, Dr. Dobb's Journal, Network Computing, Sys Admin, and dozens of other CMP publications—bringing you critical news and information about wireless communication, computer security, software development, embedded systems, and more!

Find out more

BYTE.com Store

BYTE CD-ROM
NOW, on one CD-ROM, you can instantly access more than 8 years of BYTE.
 
The Best of BYTE Volume 1: Programming Languages
The Best of BYTE
Volume 1: Programming Languages
In this issue of Best of BYTE, we bring together some of the leading programming language designers and implementors...

Copyright © 2005 CMP Media LLC, Privacy Policy, Your California Privacy rights, Terms of Service
Site comments: webmaster@byte.com
SDMG Web Sites: BYTE.com, C/C++ Users Journal, Dr. Dobb's Journal, MSDN Magazine, New Architect, SD Expo, SD Magazine, Sys Admin, The Perl Journal, UnixReview.com, Windows Developer Network