Skip to content

moassaad/class-diagram

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

61 Commits
 
 
 
 
 
 

Repository files navigation

Class Diagram Documentation

Creating the class

In this section, we explain how to create a class in the system. Below is an example using PHP and image.

Creating-Class

Create class using PHP code

class Person

class Person {
    public string $name;
    public int $age;
    
    public function speak():void
    {
        # code ...
    }
    
    public function walk(int $distance):void
    {
        # code ...
    }
}

class Book

class Book {
    public string $title;
    public string $author;
    
    public function borrow():bool
    {
        # code ...
    }
    
    public function return(int $distance):void
    {
        # code ...
    }
}

Relationships

Example impelementation using PHP code

Name Code Implement Testing-Run Fast Running Notes
Association - Multiplicity ( 1..1 ) One To One test_one_to_one One-To-One
- ( 1..* ) One To Many test_one_to_many One-To-Many
- ( *..* ) Many To Many test_many_to_many Many-To-Many
- ( 0..1 ) Zero To One test_zero_to_one Zero-To-One
- ( 0..* ) Zero To Many test_zero_to_many Zero-To-Many
Aggregation Classroom-Teacher test_example_department_employee Classroom-Teacher-Run
- Department-Employee test_example_teacher_classroom Department-Employee-Run
Composition Car-Tire test_example_car_tire Car-Tire-Run
- House-Room test_example_house_room House-Room-Run
House-Room-2-Run
Inheritance - Generalization Vehicles test_example_vehicles Vehicles-Run
- Animals test_example_animals Animals-Run
Dependency Car-Engine test_example_car_engine Car-Engine-Run
- Library-Book test_example_library_car Library-Book-Run
Realization Payment-Method test_example_payment_method Payment-Method-Run
- Device test_example_device Device-Run
- Movable test_example_movable Movable-Run

Association - Multiplicity

 Association - Multiplicity


( 1..1 ) One To One


  •  ( 1..1 ) One To One image

( 1..* ) One To Many


  •  ( 1..* ) One To Many image

( *..* ) Many To Many


  •  ( .. ) Many To Many image

( 0..1 ) Zero To One


  •  ( 0..1 ) Zero To One image

( 0..* ) Zero To Many


  •  ( 0..* ) Zero To Many image

Aggregation

 Aggregation


Aggregation relation


  •  Aggregation relation image

Composition

 Composition


Composition relation


  •  Composition relation image

Inheritance - Generalization

 Inheritance


Inheritance - Generalization relation


  •  Inheritance relation image

Dependency

 Dependency


Dependency relation


  •  Dependency relation image

Realization

 Realization


Realization relation


  •  Realization relation image

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages