Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

README.md

Zoo Exercise

A TypeScript implementation of a zoo where different animals can speak in their unique ways.

Project Structure

zoo
├── src
│   ├── models
│   │   ├── Animal.ts        # Abstract class defining common properties and methods
│   │   ├── Lion.ts          # Class representing a lion
│   │   ├── Elephant.ts      # Class representing an elephant
│   │   └── Monkey.ts        # Class representing a monkey
│   │   └── index.ts         # Module exporting the animal classes
│   ├── index.ts             # Entry point of the application
├── tests
│   └── animals.test.ts      # Unit tests for the animal classes
└── README.md                # Project documentation

Getting Started

  1. Follow the installation instructions.

  2. Run the application:

    npm dev:zoo
  3. Run the tests:

    npm test:zoo

Note on Object-Oriented Programming

This exercise represents a classic example of OOP application, particularly demonstrating polymorphism through different animals sharing a common interface. While it serves as an educational example.

Warning

Having seen many codebases suffer from over-engineering, my experience shows that:

  • Complex inheritance hierarchies can be hard to maintain.
  • Consider composition over inheritance when possible.
  • Defer abstractions until they're needed.

This exercise demonstrates OOP concepts while acknowledging these practical considerations.