By any other name: What to call similar things
Thursday, 16 January, 2020 — development
On a recent code review, one of my teammates was adding a new branch of code behind a feature flag to adjust how our site search weights potential results.
The existing code had a constant I’ll call
RESPONSE_WEIGHT. The new
RESPONSE_WEIGHT_NEW. Both would co-exist while the feature flag
Given this is a temporary feature flag that should be retired once the code is
determined to be steady-state in production, going back through the code and
taking out the feature flag and the old branch will leave
In a few weeks or months, I or another teammate are going to look at
RESPONSE_WEIGHT_NEW and wonder what new means. If, we decide to further adjust
search result weighting,
RESPONSE_WEIGHT_NEW is an outright misleading name.
Appending a name with
_old is tempting because it doesn’t require a
lot of creativity. It isn’t a great idea, because the new or oldness of it
quickly loses context.
If there’s a need to separate functionality or naming by a feature flag, use a
_2020_Q1, which ties the name to a point in time.
This will also likely leave an earlier name around, and, context dependent,
those can also change with a suffix
_PRE_2020_Q1, if there’s not already a
data quantifier on something.
Then, if and when it comes time to remove the feature flag, the code isn’t
populated with now contextless
_new entries. Similarly, the code won’t be
In this case, the pull request feedback resulted in
which is more likely to remain an accurate name as long as it lives on in the
Ruby Standard Gems
Thursday, 9 January, 2020 — ruby development
At work, I’m upgrading my team’s Rails application from Ruby 2.5 to 2.6. In the course of tracking down test failures between the two versions, I’ve found the following site helpful: stdgems.org/.
In short, it describes the gems that are shipped with Ruby and the versions that shipped with each version, which is helpful in tracking down behavior changes that might not be described by the language changes themselves.
In a case specifically relevant to how the application handles invalidly formatted CSV files, I learned that for the CSV gem, Ruby 2.5 shipped with version 1.0 while version 3.0, started shipping with the 2.6 series. That detail was helpful in determining that the way we structured the test for a failing case was no longer going to work, and I needed to restructure the test. Yay!
Buy yourself a cast iron skillet
Wednesday, 1 January, 2020 — cooking
New Year’s Day breakfast was scrambled eggs cooked in a 12-inch cast iron skillet, along with some whole wheat toast. I preheat the skillet over medium-high heat on our electric range, then drop the temperature to medium as I pour the eggs in. Fluffy scrambled eggs take about 90 seconds from there, folding the eggs two or three times.
A $40 12-inch Lodge skillet will last me the rest of my life. It is heavy and heats evenly.
Cooking with cast iron is a consistently better experience than I remember using non-stick skillets. Well-seasoned cast iron with some butter or oil is enough. Along the way, I monitoring as I cook. Unless I’m intentionally searing a steak, that little bit of butter or oil on top of the skillet’s seasoning is enough to keep the skillet pretty clean and food easy to release.
Cast iron seems less convenient because you generally don’t want to dry cook in them, but I’ve not found that to be true in practice. I see TV advertisements for non-stick pans being able to cook eggs without butter or oil. Friends, I’ve never had non-stick skillets work that well. Additionally, the non-stick coatings will scratch and eventually wear down. I was using either wood or high temperature-tolerant nylon spatulas to avoid scratching the coating on non-stick skillets. By contrast, cast iron is completely happy with more durable metal spatulas.
Another perceived limitation of cast iron is having to hand wash them. This is true, cast iron cannot be run through the dishwasher. I was still washing my non-stick cookware by hand, though. I cleaning my cast iron skillet while they’re still warm after cooking with hot water and adding a very small drop of dish soap placed on a chainmail scrubber. In the absence of that kind of scrubber, I’ve used both coffee grounds and salt to scour skillets.
Once the skillet’s clean and dry, put a penny-size drop of oil into the pan, wipe it around for an even coating with a paper towel to keep the seasoning fresh, then put the skillet away. You’re done.
🔗 Tesla driver filmed ‘asleep’ at wheel in Los Angeles
Saturday, 24 August, 2019 — links technological-failure
From The Independent:
A video appearing to show a Tesla driver asleep while his vehicle drove on auto-pilot has prompted criticism online.
The footage, posted on Twitter by US journalist Clint Olivier and filmed by his wife Alisha, was filmed on Los Angeles‘ busy interstate 5 last Saturday morning.
As Mr Olivier drives past the car, which is travelling steadily along the middle lane, Ms Olivier can be heard saying: “He’s totally asleep. This is crazy.”
There’s a broader post to write about the specific nomenclature of Tesla’s semi-autonomous driving tech being named Autopilot, and how drivers interpret the word. Until I write it, it will have to suffice to say that this incident isn’t the first such incident and will not be the last.
The driver is lucky this wasn’t fatal.
A hoped-for 2019 Raleigh city council platform
Tuesday, 18 June, 2019 — civics Raleigh
Updated: June 24, 2019
Oct. of 2019 is going to bring around another biannual election for city council and mayor in Raleigh. There’s quite a bit of hot button issues:
- Concern that Raleigh is quashing “innovative business models” by regulating electric scooters and restricting what manner of AirBnB rentals will be allowed
So, at the forefront of thinking for a few minutes, but really the result of lots of background thinking, here’s some of what I’d like 2019 city council candidates to get behind:
- Affirm that scooters pay their way for using public infrastructure
- Private businesses cannot appropriate public infrastructure
- Sidewalk use for scooters, bikes, etc. are subject to permitting and usage fees
- AirBnB pays hotel tax for short term whole house rentals
- My complex proposal here is “if it quacks like a duck, treat it like a duck”
- “But why do you love hotels over homeowners, Nathan?” Because when you treat your personal assets like a business, you get the responsibilities of acting like a business and hotels charge and pay through occupancy tax
- Vacancy tax
- Encourage folks sitting on vacant property and vacant lots to develop them
- If property owners want to keep houses or office buildings or lots bare for years on end, put a surcharge on their property taxes
- Offer property owners who have vacant property the opportunity to sell to the city at a fair-market rate. The fair market rate doesn’t budge, however, after the property tax surcharge kicks in.
- Traffic prioritization: Pedestrians then bicycles then mass transit then cars
- Raleigh is lousy for sidewalks outside of the downtown core. A whole lot more of the city could be walkable
- Instead of expanding the number of traffic lanes on a given road, the city should first opt to add or expand multi-use paths for cycling, walking. Increase bus coverage and service frequency as well. Give buses protected stops and traffic priority.
- Allow multi-family structures in residential zoning
- The proverbial mother-in-law suite, yes, but also, allow two address/two front-door buildings anywhere they currently aren’t
- City acquires and leases-back housing in East and Southeast Raleigh to local residents
- Instead of watching what a lot of folks think is inevitable, that the predominantly black neighborhoods east and south of downtown are bought up by developers, residents evicted and redeveloped into suddenly much higher “market rate” housing, the city ought to acquire housing at-risk of gentrification, rent the houses back to their current occupants and help those occupants make improvements to the properties. Grant occupants equity
- No public tax money for exclusive private benefit
- The city should forswear using public money to be offered as tax incentive for private businesses. E.g. the city was part of a pitch team trying to land Amazon HQ2 and part of that was likely to have been significant breaks on property taxes and providing other incentives for Amazon to locate here. Meanwhile, every regular business and homeowner pays property taxes.
- The city should focus on answering problems around affordable housing and transit ahead of contributing money, land or other in-kind consideration for new sports facilities
- The city should definitely not publicly finance a new professional sports arena and let a private ownership group reap the rewards of operating the arena
I want Raleigh to grow inclusively. That a resident who needs the bus to get to work, child care and other errands and fun has robust access to the city. That not only do we not gentrify historically disadvantaged neighborhood residents, but we robustly protect them and help them. That we think about getting around the city more creatively than how fast we can get sport utility crossovers down Six Forks and Falls of Neuse.
Are these the best ideas? Probably not. I fully expect there are better expressions of them, and I’ll add them and source them as I find out about them.