CHAPTER 4. CODING PROCESS
11
4.2 Reverse engineering
When new features have to be implemented into an existing project, program-
mers need to understand the design of the project and how the relevant pieces of
code work. This can be a very intensive work and tools which search for declara-
tions, type hierarchies and call hierarchies are very useful in this process. Eclipse
supports these features and those were very useful to learn the project’s imple-
mentation.
Also the communication with Gaston Escobar has helped in understanding the
code. I have mailed and chatted with him, asking questions about the code. The
Green Light District project was provided with some UML diagrams which gave
better insight in the global design of the project.
The most relevant parts of the code which were needed for implementing the extra
features are discussed below.
4.2.1 Speed of roadusers and its representation on a drivelane
The speed is represented as a number of blocks moved per cycle. In every cycle
all roadusers move a number of blocks on the drivelane as specified in the method
speed.
The roadusers on a specific drivelane are stored in a linked list. When a roaduser
moves on the drivelane, the position represented in the specific roaduser-class is
changed. The length of a drivelane is stored in the class Road, which contains a
number of drivelanes. When a roaduser enters a drivelane, its position is the length
of the road, and when it moves forward, the position of the roaduser decreases.
The end of the road is represented by position = 0.
4.2.2 Nodes and subclasses
The class Node and all its subclasses are located in gld.infra Node is the abstract
class of all nodes. Junction and SpecialNode are subclasses of Node. Junction