loading...

re: Learn and use Composition in JavaScript and TypeScript VIEW POST

FULL DISCUSSION
 

This looks like it has issues compared to the composition I'm used to.

These are not real examples. A real composition each piece being composited will have local state and that local state will be per instance. In other words, I need a steer the has a this.direction and I need a run that also has a this.direction and those should not be the same direction because there can be 1000s of things to composite and there would be no easy way for programmers to know they're all using direction in the same ways.

 

Well, you've just dissed Martin Fowler's definition of "code smell".

"code smell" != "certainly bad code"

 

By any definition of code smell, having to look at the internals of every function you composite to make sure it's not going to conflict with any other function is the very definition of stinky code. Gees

 

IMHO, 1000s of things to compose is a code smell.

 

Well you just dissed every Unity game that's shipped and all Unity devs so I guess it's you against them. Every Unity game is 1000s of things to compose.

I wonder if this is a typical thing in games particularly. Have you seen this kind of composition elsewhere? I'd appreciate any code samples that show the kind of composition you describe.

Some comments have been hidden by the post's author - find out more

Code of Conduct Report abuse