mardi 25 avril 2023

Design Architecture

Further, I have a query regarding design

Problem Statement:-

I have subcategories defined under Vehicle Class as :- Bike ,Car, truck, bus

Further, there are different variants under each four categories

Bike :- sport, standard Car :- sport, standard, electric Truck :- Mini Truck , Power Truck Bus:- Mini Bus, AC Bus

I have to calculate the price based on variants. For example Mini Bus price.

Question:- How should I define the classes ?

  1. Keep only vehicle as a class .
  2. Keep Vehicle as a base class and make bike, car, truck , bus as subclasses and they should inherit the base class.
  3. make sports bike as class which will inherit bike class which will further inherit vehicle class

What is the best possible solution following OOPS and Solid.

Aucun commentaire:

Enregistrer un commentaire