REVIEW - Java for the COBOL Programmer


Java for the COBOL Programmer


E. Reed Doke, Bill C. Hardgrave



Cambridge University Press (1999)




Peter Tillier


December 2000



My Background: I currently support a CM system that is used to manage multi-project COBOL and other language compilations and I am familiar with COBOL syntax and the identification of programming errors. My hobby is writing compilers and I have also ported UNIX utilities, such as awk, to non-standard OSs. I reviewed the book from the point of view of a COBOL programmer wanting to know about Java.

The book is written by two experienced COBOL consultants and teachers who are the authors of 'An Introduction to Object COBOL' (Wiley, 1998). The authors also teach OO development and Java and so should be able to give valuable insight into the process of learning Java from the COBOL programmer's perspective.

In general the presentation of the book is good, it is laid out in a readable way and a suitable font is used. Each chapter is set out in the same way and end with sections entitled 'Summary of Key Points', 'Glossary' and, in some cases, 'Bibliography'. The provision of these sections is a very good idea and makes it simple to recap the topics of the chapter and to understand the terminology used.

The first chapter attempts to justify the need for COBOL programmers to learn Java and I think it largely succeeds in this objective. It specifically says that the book does not intend to discuss all of Java, nor OO analysis and design and correctly in my opinion, says that there are other books that cover these areas.

The second chapter is an introduction to OO principles that includes a brief history of OO languages and design methods. The OO interpretation of terms such as object, class, instance, method and attribute is introduced together with their representation in UML diagrams. Once the UML diagrams have been discussed further topics such as inheritance, aggregation, association and object communication follow in quick succession. The chapter finishes with polymorphism and dynamic binding - it covers a lot in 27 pages!

The third chapter 'Java Structure' is where Java is really introduced; it covers the concept of programs being made up from classes and instances. This is where I would expect traditional COBOL programmers to have the most problems of understanding; the style of Java programs is very different from COBOL. As an example of this difference an attribute in COBOL is commonly referred to as a field or data item, whereas Java uses the term variable. In addition COBOL tends to use scope-terminating keywords such as END-IF and END-COMPUTE, where in Java braces are used. The chapter then uses a simple example to describe how declarations are structured and how public and private keywords work and rounds off by looking at comments, naming conventions, the creation of instances, method invocation and sub-classes. I found the examples reasonable; someone who is more of an expert on Java might not agree, but I think that they meet their objective.

The next four chapters are relatively straightforward and cover the differences between COBOL and Java declarations, computation, selection and iteration. In each chapter there are examples of the COBOL approach followed by the Java approach.

Chapters eight and nine discuss arrays (tables in COBOL) and data access using file and databases. In the former there are clear examples of how to declare and manipulate arrays (once again giving both COBOL and Java versions), including simple table look-up routines and the chapter ends with a two-dimensional array-handling example. In the latter there is coverage of the ideas of object persistence and serialization, together with sequential file access, SQL database and network access. The coverage of network access is less than a page in length and briefly describes the package and the use of a socket instance to access network objects. There is no code example for this, but in my opinion this topic is really outside the scope of the book, so I agree with the authors' approach.

Chapter ten discusses GUIs and the AWT. There is a good introduction to event-driven programs and how events are recognised and handled by a GUI program. The remainder of the chapter works through building a small GUI window with labels, text fields and panels, together with the associated program code. Once again the example seems reasonable enough to illustrate the principles. The last part of the chapter is used to show how to add pull-down menus to the window and to spend about two pages describing an applet based upon the window produced earlier. Once again this is a reasonable example.

The final chapter 'Object-Oriented Development Issues' looks at OO in more detail and points out that it is much more than just a programming technique; it mentions some of the methodologies (ugh! how I hate the use of the term 'methodology' when 'method' is correct) that are available such as USDP, OPEN, OMT, Fusion and others. There is no attempt to compare or contrast these and I think that this would have been useful. There is coverage of the need to separate the design into three areas; user interface, problem domain and data access. This approach allows for a more robust design that can be revised more easily given changes required by the technology. This is very different from the traditionalCOBOL approach where any of the components may be handled by successive statements within the COBOL program.

I would like the book to have stated more explicitly that Java (and other languages) tend to use more and smaller modules that work together to make up the program as a whole; this is in contrast to the traditional (and still very prevalent) COBOL approach of putting everything in a single source code file. The separation of concerns not only addresses some of the OO issues mentioned above, but also makes maintenance of the programs very much simpler as modules can more easily be tested individually.

The final chapter is followed by what I see as a totally redundant appendix that contains the code from most of the chapters in the book. My main objection to this is that all these files are also on the CD and I cannot see any benefit that accrues from spending just over 70 pages listing items from it. In most of the chapters the code is included in the body of the chapter (although not for 'OO Development Issues') and so, given that the CD includes a trial version of Symantec Cafe there's no need to have this appendix - the software can be used to view and compile the code. Indeed, the space could, and in my opinion should, have been used to expand upon some of the other topics discussed earlier in the book.

I would still, however, recommend this book to COBOL programmers who want, or need, to know something about Java.

Book cover image courtesy of Open Library.

Your Privacy

By clicking "Accept All Cookies" you agree ACCU can store cookies on your device and disclose information in accordance with our Privacy Policy and Cookie Policy.

By clicking "Share IP Address" you agree ACCU can forward your IP address to third-party sites to enhance the information presented on the site, and that these sites may store cookies on your device.