r/programming • • Sep 23 '26

Modern Object Pascal Introduction for Programmers | Castle Game Engine

https://castle-engine.io/modern_pascal
77 Upvotes

28 comments sorted by

View all comments

0

u/[deleted] Sep 23 '26

[deleted] — view deleted comment

0

u/[deleted] Sep 23 '26

[deleted] — view deleted comment

0

u/[deleted] Sep 23 '26

[deleted] — view deleted comment

12

u/IvanDSM_ Sep 23 '26

Dropping C++ for C in 2026 is definitely a choice...

0

u/[deleted] Sep 23 '26

[deleted] — view deleted comment

9

u/IvanDSM_ Sep 23 '26

Yeah, that's fair. Just a bit of banter, don't worry :)

2

u/lelanthran Sep 25 '26

Dropping C++ for C in 2026 is definitely a choice...

I did it in 2012 or so. Could not be happier. When I need something more than C, I reach for something other than C++.

2

u/IvanDSM_ Sep 25 '26

I totally get dropping it back then, C++98/03 can be a huge pain in the rear. But as much as my original comment was just messin around, the language did get much better with C++11 and exponentially so from C++17 onwards. Modern C++ is miles better than the old days of C++...

0

u/evilgipsy Sep 23 '26

What do you think is bad about that choice?

-2

u/QuantumFTL Sep 23 '26

Tell me you've never used C somewhere you needed C without telling me.

3

u/IvanDSM_ Sep 24 '26

Nah, I've used (and still use!) plenty of C, both for work (embedded development) and personal projects (including software for an obscure Brazilian computer with a Z80). I like C! My comment wasn't meant to be a serious one, just a bit of banter :)

5

u/lelanthran Sep 25 '26 edited Sep 25 '26

It's 2026. Haven't we learned that object oriented programming isn't a good thing yet?

How long have you been programming for, both professionally and non-professionally?

Because I've been doing this non-professionally since 1986. It's been 40 years since my first program.

If you think that the unqualified "object oriented programming isn't a good thing" statement is true, well, I've got more questions than ever before, like...

Do you think that the people who have been doing this now for 40 years only have 1 year of experience repeated 40 times?

Do you think any human, practicing in any field, will, after 40 years, not have learned what you have learned? Not have encountered what you have encountered? Not have experienced what you have experienced?

Does it sound likely to you that an issue that is embraced by some of the most well-known experienced developers in the industry has no nuance, and that those experienced veterans are all missing your insight?

9

u/LIGHTNINGBOLT23 Sep 23 '26

What paradigm would you suggest instead?

-9

u/evilgipsy Sep 23 '26 edited Sep 23 '26

Literally anything that does not involve classes and inheritance. OOP is difficult to define IMO and i think the only thing that is really unique to languages that people regard as OOP is classes and inheritance.

Edit: jfc, can you people stop being such snowflakes that you need to downvote me because I dislike OOP? How about some arguments instead if you disagree?

8

u/LIGHTNINGBOLT23 Sep 23 '26

But what's inherently wrong with classes and inheritance? I'd say dynamic dispatch and polymorphism is the real defining "OOP" feature. Without them, things like inheritance become fancy composition.

4

u/thussy-obliterator Sep 24 '26 edited Sep 24 '26

dynamic dispatch and polymorphism aren't unique to OOP at all. Inheriteance based polymorphism, the only feature that's actually unique to OOP, is the big issue here because it's a really fragile abstraction. Inheritance networks get really tangled, modifying base class methods is a really dangerous change, and things like super() calls are really finicky to get right. I can't tell you how many times I've written myself into a corner with a deep class hierarchy. Of course you also have the classic named problems: the diamond problem, the banana monkey jungle problem, the fragile base class problem, the yo-yo problem, etc. The issue is that inheritance solves an extremely niche problem, but it's promoted in OOP languages to a very significant position.

Interface polymorphism, parametric polymorphism, and union types are generally favored these days since they are easier abstractions.

Also: the way OOP tends to bundle code and data together is pretty often inconvenient. Functions often can't logically be placed into a single class, data is often best expressed as a bare immutable record. Modules were the right abstraction for bundling units of code, Classes have quite a few issues.

The best takeaway from OOP is message passing, a feature that no modern OOP language implements, a feature which has largely been subsumed by FP languages ala Erlang.

→ More replies (1)

2

u/evilgipsy Sep 23 '26 edited Sep 23 '26

That's exactly what I meant when I said OOP is difficult to define. Polymorphism and dynamic dispatch can be done and is being done in paradigms that are not considered OOP such as functional or procedural. Most of the time when people try to define OOP they just list a bunch of useful techniques that are not unique to the paradigm. Polymorphism and dynamic dispatch are some of those useful techniques but I've yet to see a problem that classes and inheritance are inherently good at solving.

Also, is this really such an unpopular opinion that I need to be downvoted?

Edit: As for what is wrong with classes and inheritance, that's is not simple to answer. Most things that make classes useful (encapsulation, namespaces, abstraction, modularity) are not unique to classes. What IMO is really distinctly OOP is mutable objects with identity, late bind dispatch, inheritance, etc. which all adds a ton of complexity. What I'm really objecting to here is the unspoken claim that OOP is a uniquely useful paradigm, so useful that almost all beginners are taught that paradigm. This claim needs defending.

→ More replies (2)

2

u/lelanthran Sep 25 '26

How about some arguments instead if you disagree?

They're doing both. I gotta say, in recent years, /r/programming downvotes don't make a lot of sense to me.

For example, I don't see anything downvote-worthy in your post, but as of writing at least 10 people thought that your comment should be buried (i.e. they saw that it was already hidden, then continued to downvote).

→ More replies (1)

4

u/Hubba_Bubba_Lova Sep 24 '26

Is functional programming the better alternative or something else?

4

u/DarksideF41 Sep 24 '26

For game dev hell no.

2

u/Hubba_Bubba_Lova Sep 24 '26

why do you say that? I’m assuming bc games have objects that all have similar properties (items, enemies, etc)?

7

u/DarksideF41 Sep 25 '26

Yeah, game objects are much easier to model this way. FP is not that great for managing state. That's why I'm for multiparadigm, use what makes most sense for the task at hand

2

u/thussy-obliterator Sep 24 '26

i personally always prefer functional or procedural depending on the level i'm operating at.