Git Product home page Git Product logo

the_dmv's Introduction

The DMV

Reflection

  • Describe the steps you took to dig in to this code base. What was your process? If you don’t feel you had a process, define one that you might like to try next time

    • I took several steps to get this far in fixing the dmv, vehicle and facility files. The first thing I did was identify which problems there were by using rspec in the main folder - that showed me all of the failures that existed in each of the files. From there, I tried to identify which files were dependent on which files before it and decided to start with the facility. I was first confounded by trying to set up a new class with hash attributes, which was something I had never done before, so my instinct was to set them up using individual attributes. From there, my process was to try to debug and let the error/failure messages guide me. My first clue was that initializing a new facility was only expecting 1 argument, but I was giving it multiple arguments. After quickly googling I found that I wanted to setup the initialize method with a hash, and then use a special syntax to access those details in the attributes (I've quickly attempted to recreate a similar Vehicle class below to see if the different syntax stuck in memory):
    class Vehicle
      attr_reader :year,
                  :make,
                  :model
      def intialize({:year, :make, :model})
        @year   = vehicle_details[:year]
        @make   = vehicle_detils[:make]
        @model  = vehicle_details[:make]
      end
    end
  • What was hard about working with code you did not write?

    • What was hard about working with code that I didn't write was that I didn't really know where to begin at first. After I slowed my brain down and tried to eat the elephant, it became overwhelming seeing all of the errors that were there, so I just tried to continue taking it one bite at a time. I think that especially if I hadn't had an interaction pattern to follow, or knew that the source of truth was the test, then it would get really overwhelming really quickly to try to figure out what was happening and why.
  • What was easier than you expected about jumping in to an unfamiliar codebase? What made it easy? If nothing felt easy, what would’ve helped you feel more comfortable more quickly?

    • Similar to above, what was easier about working with unfamiliar codebases was that I could pick some clues from the codebase to figure out something else that was going wrong. For instance, I took some clues from the vehicle class to help figure out the facility class. Working with a codebase was also easier because I had so much of the work done already. It nothing had felt easy, I think that chatting it through with another developer, or the former developer if that was an option, might have made it feel a little more familiar. Having a debugging tool to see what the code was doing was invaluable. I'm sure it would have taken quite a bit longer to solve some of those bugs had it not been for require 'pry'; binding.pry.

Notes to Self

Iteration 1

  • Wtf is require 'date' in line 1 of the vehicle class? Is date a standard gem file that's being accessed in Date.antique?
  • Utilizing the attr_accessor instead of attr_reader in vehicle class for the registration date since, presumably, it will need to be accessed/edited later on when that car is registered

Iteration 2

  • Why is the facility class utlizing @facility instead of facility?
  • With starting the reading from external data sets...
    • I think that the facility class may need a new_drivers_license method based on line 23 from the facility spec?
  • In a pry in dmv_data_service_spec I could access specific information in the array using the following:
[7] pry(RSpec::ExampleGroups::DmvDataService)> DmvDataService.new.wa_ev_registrations[5]
=> {:electric_vehicle_type=>"Battery Electric Vehicle (BEV)",
 :vin_1_10=>"WVWKR7AU7K",
 :dol_vehicle_id=>"296928922",
 :model_year=>"2019",
 :make=>"VOLKSWAGEN",
 :model=>"e-Golf",
 :vehicle_primary_use=>"Passenger",
 :electric_range=>"125",
 :odometer_reading=>"0",
 :odometer_code=>"Odometer reading is not collected at time of renewal",
 :new_or_used_vehicle=>"Used",
 :sale_price=>"0",
 :base_msrp=>"0",
 :transaction_type=>"Registration Renewal",
 :transaction_date=>"2021-09-13T00:00:00.000",
 :transaction_year=>"2021",
 :county=>"King",
 :city=>"REDMOND",
 :state_of_residence=>"WA",
 :zip=>"98052",
 :non_clean_alternative_fuel=>"HB 2778 Eligiblity Requirements not met",
 :hb_2042_clean_alternative_fuel_vehicle_cafv_eligibility=>"HB 2042 Eligibility Requirements not met",
 :meets_2019_hb_2042_electric_range_requirement=>true,
 :meets_2019_hb_2042_sale_date_requirement=>false,
 :meets_2019_hb_2042_sale_price_value_requirement=>false,
 :_2019_hb_2042_battery_range_requirement=>"Meets battery range requirement",
 :_2019_hb_2042_purchase_date_requirement=>"Non-sale, registration transaction",
 :_2019_hb_2042_sale_price_value_requirement=>"Non-sale, registration transaction",
 :electric_vehicle_fee_paid=>"Yes",
 :transportation_electrification_fee_paid=>"Yes",
 :hybrid_vehicle_electrification_fee_paid=>"No",
 :census_tract_2020=>"53033032330",
 :legislative_district=>"45",
 :electric_utility=>"PUGET SOUND ENERGY INC||CITY OF TACOMA - (WA)"}

...

[14] pry(RSpec::ExampleGroups::DmvDataService)> DmvDataService.new.wa_ev_registrations[5][:make]
=> "VOLKSWAGEN"

Iteration 3

  • When creating a facility factory, it appears you can use || as a way to check for different keys but not or
  • Ideally, we would normalize street address and not have it be all caps (an example of how you might go about this is below):
[2] pry(#<RSpec::ExampleGroups::FacilityFactory::Iteration3::DifferentFactories>)> a = "hello world"
=> "hello world"
[3] pry(#<RSpec::ExampleGroups::FacilityFactory::Iteration3::DifferentFactories>)> a.capitalize
=> "Hello world"
[4] pry(#<RSpec::ExampleGroups::FacilityFactory::Iteration3::DifferentFactories>)> a.capitalize
=> "Hello world"
[5] pry(#<RSpec::ExampleGroups::FacilityFactory::Iteration3::DifferentFactories>)> a.split(" ").capitalize.join
NoMethodError: undefined method `capitalize' for ["hello", "world"]:Array
from (pry):5:in `block (4 levels) in <top (required)>'
[6] pry(#<RSpec::ExampleGroups::FacilityFactory::Iteration3::DifferentFactories>)> a.split(" ").each do |caps|
[6] pry(#<RSpec::ExampleGroups::FacilityFactory::Iteration3::DifferentFactories>)*   caps.capitalize
[6] pry(#<RSpec::ExampleGroups::FacilityFactory::Iteration3::DifferentFactories>)* end  
=> ["hello", "world"]
[7] pry(#<RSpec::ExampleGroups::FacilityFactory::Iteration3::DifferentFactories>)> ret = a.split(" ").each do |caps|
[7] pry(#<RSpec::ExampleGroups::FacilityFactory::Iteration3::DifferentFactories>)*   caps.capitalize!  
[7] pry(#<RSpec::ExampleGroups::FacilityFactory::Iteration3::DifferentFactories>)* end  
=> ["Hello", "World"]
[8] pry(#<RSpec::ExampleGroups::FacilityFactory::Iteration3::DifferentFactories>)> a
=> "hello world"
[9] pry(#<RSpec::ExampleGroups::FacilityFactory::Iteration3::DifferentFactories>)> a.capitalize!
=> "Hello world"
[10] pry(#<RSpec::ExampleGroups::FacilityFactory::Iteration3::DifferentFactories>)> ret
=> ["Hello", "World"]
[11] pry(#<RSpec::ExampleGroups::FacilityFactory::Iteration3::DifferentFactories>)> ret.join
=> "HelloWorld"
[12] pry(#<RSpec::ExampleGroups::FacilityFactory::Iteration3::DifferentFactories>)> ret
=> ["Hello", "World"]
[13] pry(#<RSpec::ExampleGroups::FacilityFactory::Iteration3::DifferentFactories>)> ret.join(" ")
=> "Hello World"
[14] pry(#<RSpec::ExampleGroups::FacilityFactory::Iteration3::DifferentFactories>)> 

the_dmv's People

Contributors

garrettgregor avatar epintozzi 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.