I had a talk with my professor today about the layout of the Chunklist data structure that we've been working on. Basically, it is a hybrid of a ordered circular linked list with each node containing an arraylist.
Since this is an ordered list, the add() method is pretty complicated, so I wrote a nested class to hold the helper methods, such as split a chunk into two smaller even chunks, find the insertion point, create a new node, among others. These helper methods keep the size of the method to under 30 lines, but if everything were included, the one method would be well over 150 lines.
EDIT: clarified professor's point
His position was to do without the helper class and have it only return the node and index inside it, which is used by the iterator and have everything else visible for a point of readability. I constructed a helper class as ListLoc<E> ll= new ListLoc();
, and accessing methods as ll.insertItem(item)
was, from his point, difficult on readability and program flow. His words "I look to ll as a object for something, not just instance methods." My position was why have these methods visible when they are both integral to the operation of the structure and should not be accessed directly.
So, when constructing a custom data structure, should the helper methods be visible to the end user even when they should NOT be used?