DataStructurecategorization. The Interface and Implementation consist the categorization.
DataStructureErrorcompose the library.
DataStructureIntclass describes the interface. Its file location is 'lib/data_structure_int.rb'.
DataStructure, located in file 'lib/data_structure_impl.rb'.
DataStructureErrorInt's location is 'lib/data_structure_error_int.rb'.
DataStructureErrorsubclasses its interface class,
DataStructureErrorInt. The implementation class location is 'lib/data_structure_error_impl.rb'.
DataStructureLibrary, located 'lib/data_structure.rb'.
DataStructure, defines six data structure types:
Node. DataStructure becomes practical in data structure verification and exception handling.
Observer.update_subscribers(subject = nil)takes an argument
subject. In the case the subject is a
DataStructuretype instance, gets the appropriate
Observerinstance, and updates its subscribers. Properly operated, the subscribers update and the method returns
Observer.update_subscribers(subject = nil)returns
false, and no updates occur. In intricate systems, such as a system with an Observer, many type-dependent Observer children, and other interacting Subscribers,
DataStructureverification simplifies interoperability. Additionally,
Observer.update_subscribers(subject = nil)continues execution flow regardless of the argument expectations. In other cases, warning a developer is a better solution.
subjectis an observable type instance.
subject's class is one of the observable data structure types, returns its corresponding Observer identifier. Otherwise, returns
nil. Consequently, the return becomes
observerlocal variable reference. Execution continues uninterrupted. Eventually, if undefended, bugs arise, and the time spent diagnosing them is sometimes unaffordable. A solution is raising a
DataStructureErrorinstance. The instantiation supplies a default error message,
DEFAULT_MESSAGE, explaining a DataStructure type was expected, and the argument was not a DataStructure type. Kernel's raise method interrupts execution, displaying the message. The output includes stack trace file and line numbers.
DataStructureErrorexplains the problem and locations worth inspecting. At the price of a few additional code lines, its is cheaper than the hours spent searching.
DataStructureErroris a sub-project. Administratively verified, follow the corresponding Bug Fixing procedure.