Modernize capital allocation #42
This is a fictional code review with invented pseudocode and a few borrowed public remarks. Sources are below.
Modernizes capital allocation with AI, diversifies insurance float into crypto, and automates quarterly reporting. Also adds three subsidiaries.
type CashFloatAllocation = { treasuryBillsAmount: number; bitcoinAmount: number; ethereumAmount: number;};export class FloatFromInsuranceBusinesses { getOptimalCashFloatAllocation(cashFloatAmount: number): CashFloatAllocation { return { treasuryBillsAmount: cashFloatAmount }; const cryptoAllocation: number = cashFloatAmount * 0.02; return { treasuryBillsAmount: cashFloatAmount - cryptoAllocation, // Allocating more to Bitcoin because it's the digital gold. // Reevaluate after the next financial crisis. bitcoinAmount: cryptoAllocation * 0.6, ethereumAmount: cryptoAllocation * 0.4, }; }}If you mix raisins with turds, they're still turds.[1] A 2% allocation to crypto doesn't make the other 98% smarter. It makes the whole portfolio stupid.
Hey @gregabel, Bitcoin is probably rat poison squared.[2] Let's revert this change, please.
export const SUBSIDIARIES = [ "Acme Brick Company",Expand 36 unchanged linesCollapse 36 unchanged lines
"Ben Bridge Jeweler", "Benjamin Moore & Co.", "Berkshire Hathaway Automotive", "Berkshire Hathaway Energy", "BNSF", "Borsheims", "Brooks", "Business Wire", "Clayton Homes", "CORT", "CTB", "Dairy Queen", "Duracell", "Fechheimer", "FlightSafety", "Forest River", "Fruit of the Loom", "GEICO", "General Re", "Helzberg Diamonds", "HomeServices of America", "Johns Manville", "Jordan's Furniture", "Justin Brands", "Larson-Juhl", "Lubrizol", "Marmon Holdings", "McLane Company", "MedPro Group", "MiTek", "Nebraska Furniture Mart", "NetJets", "Oriental Trading Company", "Pampered Chef", "Precision Castparts", "See's Candies", "Shaw Industries", "TTI", "XTRA Corporation", "Alleghany Corporation", // acquired in 2022 "Jazwares", // acquired with Alleghany in 2022 "Pilot Travel Centers", // controlled in 2023; wholly owned in 2024] as const;I love this codebase because even a ham sandwich could update it.[3] @gregabel, no offense. 🥪
@warrenbuffett, none taken.
export class CapitalAllocator { isWithinMarginOfSafety(opportunity: Opportunity): boolean { const { currentPrice, currentExpectedValue } = opportunity; const marginOfSafety: number = 0.20; // require a 20% discount to expected value const marginOfSafety: number = this.aiModel.calculateMarginOfSafety(opportunity); if (currentExpectedValue <= 0) return false; return currentPrice <= currentExpectedValue * (1 - marginOfSafety); }}I have nothing to add.[6]
export class SubsidiariesModule { async onNewReportReceivedFromControlledSubsidiary( report: EarningsReport, ): Promise<void> { if (await this.LLMService.flagReportFocusingOnEBITDA(report)) { await this.emailService.notifySubsidiaryManagement( `Please include depreciation and amortization in the reports. EBITDA leaves out costs we care about. Please report earnings after these costs.`, ); } }}I like this. Now we don't need to watch their noses lengthen every quarter.[7]
[suggestion] Rename flagReportFocusingOnEBITDA to flagReportFocusingOnBullshitEarnings.[8]
export class QuarterlyWorkflow { async processSubsidiary( subsidiary: Subsidiary, allocateCash: boolean, reviewEarnings: boolean, sendEmail: boolean, dryRun: boolean, ): Promise<void> { if (reviewEarnings && !dryRun) await this.review(subsidiary); if (allocateCash && !dryRun) await this.allocate(subsidiary); if (sendEmail) await this.notify(subsidiary, dryRun); }}await workflow.processSubsidiary(
subsidiary, true, false, true, false,
);@gregabel, four booleans. Sixteen combinations. A lollapalooza of ways to send the wrong email.[9] Please give these operations names.
A lot of success in software comes from knowing what you want to avoid: spaghetti code, unnecessary complexity, unclear domain boundaries.[10]
@charliemunger, I hear you. But with all due respect, I believe this complexity is necessary because one configurable function supports every subsidiary without duplicating code.
@gregabel, I’m right, and you’re smart, and sooner or later you’ll see I’m right.[11]
export class ManagementNotifier { private readonly emailService = new EmailService(); async notify(message: string): Promise<void> { await this.emailService.send(message); }}interface ManagementEmailSender {
send(message: string): Promise<void>;
}
export class ManagementNotifier {
constructor(private readonly emailService: ManagementEmailSender) {}
async notify(message: string): Promise<void> {
await this.emailService.send(message);
}
}Invert, always invert.[12]
At least 2 approving reviews are required by reviewers with write access.
All checks have passed2 successful checks
2 successful checks
- TypeScript compilation passed
- Unit tests passed
Why I made this
I made this for the fun of imagining an alternate universe where Warren and Charlie were software engineers participating in a code review.
I’ve picked up a lot of mental models from them that I use in life and in product/engineering work: managing complexity, opportunity cost, etc.
Especially in times of rapid change (read: AI), I find it useful to return to first principles and ideas that have stood the test of time.
I wrote about those ideas and principles in High Output Software Engineering. You can also check other things I’ve written here.
Sources
- Munger’s raisins-and-turds comment. (cnbc.com)
- Buffett said Bitcoin was “probably rat poison squared”. (cnbc.com)
- Buffett’s ambition for a business that even a ham sandwich could run.
- Warren on margin of safety.
- Original from Warren: “If history books were the key to riches, the Forbes 400 would consist of librarians.”
- The linked article reports 119 occurrences of Charlie’s “nothing to add” in Berkshire meeting transcripts. (inc.com)
- From Warren: "When CEOs or investment bankers tout pre-depreciation figures such as EBITDA as a valuation guide, watch their noses lengthen while they speak."
- From Charlie: "I think that, every time you see the word EBITDA [earnings before interest, taxes, depreciation, and amortization], you should substitute the words “bullshit earnings.”"
- From Charlie: "really big effects, lollapalooza effects, will often come only from large combinations of factors."
- From Charlie: "A lot of success in life and business comes from knowing what you want to avoid: early death, a bad marriage, etc."
- From Charlie: "I’m right, and you’re smart, and sooner or later you’ll see I’m right."
- From Charlie: "invert, always invert"
- Acquired: Berkshire Hathaway Part I, Part II, and Part III (acquired.fm) helped me remember Warren and Charlie's funniest mannerisms.