Skip to content

YuriiJavaDev/JavaBasics_Task_319_V0.1

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Task Management System: Scalable Architecture (JavaBasics_Task_319_V0.1)

📖 Description

The primary goal of a senior developer is to write code that doesn't need to be rewritten every time requirements change. This project demonstrates Advanced Polymorphism and the Open/Closed Principle. By encapsulating the iteration logic in a universal method printWorkForAll(Employee[]), we create a system where adding a new type of worker (like an Intern) requires zero changes to the processing logic. This decoupling ensures that the system remains stable and maintainable even as the organization expands.

📋 Requirements Compliance

  • Extensible Hierarchy: Built a robust hierarchy including Manager, Developer, Designer, and Intern.
  • Logic Encapsulation: Isolated the polymorphic loop into a reusable private method.
  • Null Safety: Implemented checks to handle partially filled arrays.
  • Dynamic Integration: Proven that the same method handles new object types added at runtime.
  • Architectural Scalability: Demonstrated the power of programming to an interface/superclass.

🚀 Architectural Stack

  • Java 8+ (Inheritance, Polymorphism, Encapsulation, Array Management)

🏗️ Implementation Details

  • Employee: The root of the corporate hierarchy.
  • Intern: The latest addition, demonstrating seamless integration.
  • SystemEvolutionLauncherApp: The orchestrator that manages staff and triggers activities.

📋 Expected result

--- Current Staff Activity ---
Employee is working...
Manager is holding a meeting.
Developer is writing code.
Designer is drawing layouts.

--- Updated Staff Activity (Intern Joined) ---
Employee is working...
Manager is holding a meeting.
Developer is writing code.
Designer is drawing layouts.
Intern learning how to work.

💻 Code Example

Project Structure:

JavaBasics_Task_319/
├── src/
│   └── com/yurii/pavlenko/
│                 ├── app/
│                 │   └── SystemEvolutionLauncherApp.java
│                 └── hr/
│                     ├── roles/
│                     │   ├── Manager.java
│                     │   ├── Developer.java
│                     │   ├── Designer.java
│                     │   └── Intern.java
│                     └── Employee.java
├── LICENSE
├── TASK.md
├── THEORY.md
└── README.md

Code

package com.yurii.pavlenko.app;

import com.yurii.pavlenko.hr.Employee;
import com.yurii.pavlenko.hr.roles.*;

public class SystemEvolutionLauncherApp {

    public static void main(String[] args) {

        Employee[] staff = new Employee[5];

        staff[0] = new Employee();
        staff[1] = new Manager();
        staff[2] = new Developer();
        staff[3] = new Designer();

        System.out.println("--- Current Staff Activity ---");
        printWorkForAll(staff);

        staff[4] = new Intern();

        System.out.println("\n--- Updated Staff Activity (Intern Joined) ---");
        printWorkForAll(staff);
    }

    private static void printWorkForAll(Employee[] staff) {
        for (Employee e : staff) {
            if (e != null) {
                // Polymorphic call: JVM finds the right implementation at runtime
                e.work();
            }
        }
    }
}
package com.yurii.pavlenko.hr;

public class Employee {
    public void work() {
        System.out.println("Employee is working...");
    }
}
package com.yurii.pavlenko.hr.roles;
import com.yurii.pavlenko.hr.Employee;

public class Manager extends Employee {
    @Override
    public void work() {
        System.out.println("Manager is holding a meeting.");
    }
}
package com.yurii.pavlenko.hr.roles;
import com.yurii.pavlenko.hr.Employee;

public class Intern extends Employee {
    @Override
    public void work() {
        System.out.println("Intern learning how to work.");
    }
}

⚖️ License

This project is licensed under the MIT License.

Copyright (c) 2026 Yurii Pavlenko

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files...

License: MIT

About

This is a tutorial project. JavaBasics_Task_319_V0.1 Task Management System: demonstrating advanced polymorphism and the Open/Closed Principle by integrating a new role (Intern) into a centralized processing method without code modifications. 150426_0912

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages