Saturday, June 10, 2023
HomeJavaEngaged on an unfamiliar codebase

Engaged on an unfamiliar codebase

Documentation is step one to embark on a brand new challenge. On an everyday challenge, the documentation will most likely be lacking, incomplete, or partly (if not completely) deceptive; at a hackathon, time could also be too quick to learn it intimately.

Profitable Open Supply tasks do have good documentation generally. Nonetheless, documentation is especially oriented towards customers, not often towards builders. Even when it’s the case, the possibilities that the documentation addresses the difficulty are low.

For that reason, my entry level is to attract a diagram. Not that whereas some instruments can reverse engineer code and draw diagrams robotically, I don’t use them on objective. Manually drawing a diagram has many advantages over an automatically-generated one:

  • It focuses on areas of the code related to the difficulty at hand
  • It forces the drawer to learn and perceive the code, which is the one supply of fact
  • It builds our psychological mannequin of the code
  • It paperwork our findings to be accessible afterward. Nonetheless, be aware that the documentation worth decreases with time because the underlying code evolves and each half methods.

Let’s create a diagram for the code for the difficulty. First, we will clone the repo domestically to open it in our favourite IDE; the one required function is that when one clicks on a technique name, one is directed to the strategy.

  • I’ve some expertise with them
  • Semantics should not ad-hoc, however shared amongst individuals who know UML, up to some extent

With out additional ado, right here it’s:

Hazelcast Map.get() sequence diagram

Having drawn the diagram, we will find fairly rapidly the place the difficulty is:

public summary class AbstractCacheRecordStore<R extends CacheRecord, CRM extends SampleableCacheRecordMap<Information, R>>
        implements ICacheRecordStore, EvictionListener<Information, R> {

    protected lengthy onRecordAccess(Information key, R document, ExpiryPolicy expiryPolicy, lengthy now) {
        document.setAccessTime(now);                                            (1)
        return updateAccessDuration(key, document, expiryPolicy, now);


1 The DefaultRecordStore reads the Report, which triggers the replace of the final entry time.

Fixing the difficulty is outdoors of the scope of this submit. It includes speaking to folks extra conversant in the general design to develop the most effective answer. strategy in a hackathon is first to supply not less than two options and doc their respective trade-offs.

For the tooling, loads of options can be found. My preferences go to PlantUML:

  • It affords a internet app and a Docker container
  • It generates SVG or PNG photos
  • It’s skinnable
  • It’s Open Supply and free
  • It’s maintained frequently


Please enter your comment!
Please enter your name here

Most Popular

Recent Comments