Class AcceptableModuleCohesionOrError
- All Implemented Interfaces:
BiConsumer<String, List<ParsedModule>>
Module cohesion measures how well the constructs within a module relate to each other. Low cohesion (many disconnected groups) indicates a module that could be split into multiple focused modules.
Measurement: Connected component analysis using Union-Find (similar to LCOM4):
- Each construct (class, record, trait, function) is a node
- Each intra-module type reference is an edge
- Count disconnected components - more components = lower cohesion
Threshold: Uses a hybrid approach - both absolute maximum AND percentage threshold must be exceeded:
- Maximum 30 disconnected groups (absolute cap)
- AND disconnected groups exceed 88% of total constructs (relative measure)
This allows legitimate modules with many independent utility constructs while catching truly fragmented modules that should be split.
Minimum constructs: 60 (smaller modules are not checked - only large modules warrant this check).
These thresholds are generous to accommodate EK9's functional style which encourages many small, pure functions that may not reference each other's types.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static interfaceFunctional interface to get the appropriate ErrorListener for a ParsedModule. -
Constructor Summary
ConstructorsConstructorDescriptionAcceptableModuleCohesionOrError(ModuleCohesionTracker moduleCohesionTracker, AcceptableModuleCohesionOrError.ErrorListenerLookup errorListenerLookup) -
Method Summary
Modifier and TypeMethodDescriptionvoidaccept(String moduleName, List<ParsedModule> parsedModules) Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface BiConsumer
andThen
-
Constructor Details
-
AcceptableModuleCohesionOrError
AcceptableModuleCohesionOrError(ModuleCohesionTracker moduleCohesionTracker, AcceptableModuleCohesionOrError.ErrorListenerLookup errorListenerLookup)
-
-
Method Details
-
accept
- Specified by:
acceptin interfaceBiConsumer<String, List<ParsedModule>>
-