2 Comments
User's avatar
⭠ Return to thread
Engineer's Codex's avatar

Yup - that's a great idea. Lots of ways to skin the cat here. My example isn't perfect, but one can make the argument that extending a function into multiple smaller functions that do similar things is even more unmaintainable.

Having to maintain 6 different API endpoints of get_llm_call_as_csv, get_llm_call_as_html, etc. is, in my opinion, even more unmaintainable than just using an enum in this case. That's 6 different API endpoints more to maintain compared to just 1, especially for functionality that is small enough that an enum can be the switch here.

Expand full comment
Nick Hodges's avatar

That's fair. I want thinking about the endpoints. I agree there.

Either way, your point is very well made.

I avoid booleans as you recommend. I think the enum is a very underused structure.

And I despise the use of underscores in variable names. 🙃

Expand full comment