Property Decorators vs Getters - Setters: Accessor BATTLE!

Python's @property vs JavaScript's get/set - which property syntax is cleaner? EPIC!

#python #javascript #pythonvsjs #propertydecorator #getterssetters #accessors #computedproperties #viralcoding #oop #programmingpatterns #syntaxcomparison #mindblown

https://www.youtube.com/watch?v=jNo4mdvwG_I

Property Decorators vs Getters - Setters: Accessor BATTLE! #getterssetters

YouTube

Global Scope CHAOS: var vs $GLOBALS!

JavaScript's global scope vs PHP's superglobals - which is messier? CONTROVERSIAL!

#php #javascript #phpvsjs #globalscope #superglobals #globalvariables #scopemanagement #viralcoding #programmingpatterns #bestpractices #mindblown #gotchas

https://www.youtube.com/watch?v=6xlPsrbGR78

Global Scope CHAOS: var vs GLOBALS! #viralcoding

YouTube

Context Managers: Python's 'with' is GENIUS!

Python's context managers vs PHP's try-finally - which handles resources better? INSANE difference!

#php #python #phpvspython #contextmanagers #withstatement #tryfinally #resourcemanagement #filehandling #viralcoding #pythonmagic #mindblown #programmingpatterns

https://www.youtube.com/watch?v=ojArYRcxXqg

Context Managers: Pythons with is GENIUS! #tryfinally

YouTube
Ah yes, the riveting tale of "Oops, I Did It Again" programming patterns! 🎉🤦‍♂️ Because who doesn't love a language that practically rolls out the red carpet for #bugs and blunders? It's like engineers are playing a perpetual game of 'Spot the Trap'—what could possibly go wrong? 💻🐛
https://thetechenabler.substack.com/p/programming-affordance-when-a-languages #OopsIDidItAgain #ProgrammingPatterns #Blunders #SoftwareEngineering #Debugging #HackerNews #ngated
Programming affordance: when a language's patterns make it natural to make mistakes

Many of my philosophies in work life, my volunteer life, and my personal life stem from experiences. As a developer, many of those come from being burnt by rough edges or mistakes, just as health & safety principles come from accidents.

The Tech Enabler

I have a #ProgrammingPatterns problem in my #Godot #GameDev project. I think that the solution is some kind of dependency inversion, but here's the problem.

I have an autoload (global Singleton) which manages interaction between different entities in the game. Each game entity exists in the autoload as a class instance. Interactions follow the Command pattern, and call methods on those entity instances that modify the world state. So far so good.

However, each entity also has game objects when it is in the current scene. For example, some animated sprites, physics objects, stuff like that. Those scene nodes are primarily controlled by the Singleton-managed entities. When they enter the scene tree they register themselves, load their state, and do their stuff.

And here's the problem: the same interaction needs to do different logic depending on if it has a scene node or not! For example, when I call "open" on a door, if it's in the scene it needs to tell the scene node to play an opening animation, wait for the animation to finish, and then set its state to open. But if the door is not in the scene (maybe it's being opened remotely from a different room), it needs to just set the state to "open."

What's the best way to do this? Just branching logic depending on if a scene node is registered or not feels like it will become problematic eventually, when there are many many entities with all kinds of unique scripting. Maybe there should be some kind of interface that can be called, that will have a scene node implementation and an additional default implementation that will be used if the scene node isn't registered. This feels overly complicated, especially given that GDScript doesn't really support interfaces that well.

Important considerations are that I need to be able to get feedback when those methods are called, so I can't use signals (an observer pattern), and it should be easy to override various methods to allow unique scripts for any object. And it needs to be reasonably scalable because there are going to be a lot of those and I need to be able to manage them.

What do you think? I'm guessing that this has already been solved before.

Boosts welcome.

#programming

Trying hard to wrap my head around the advantage of visitor pattern over matching or traits in #Rust when analyzing an AST. Especially since the AST is based on Enums and not on trait objects.

The structure of the DSL is not very conventional because it's more of a thing to describe data than logic. But there is logic using logical expressions that live inside of some data definitions.

If I start over using a Visitor pattern it will be my 3rd attempt at writing this logic. I'm not used to my code turning into spaghetti like that.

#ProgrammingPatterns

Is there an accepted pattern for replacing your database pool in an #actixweb application? As in, the system is rotating the database password, updates the file handle it’s passed through to the application, and then my application should reconnect using the new credentials and drop the old connection.
#rustlang #rust #sqlx #ProgrammingPatterns

Spatial Partition (Game Programming Patterns): https://gameprogrammingpatterns.com/spatial-partition.html

Efficiently locate objects by storing them in a data structure organized by their positions.

#GameDev #GameProgramming #ProgrammingPatterns

Spatial Partition · Optimization Patterns · Game Programming Patterns