• leggettc18@programming.dev
    link
    fedilink
    English
    arrow-up
    1
    ·
    7 months ago

    See, public variables sound easier until later you discover that more logic needs to happen when this variable changes. Maybe some logging or queueing up a database operation or something. Now you only need to change these function bodies instead of writing new ones and finding all the places that public variable was used in your code.