• wizardbeard@lemmy.dbzer0.com
    link
    fedilink
    English
    arrow-up
    3
    ·
    7 months ago

    Sounds like they learned programming from heavily object oriented languages.

    As far as ternary operators go, I personally find them less readable than the longer if else format, but with any reasonably modern IDE or git setup that should be just a simple pass of an auto-formatting tool to convert them to the project/team standard. No need for any team friction. That should be automatically handled before it goes to review.

    I’m not in a position with a PR process or anything like that (I’m a glorified scripter in over his head where we need a dev team for internal tools) but I struggle with over reliance on functions as well.

    To keep from going overboard I always try to evaluate how often the block of code will see re-use (want to eliminate copy/paste and the footgun of forgetting to update a copy somewhere), how useful it would be to maintainers to have that section abstracted away into a black box (so you only have to worry about the part of the code that’s not working instead of the whole damn thing when something breaks), and how likely that block of code may need to be completely replaced later (if it’s separated out into a function, it’s a discrete chunk where we only have to maintain the same input and output formatting and ideally the rest of the program just werks).