Skip to content

u/JaggerPaw

In this archive from May 2011 to Oct 2022

2
posts
42
comments
1
media
32
score

As a developer, you need to get used to the idea that 99.9% of everything you ever create/write will be tossed, deleted, and/or forgotten.

This is true of every industry, not just game development.

Doing the work should be its own reward. Knowing that people use it (even if it's just other devs) is sugar on top.

3 points

"Hacked" has various meanings. For the purposes of the conversation, we're talking about changes to the game that affect the gameplay for other people.

There are plenty of games where the entire state of the game is serverside. This includes almost any popular mmo (WoW, Eve Online), action rpgs (PoE, Archeage), RTSs (every blizzard RTS, Total Annihilation, CoH, AoE series), MOBAs (rip HoN, LoL). People have learned from the past mistakes of allowing the client to hold authoritative gamestate.

-2 points

Given the imagined-reality of god-like powers, it's impossible to model with a straightforward system (and is obviously going to be divisive). Heroclix handles this pretty well with multiple versions of any given character, limiting the characteristics by the system but keeping them comprehensive by providing multiple versions (aspects) to select from.

1 points

Largely memorization of small operations and then patterns. We also pepper code with logging statements, which act as mini-unit-tests. Unit Test is a term that means "check to make sure something happened as I expected".

var i = 10;
var result = i/5;
console.log("result should be 2, it is really: " + result);

Later, you still use those inline logging a little, but you generally write tests that are more complex and automated, which all run every time you compile a project. Eventually you learn that writing tests is it's own coding practice you have to memorize.

Your project becomes more stable as you write more tests. This is both a good thing and a bad thing, as it gets time consuming to make changes, as you also have to change tests but it's worth it. And so on...development is an iterative process that includes a lot of memorization and problem solving which translates into lots and lots of typing code (most of which you eventually delete or throw away).

3 points

I'm not sure why you think this is constructive. For many applications, this isn't true. My DB is memcache. The question is what webserver will give me the most throughput. Luckily, I just throw load at a single server and find out myself, since it's a rather simple test, right? No. The corner cases and issues that can surface under sustained load are the obvious issues he's trying to suss out.

If you don't know the quirks of LS, you're just making noise.

It looks like it's great for static content, which you might as well stick on a CDN anyway. There ya go.

-25 points

Basically, people who hate goto are wrong.

Nobody hates goto and you know better. Repeating juvenile euphemisms is not constructive. Goto is a poor choice for flow control because of the limited utility and necessarily convoluted patterns that emerge from the use of it. There is no question about "right" or "wrong" here, SMH

8 points

So basically all the other languages I researched do not provide arguments within back traces.

Uh, that kind of suggests that providing arguments at all is a mistake

Talk about cargo cult mentality. "I guess it's wrong because everyone else says so". Later there's the "sometimes the stack traces are sent to 3rd parties"! God forbid you're responsible for your own communications to 3rd parties. SMH

I think it's a good idea to redact params, but the quality of the comments is disheartening, as usual.

12 points

It's not the role of an object to validate itself, or to contain it's own validation rules

That sounds religious. In reality, it depends on the composition/purpose of the object.

3 points

The vast majority of "modern" frameworks (especially in PHP) are poorly considered castles (not cathedrals).

They are universally highly opinionated and suffer from premature optimization, because if one framework offers a solution to a problem, then they have to have one too. This leads to overlap and you end up unable to do things without understanding enough of the framework to override/circumvent the opinionated or irrelevant rails to do what you want.

A framework provides a structure and methodology for guiding development in a consistent manner. "Modern" PHP frameworks have built-in assumptions and methodologies that don't make much sense to use. From Laravel's horrific artisan to Symphony's highly [opinionated stances] (https://symfony.com/doc/current/best_practices.html#best-practice-handle-form) on "best practices".

If you feel like you are overwhelmed, try taking a few days and roll your own. It's not hard. You'll find you're happier working on it and able to do the work you want to do. Otherwise, welcome to the brave new world of bloated software.

-1 points

The only thing you can unit test, as a function, is a pure function. This is just the nature of a test, we pin down the inputs to a piece of code and we see what outputs it produces. All of the mocking that you are doing is an attempt to turn an impure function into a pure function. Private variables are often modified as a side effect or contain a dependency with side effects. Mocking private variables (or just spying on them to verify that state is changing as expected) is very common. This extends into all kinds of testing, where you possibly want to limit integration tests to specific dependencies, etc. This principle is also, ostensibly, the reason for rewire.js which reaches into modules (closures) to override behavior.

Reflection, like in Java, is a bad way to go about enabling developers. Just make everything "public" by default, controlling for public integration points until there is something like Python's pattern_ or Go's package-level open access.

2 points

antipatterns

Traits have the best qualities of composition. Inheritance is generally bad, but people are slow to come to grips with that as it's the first kind of composition people learn, sadly.

4 points

Unfortunately, with this kind of 'static constructor'...now you need to know about the static method's purpose AND how it will use the data passed in, to some extent. eg will this method ignore some properties of the DTO, and use defaults...who knows? because there might be another static that you might have to know about to do something different.

Multiple constructors would be preferable, but that's something PHP hasn't adopted yet.

1 points

I have stated a criticism of java annotations, which is being held up as an example of power that can justify php annotations.

There's no problem yet.

has had the same result that Attributes will.

Copy pasting is already available through traits. Adding runtime composition in yet-another-way is either because traits aren't powerful enough or someone wants to have a shortcut around structured programming, which can then be expanded upon. The example doesn't justify creating an orthogonal composition.

attributes can also be declared on methods, functions, parameters, properties and class constants. As such they are more flexible than interfaces.

The problem they have is they think interfaces are too limited. Great. Expand interfaces or traits, you get the same functionality.

3 points

I've seen the power of annotations/attributes

Annotations are the Java solution to needing mixins. Pure inheritance, even with interfaces, is brittle and lacks expressiveness for any non-trivial application. Java picked out a PARC project and everyone nodded their heads because it was backward compatible and it came from PARC; it must be great right?

@Spring is both the proof and the poster child for what is to come. In Java, depending on the libraries you are using, you may be faced with the unenviable position of having to worry about annotations added somewhere in the codebase that has an effect on an application in part or in whole. Who knows? You have to read the whole thing to find out where your exceptions are going...is it captured by some annotation on the stack, or passed by to some class that has a @RestControllerAdvice annotation? Not to mention the effect it has on weakening your testing methodology (in execution time, complexity, and reliability) for testing your actual application. How do you setup for @Component? Have to read that code to understand the implications. Do not put user code generation in the runtime.

Integrating an additional problemspace on complex software is yet another step in the slow decline. Aspects were a cute short-term solution to implement runtime code generation that has now turned into runtime composition (or concatenation) and has had the same result that Attributes will.

14 points

most of the stuff you like are either anti-patterns or bad practices,

People say all kinds of things and cargo culting is a problem across languages. Note languages do just fine with what others call "bad practice" or "anti-patterns" that you think you understand, despite there being nothing demonstrably problematic or practically infeasible.

I said nothing about monkey patching but I assume you're making some sort of reference to mocking closure internals (eg Rewire.js as a module mocker) which I can only assume is from committing to not understand what I was referencing.

I said nothing about not using access modifiers, but that's something you decided you read somewhere. The only reason to not allow circumvention is a lack of commitment to supporting unit testing. There are many examples of languages that do this, other than Python, ofc. eg Go allows for circumvention at the package level. How do you explain that these mechanisms have not resulted in some sort of inherent instability of a language ecosystem? The tradeoff is you get a specific test-only-useful (or more general) dont-use-this syntax for better reliability in software. What's the reasoning for not having a way to break access modifiers at a specific scale?

I'm not even sure where you get "increased verbosity" from, but I fail to understand why you believe some of these things with practical evidence to the contrary.

I mean, really, what "problem" did I bring up that has anything to do with DI?

2 points

I don't prefer Python, but Python gets a couple things right.

The syntactical underscore backdoor through access modifiers, which makes testing possible/easier.

Avoiding the "new" keyword. Again, this improves testability because you can mock new objects without moving them into another function. An object (or any class really) is a fancy closure with a language specific structure. There needs to be more getting away from Objects as special things that require a specific syntax because they get in the way of formalizing how we write code and how we test it.

You also have the option of removal during all kinds of iteration in Python.

There are still some things to learn from Python.

3 points

Yes. I just don't understand the purpose of more than

fn() => { return something; }

Cryptic set of things or shortcuts I could do with a closure cleanly:

'full_definition' => [
    'class' => EngineMarkOne::class,
    '__construct()' => [42], 
    '$propertyName' => 'value',
    'setX()' => [42],
],

'static_call_supported' => [MyFactory::class, 'create'],

'object' => new MyClass(),

eg, can't this just be done with:

'full_definition' => fn() {
    $myEngine = new EngineMarkOne(42);
    $myEngine->propertyName = 'value';
    $myEngine->setX(42);
    return $myEngine;
}
2 points

Keyboard shortcuts

Move and act

jork
Next / previous post or comment
Enteroro
Open the post
f
Open the media viewer
s
Save
h
Hide (the toast has Undo)
Tab
Right after an action: the toast's Undo
x
Collapse the comment
v
Next layout: cards, compact, grid

Go to

/
Search
gthenh
Home
gthena
All
gthens
Subreddits
gthenl
Library
?
This list
Esc
Close a menu or this list

In the viewer

โ†orโ†’
Previous / next file
โ†‘orโ†“
Previous / next post
korj
Previous / next post
Space
Play / pause
m
Mute
z
Zoom
s
Save
o
Open the post (on its own page: back to it)
Esc
Close

Keys do nothing while you type in a box.