/Hostinger-Test

Program for printing unlimited hierarchy tree using GoF Composite design pattern

Primary LanguagePHP

Hostinger coding test

Task has been implemented using GoF Composite design pattern -> link

Result

Result

Diagram

Diagram

Task description

The exercise is printing a categories tree to the page (with unlimited hierarchy) in two different ways:

  • Recursive
  • Iterative

Important to note

  • Add a form for adding new categories
  • Should be written in OOP
  • Use design patterns when needed
  • Make sure the code is simple and clean
  • Separate concerns
  • Testable code

Example

-cat
    -sub-cat
        -sub-sub-cat
        -sub-sub-cat
    -sub-cat
        -sub-sub-cat
        -sub-sub-cat
        -sub-sub-cat
-cat