DataStructure categorization. The Interface and Implementation consist the categorization.
DataStructureError compose the library.
Documents planned implementation attributes. Declares implementation methods. The
DataStructureInt class describes the interface. Its file location is 'lib/data_structure_int.rb'.
Defines the interface's declared methods. The implementation class is
DataStructure, located in file 'lib/data_structure_impl.rb'.
DataStructure's custom error library.
Documents the planned implementation attributes. Declares the implementation's methods. The interface class is
DataStructureErrorInt's location is 'lib/data_structure_error_int.rb'.
Defines the interface's method declarations. The implementation class is
DataStructureError subclasses its interface class,
DataStructureErrorInt. The implementation class location is 'lib/data_structure_error_impl.rb'.
DataStructureError's composition. Pairs the latest stable Interface and Implementation.
DataStructure's composition. Pairs the latest stable DataStructure and DataStructureError compositions. The composition class is
DataStructureLibrary, located 'lib/data_structure.rb'.
If the purpose is commercial integration, download and install the Library's package. Verify the 'require' statement refers the appropriate file. Sometimes the file changes between Major Versions. Otherwise, the component packages are public, and were released under the GNU General Public License, Version 3, so develop freely. The GNU General Public License asserts some conditions, though, so refer the License.
DataStructure categorizes Ruby data structures. The categorization separates the types structuring information. The categorization class,
DataStructure, defines six data structure types:
Node. DataStructure becomes practical in data structure verification and exception handling.
Strategically redirecting data structure algorithms depends on conditional data structure verification. For instance, a method calling an appropriate Observer checks conditions, redirecting on a
# An Observer class exists. Observer is a parent of numerous data# structure Observers.# Observer.update_subscribers(subject = nil).# Updates the subject's subscribers. The parameter, subject, is an# existing Observer's subject.def Observer.update_subscribers(subject = nil)casewhen DataStructure.instance?(subject)observer = Observer.appropriate_observer(subject)observer.update_subscribers(subject)elsereturn falseendreturn nilend
Observer.update_subscribers(subject = nil) takes an argument
subject. In the case the subject is a
DataStructure type instance, gets the appropriate
Observer instance, 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,
DataStructure verification 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.
Infrastructural methods assume proper usage. Yet, mistakes and accidents are eventualities. Continuing the previous section's example,
subject is an observable type instance.
# An Observer class exists. Observer is a parent of numerous data# structure Observers.# Observer.appropriate_observer(subject).# Returns a subject's corresponding Observer identifier.# Expects an observable type instance.def Observer.appropriate_observer(subject)casewhen subject.instance_of?(DataStructureOne)return DataStructureOneObserverwhen subject.instance_of?(DataStructureTwo)return DataStructureTwoObserverelsereturn nilendend
In the case
subject's class is one of the observable data structure types, returns its corresponding Observer identifier. Otherwise, returns
nil. Consequently, the return becomes
observer local variable reference. Execution continues uninterrupted. Eventually, if undefended, bugs arise, and the time spent diagnosing them is sometimes unaffordable. A solution is raising a
# An Observer class exists. Observer is a parent of numerous data# structure Observers.# Observer.appropriate_observer(subject).# Strategically returns a subject's corresponding Observer. Expects# an observable type instance. Raises a DataStructureError in the# case it was operated improperly.def Observer.appropriate_observer(subject)casewhen subject.instance_of?(DataStructureOne)return DataStructureOneObserverwhen subject.instance_of?(DataStructureTwo)return DataStructureTwoObserverelseerror = DataStructureError.new()raise(error, error.message())endend
error refers a
DataStructureError instance. 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.
DataStructureError explains the problem and locations worth inspecting. At the price of a few additional code lines, its is cheaper than the hours spent searching.
Open-source software has great economic and cultural utility. Organizations and individuals integrating open-source in their projects have greater resources to spend elsewhere. However, open-source solutions suffer inherent development problems affecting quality. A few of many examples are consensus requirements confounding direction, and consequently, architecture; limited resources constraining development efforts; and governance, for any number of unpredictable reasons, abandoning maintenance and development. Commercially, open-source software is untrustworthy, and for hobbyist contributors, emotionally exhausting.
The open-source problems are not insurmountable, though. Diligent Software LLC's mission is supporting externally developed public projects commercial enterprises depend on; and independently growing fundamental, reliable, and endurable open-source solutions. Hopefully, in turn, the organization's efforts effect software industrial and macroeconomic growth, and mature the open-source software community. If you are using our software, find the software useful, or in any way value Diligent Software LLC's mission, donate or participate on Github.
DataStructure has a distinct corresponding Open Collective "Collective". The Collective coordinates communication, financial contributions, and project progression.
Everyone makes mistakes. Fixing bugs one is unaware exist is impossible. Each component repository contains a 'README.md' file referring a Bug Reporting memorandum, and a Bug Fixing memorandum. In the case one discovers a bug, report the bug in the appropriate git repository. Report DataStructure's Interface bugs in the Interface's repository. Report Implementation bugs in the Implementation repository. Report systematic bugs in the LIbrary's repository. The same applies regarding sub-projects. For instance,
DataStructureError is a sub-project. Administratively verified, follow the corresponding Bug Fixing procedure.
Additionally, every project's Library component has an additional Improvements memorandum. The memorandum describes the Improvements Procedure in the case collaborating with the organization. Independent improvements are equally welcome. The components and composition packages were released under the GNU General Public License, Version 3, so review the License's terms.
If there are commercial or private questions about DataStructure, send [email protected] an email.