Skip to content

clean-code-craft-tcq-1/function-ext-cs-VaibhavBhapkar

Repository files navigation

Programming Paradigms

Electric Vehicles have BMS - Battery Management Systems

Here is an article that helps to understand the need for BMS

Wikipedia gives an idea of the types and topologies

This site gives the optimum Charging-temperature limits

This abstract suggests a range for the optimum State of Charge

Here is a reference for the maximum charge rate

Possible purpose

  • Protect batteries while charging: at home, in public place, within vehicle / regenerative braking
  • Estimate life, inventory and supply chains

The Starting Point

We will explore the charging phase of Li-ion batteries to start with.

Issues

  • The code here has high complexity in a single function.
  • The tests are not complete - they do not cover all the needs of a consumer

Tasks

  1. Reduce the cyclomatic complexity.
  2. Separate pure functions from I/O
  3. Avoid duplication - functions that do nearly the same thing
  4. Complete the tests - cover all conditions.
  5. To take effective action, we need to know the abnormal measure and the breach - whether high or low. Add this capability.

The Exploration

How well does our code hold-out in the rapidly evolving EV space? Can we add new functionality without disturbing the old?

The Landscape

  • Limits may change based on new research
  • Technology changes due to obsolescence
  • Sensors may be from different vendors with different accuracy
  • Predicting the future requires Astrology!

Keep it Simple

Shorten the Semantic distance

  • Procedural to express sequence
  • Functional to express relation between input and output
  • Object oriented to encapsulate state with actions
  • Apect oriented to capture repeating aspects

My Assignment - Extended Features

Extended Features Listed Below

  1. Early Warning - Dictionary DS is used to implement it.
  2. Support a language in addition to English - German language option added by taking input.
  3. Accept input in different units - Accepting temperature in another unit and taking input accordingly.

My Assignment - Accumulation and Reporting Feature Addition

  1. By considering exisitng architecture built for extension assignment adding feature to get breached parameter name with message and adding all into dictionary DS.
  2. Same generated dictionary is used for reporting feature of consolelogger and dummycontroller logger.

About

function-ext-cs-VaibhavBhapkar created by GitHub Classroom

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published