Skip to content

kurtulussahin/MinePumpSystem-TrueOOP

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Mine Pump System - True Object-Oriented Design

EO principles respected here License

Overview

This project is a Java implementation of the Mine Pump system, following the Real Object-Oriented (OO) approach described by Carlo Pescio. Instead of using a centralized controller, the design distributes responsibilities across collaborating objects, allowing for better modularity, testability, and maintainability.

Problem Description

The Mine Pump system is responsible for managing water levels in a mine while ensuring safety from gas hazards. The system consists of:

  • Water Level Sensors: Determines when to pump water out of the sump.
  • Gas Sensors: Monitors carbon monoxide, methane, and airflow.
  • Pump: Removes water when necessary but cannot operate under unsafe conditions.
  • Siren: Triggers warnings when gas levels become critical or the pump fails.

The challenge is to implement this system without a monolithic controller, ensuring that each object encapsulates its own behavior.

Implementation

The project is structured into several key classes:

  • BasicSumpProbe – Determines when pumping is required.
  • GasSensor – Evaluates gas safety levels.
  • SafeEngine – Ensures the pump operates only when conditions are safe.
  • GasAlarm – Triggers alerts when hazardous conditions arise.
  • SumpPump – Manages the actual pumping process.
  • MinePlant – Acts as a factory/builder to configure and instantiate the system.

Class Diagram

  • image

Running the Project

To run the project, compile the Java files and execute the main entry point. Since this implementation focuses on a true OO design, it can be easily extended to integrate with actual hardware or simulations.

References

  • Carlo Pescio’s article on Life without a Controller: Original Post

What does true object-oriented means?

This application follows these four fundamental principles:

  • No null (why?)
  • No code in constructors (why?)
  • No getters and setters (why?)
  • No mutable objects (why?)
  • No static methods, not even private ones (why?)
  • No instanceof, type casting, or reflection (why?)
  • No implementation inheritance (why?)
  • No public methods without @Override
  • No statements in test methods except assertThat (why?)

If you want to know more about true object-oriented programming, I recommend these books:

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages