Giter Club home page Giter Club logo

automobile's Introduction

bkw.auto

This is currently an API focused solution. Right click bkw.auto.api and set it as the default project. Press F5 to run the api

Video Demos

bkw.auto.interfaces

This experimetal vehicle modeling concept is designed to allow a dealership to show 4 popular types (i.e. VehicleKind) of cars for sale, and available options for those cars. Conceivably, users could select from available options and request a quote - but I haven't taken the API that far (and there's no UI outside the Swagger UI at the moment)

Initially the modeling of the car was conceived as a long list of IVehicleOption objects, but to aid a possible UI design, I decided to group options into smaller IVehicleOptionModels centered around DriveTrain, Interior and Exterior

I can imagine a UI implementation binding to an instance of IVehicle as a kind of ViewModel - and present it's available options for DriveTrain, Interior and Exterior on separate tabs or dedicatd DOM sections.

The IVehicleOptionModel features two collections, one for explaining all the available options for the given VehicleKind, and another for holding actual selections that the user could make and submit for a possible quote or query for availablity. In a more mature solution, I might move the user-selection business into in a dedicated ViewModel library - but I believe this simplicity for now is OK.

bkw.auto.biz

In this library I created hard implemenations of IVehicleOptionModel:

  1. drivetrains/HeavyDriveTrain
  2. drivetrains/StandardDriveTrain
  3. exterior/FactoryExterior
  4. exterior/AftermarketExterior
  5. interior/DeluxeInterior
  6. interior/StandardInterior

The above option models derive from a common base class in order to share common utility logic e.g. ToString()

I also created a hard instance of IVehicle, per each VehicleKind - these each feature a static BuildCar() factory method.

  1. EconomyCar
  2. SportsCar
  3. TruckCommercial
  4. TruckPickup

We can then implement the desired specialty options within each kind of vehicle class. For example: the EnconomyCar employs an instance of StandardDriveTrain while the TruckCommerical has a HeavyDriveTrain. The SportsCar has a DeluxeInterior and AftermarketExterior whereas some of the other vehicles have standard/factory options.

There is a bkw.auto.api.tests project for testing out some of the logic in this bkw.auto.biz library

Example C# Program

IVehicleOptionsProvider vehicleOptionsProvider = new bkw.auto.provider.CompiledVehicleOptionsProvider();

IVehicle fordPinto = EconomyCar.BuildCar("Ford Pinto", vehicleOptionsProvider);

Console.WriteLine($"{fordPinto}");//short description will print with default ToString implementation

Console.WriteLine($"{fordPinto.ToLongString()}");//special long description

Example Console Output

This Ford Pinto is a Economy Car that has a StandardDriveTrain (w/4 available options) , StandardInterior (w/3 available options) and FactoryExterior (w/4 available options)
This Ford Pinto is a Economy Car that has a 2 DriveType options [Front Wheel Drive, Rear Wheel Drive], 2 Tire options [All Weather Radial, All Weather Radial - Whitewall], AC Delco A/C package: Single Temp Dash Control, 2 Seats options [Vinyl-Bucket, Vinyl-Standard] and 2 Color options [Plain Red, Powder White]

bkw.auto.api

Most of my professional experience is with ASP.NET WebAPI 2 - and manually adding Swashbuckle into the mix (with a little pain and suffering on the side fiddling with an EDMX model). I thought I'd give the dotnet 6 webapi template a whirl - WHAT A DIFFERENCE - and the integration of the Swagger UI is already a done deal! This Web API can serve up a list of Vehicle options, as well as complete instances of IVehicle.

There is currently no database, and the options are loaded in memory by a CompiledVehicleOptionsProvider (which is also used in the bkw.auto.biz.tests project)

Example Web API response - GET /api/Vehicle?kind=EconomyCar

{
  "driveTrain": {
    "requirements": [
      "DriveType",
      "Tire"
    ],
    "availableOptions": [
      {
        "compatibileKinds": 2,
        "brand": "Ford",
        "name": "DriveType",
        "description": "Front Wheel Drive",
        "quantity": 1
      },
      {
        "compatibileKinds": 2,
        "brand": "Ford",
        "name": "DriveType",
        "description": "Rear Wheel Drive",
        "quantity": 1
      },
      {
        "compatibileKinds": 18,
        "brand": "Michelin",
        "name": "Tire",
        "description": "All Weather Radial",
        "quantity": 4
      },
      {
        "compatibileKinds": 18,
        "brand": "Michelin",
        "name": "Tire",
        "description": "All Weather Radial - Whitewall",
        "quantity": 4
      }
    ],
    "selectedOptions": []
  },
  "interior": {
    "requirements": [
      "A/C",
      "Seats"
    ],
    "availableOptions": [
      {
        "compatibileKinds": 30,
        "brand": "Ford",
        "name": "Seats",
        "description": "Vinyl-Bucket",
        "quantity": 1
      },
      {
        "compatibileKinds": 30,
        "brand": "Ford",
        "name": "Seats",
        "description": "Vinyl-Standard",
        "quantity": 1
      },
      {
        "compatibileKinds": 30,
        "brand": "AC Delco",
        "name": "A/C",
        "description": "Single Temp Dash Control",
        "quantity": 1
      }
    ],
    "selectedOptions": []
  },
  "exterior": {
    "requirements": [
      "Color"
    ],
    "availableOptions": [
      {
        "compatibileKinds": 2,
        "brand": "Ford",
        "name": "Color",
        "description": "Plain Red",
        "quantity": 1
      },
      {
        "compatibileKinds": 2,
        "brand": "Ford",
        "name": "Color",
        "description": "Powder White",
        "quantity": 1
      },
      {
        "compatibileKinds": 2,
        "brand": "--",
        "name": "Towing",
        "description": "(NONE OFFERED)",
        "quantity": 0
      },
      {
        "compatibileKinds": 2,
        "brand": "--",
        "name": "LuggageRack",
        "description": "(NONE OFFERED)",
        "quantity": 1
      }
    ],
    "selectedOptions": []
  },
  "name": "Ford Escape",
  "description": "Economy Car"
}

automobile's People

Contributors

bkwdesign avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.