O'Reilly logo

Codecharts: Roadmaps and blueprints for object-oriented programs by J. Nicholson, Amnon H. Eden

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 6

Modelling Small Programs

The simplest Codecharts represent individual classes and methods, their properties, and the relations between them. This chapter introduces the reader to these symbols, depicted in Legend 2 (page 48), and demonstrates how they are used.

We begin with the example of the classes LinkedList and LinkedListItr and some of their interfaces in package java.util,1 extracts from which are depicted in Program 1.

Program 1. Extracts from java.util

public interface Collection { …
   public Iterator newItr(); …
public interface Iterator { …
   public Object next(); …
public interface List
   extends Collection { …
public interface ListIterator
   extends Iterator { …
public class LinkedList
   implements List … {
   public Iterator newItr() { …
   // produce a (new) instance
   // of LinkedListItr
class LinkedListItr
   implements ListIterator { …
   public Object next() { …
   // iterate over a LinkedList
   // return Object

Note: Identifiers were slightly altered for pedagogical purposes. For example, to prevent confusion with class Iterator, the signature of the various iterator() methods was changed (consistently) to newItr().

image

Legend 2. Symbols introduced in this chapter

Codecharts were tailored to overcome many of the limitations of existing modelling notations. By the principle of abstraction, Codecharts do not distinguish between classes and interfaces ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required