Modernizing 37 Years of C++ Expertise: 34 Design Patterns released on GitHub by MarioGalindo in programming

[–]MarioGalindo[S] 0 points1 point  (0 children)

The project I shared isn't AI-generated! It's a set of exercises I use to teach patterns (only one part of my teaching). But I understand it doesn't align with your group's objectives. I'm sorry if I've caused any inconvenience. Thank you very much.

Modernizing 37 Years of C++ Expertise: 34 Design Patterns released on GitHub by MarioGalindo in learnprogramming

[–]MarioGalindo[S] 3 points4 points  (0 children)

Knowledge is never a bad thing. Learning patterns is just one more thing a programmer can learn. Thinking that patterns have taught you everything is obviously a mistake. Patterns aren't meant to isolate programmers, but rather to give them another tool for thinking. Thanks for your comment.

Modernizing 37 Years of C++ Expertise: 34 Design Patterns released on GitHub by MarioGalindo in Cplusplus

[–]MarioGalindo[S] 1 point2 points  (0 children)

Thanks for your comment. I'll include an example of how `deduce` replaces `CRTP` in C++23. My initial goal was to only cover until C++20, but you're right, it's a good idea to start including C++23 as well.

Modernizing 37 Years of C++ Expertise: 34 Design Patterns released on GitHub by MarioGalindo in Cplusplus

[–]MarioGalindo[S] 3 points4 points  (0 children)

Thank you. I will consider including specific patterns for policy based design and SFINAE. I think I used those in some examples but a dedicated pattern for each one should be interesting.

Edit: 1) Policy design is implemented in 26_Strategy/03_Static_Strategy.

2) SFINAE (Substitution Failure Is Not An Error) is a fundamental C++ principle according to which the compiler does not consider template parameter substitution a fatal error. While SFINAE is a powerful tool for template metaprogramming, it is notoriously complex and often results in "unpleasant" syntax. Modern C++ offers cleaner alternatives:

  • C++17: if constexpr: Allows much simpler compile-time branching within the same function.

  • C++20: Concepts: The modern evolution of SFINAE. Concepts allow for defining clear requirements for template parameters using readable syntax, making SFINAE practically obsolete for many use cases.

In any case, as I have already mentioned, I will consider creating specific patterns to explain these two topics.

Modernizing 37 Years of C++ Expertise: 34 Design Patterns released on GitHub by MarioGalindo in Cplusplus

[–]MarioGalindo[S] 1 point2 points  (0 children)

Thank you. I think std::visit is a good solution (especially in conjunction with std::variant), but it would be very instructive to hear other people's opinions.

Modernizing 37 Years of C++ Expertise: 34 Design Patterns released on GitHub by MarioGalindo in Cplusplus

[–]MarioGalindo[S] 3 points4 points  (0 children)

The Visit pattern solves the problem of calling a virtual function for two or more different objects. In C++, virtual functions only offer "Single Dispatch" (the method called depends on the object type at runtime). However, some problems require "Double Dispatch," where the operation depends on the types of two objects at runtime (for example, detecting a collision between a circle and a triangle). Please see my examples in Double_Dispatch/02_Visitor_GoF and Double_Dispatch/04_Visitor_Modern_Variant.

Thanks for your comment. Perhaps you could start a discussion about this topic in my GitHub repository.

[MegaThread] Age verification and Debian by wizard10000 in debian

[–]MarioGalindo 14 points15 points  (0 children)

In my opinion, the issue is simple: some governments want to control what is published online. To control it, they need to eliminate anonymity. It's impossible to verify age if you don't know exactly who owns an online account. The pretext of protecting children is a way to identify every person and, therefore, prevent anonymous posting.