• 0 Posts
  • 16 Comments
Joined 1 year ago
cake
Cake day: June 16th, 2023

help-circle
  • I would call those language-specific. While they are useful in more than one language, they are also replaced by language features in many languages.

    • Builder pattern can be simplified with kwargs (Python, C#) or argument objects (JS, C++).
    • Factory pattern can be simplified with first-class types (Lisp, Haskell).
    • Visitor pattern is similarly simplified by first-class functions (supported by most languages nowadays).
    • Dependency injection of concept X is generally simplified by first-class X. I think the least widely supported is dependency injection of effects (Koka).

  • Design patterns are typically just workarounds for the limitations of the chosen programming language. What you might consider a pattern in C might just be a simple language feature in C++, and the patterns in C++ (as popularized by GoF) might just be language features in Lisp/Rust/whatever.

    So rather than thinking about patterns, you should first choose the right language for the task. If you’re working on a parser, you might prefer Haskell. If you need formal verification, there’s C and Idris and little inbetween. If you need to hire lots of developers, something widely-known like JS might be the choice.

    After you’ve chosen a language, you can identify the things that the language is bad at and apply the appropriate design patterns. Sometimes the patterns can be found in books (C++, Java) and sometimes it’s just tribal knowledge (D).












  • Another point in favour of databases is simplicity of client-server communication and data models.

    Many objects in WoW (not too sure about spells, but most likely them too) work such that the client asks the server for the related DB rows when it sees an object for the first time. So instead of sending code across the wire, which would be a bad idea for many reasons, you instead send structured data that the client interprets.

    Of course, you could just bake the spell code into the client at compile-time, but then dataminers will take it apart on day 0. WoW datamining mostly works such that you play the game normally and see what data the server gives you.