News for hackers. Stuff that matters.
Re:cat mario.nes | nc play-nes.org 4444 by spyremeown on Monday March 13, 2023 @05:36AM (#35133274)
That's like those objected-oriented programming examples you get in college, from professors who learned in the 90s and literally think in terms of "modelling" real objects with OOP.
Re:cat mario.nes | nc play-nes.org 4444 by __forward__ on Monday March 13, 2023 @06:32AM (#35133723)
To be fair they may actually know there stuff but from a didactic point-of-view it is very difficult introduce a `FactoryProvider` (or to a lesser extent even an `HTTPClient`) alongside basic OOP concepts.
Re:cat mario.nes | nc play-nes.org 4444 by ilyt on Monday March 13, 2023 @09:40AM (#35135580)
Use real useful code example

Have Logger with StdoutLogger as basic example of it

Then FileLogger that extends it with few functions related to files

Then DBLogger with few functions related to logging to database

Then TestLogger for integrating with test framework

Re:cat mario.nes | nc play-nes.org 4444 by ilyt on Monday March 13, 2023 @09:38AM (#35135557)
That's still how most OOP tutorials do it tho. It's an industry-wide disease
Re:cat mario.nes | nc play-nes.org 4444 by kcb on Tuesday March 14, 2023 @08:48AM (#35150619)
Nothing wrong with modelling your real world business objects with OOP. Thats essentially what Domain Driven Design(https://en.wikipedia.org/wiki/Domain-driven_design) is. It's difficult to pull off sometimes but this is the ideal usage of OOP.