Kache

joined 1 year ago
[–] [email protected] 3 points 1 day ago* (last edited 1 day ago)

inheritance to avoid code duplication

What no, inheritance is not for code sharing

Sound bite aside, inheritance is a higher level concept. That it "shares code" is one of several effects.

The simple, plain, decoupled way to share code is the humble function call, i.e. static method in certain langs.

[–] [email protected] 20 points 1 day ago (3 children)

If you used good objects, you'll only have to make the change in one place

IMO that's generally a retroactive statement because in practice have to be lucky for that to be true. An abstraction along one dimension -- even a good one, will limit flexibility in some other dimension.

Occasionally, everything comes into alignment and an opportunity appears to reliably-ish predict the correct abstraction the future will need.

Most every other time, you're better off avoiding the possibility of the really costly bad abstraction by resisting the urge to abstract preemptively.

[–] [email protected] 5 points 1 month ago (1 children)

Dedicated incremental static type checkers for dynamic languages already exist. In particular, Pyright for Python is fantastic and in many ways surpasses the type systems of classic typed languages

[–] [email protected] 1 points 1 month ago (1 children)

You can reference envs from the host in docker compose, so code it in instead of manually passing tribal knowledge in: https://stackoverflow.com/a/73826410

[–] [email protected] 1 points 1 month ago* (last edited 1 month ago) (3 children)

Simpler to keep everything in one compose file if you can, under a test service that doesn't build unless explicitly named

Un-weird that env var and use the normal, boring feature of defining environment under your test service

[–] [email protected] 2 points 1 month ago* (last edited 1 month ago) (5 children)

I've often been able to alias drun='docker compose run --rm --build' and simplify down to:

drun test

Should be able to encode all those wayward args into docker-compose.yml or Dockerfile and only use vanilla docker commands -- that's the whole point of containerization

[–] [email protected] 1 points 3 months ago

wanted to add something to the end of a for-loop, but had too little indentation

To address this, I prefer reducing length & depth of nested code, so the for/while is rarely ever not visible along with everything inside it. Others have success with editors that draw indentation lines.

opening up new/anonymous scopes

I occasionally use Python nested functions for this purpose

[–] [email protected] 11 points 3 months ago (1 children)

I find it's possible to operate Python as a statically typed language if you wanted, though it takes some setup with external tooling. It wasn't hard, but had to set up pyright, editor integration, configuration to type check strictly and along with tests, and CI.

I even find the type system to be far more powerful than how I remembered Java's to be (though I'm not familiar with the newest Java versions).

[–] [email protected] 2 points 3 months ago* (last edited 3 months ago) (1 children)

I prefer that, though (it's in my calendar, but I don't have to accept). I really can't stand Outlook's email-based calendar workflow.

[–] [email protected] 3 points 4 months ago

That's only because the former already implies much of the latter, so they don't need to repeat it

[–] [email protected] 9 points 6 months ago (1 children)

If it takes 1+ hours of work to remove a feature flag branch in an area of code, I wouldn't trust the correctness of anything the AI writes and would be super skeptical about anything the humans had written.

[–] [email protected] 7 points 6 months ago

It refers to a male cousin that is NOT in the same paternal line, so maybe not too uncommon?

view more: next ›