Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
OOP is not that bad (osa1.net)
3 points by todsacerdoti on Oct 9, 2024 | hide | past | favorite | 1 comment


In that specific article, "OOP" seems to be mostly about dependency injection and structural typing, ie you can pass to a function a Logger, all Loggers have the same interface but they do different things.

In Go this could be a function or a constructor (that are also functions) that takes a Logger interface.

I only have vague knowledge of Haskell but I think you could achieve this by having Logger be a record, containing the different functions, and pass different "implementations" of Logger to functions that need them?




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: