aubreypwd / wpkickstart

A great way to kickstart a new WordPress plugin or project.
9 stars 0 forks source link

Separate components from service/features #13

Closed aubreypwd closed 5 years ago

aubreypwd commented 5 years ago

The way you are supposed to build features/components out is that each component should work somewhat independent of one another. Pulling in another component into another creates a dependencies between the two.

So the way I've been doing it is that there is always a conductor of sorts that connects all the components together and is usually the base feature class that does it, and this is usually what builds out the main feature of the component....

E.g. in a component called example it's class-example.php that does the conducting and uses the various other components creating a dependency with most other components.

All this said, I'd like a way to identify it as so somehow. Idea(s):

The attachment would look like:

new Conductor()

This doesn't make sense actually because you could have many conductors, maybe we do:

I LIKE THIS!

Will have impact on #7

aubreypwd commented 5 years ago

Per a call with Eric, this structure may work with more modern PHP frameworks:

Eric's point is that service in the PHP community and components also works for the same thing. My pushback was that a "component" should have one class, but the way I'm doing it you could use multiple classes, so we went with component.

Ping #7 and #10

aubreypwd commented 5 years ago

Some notes after talking to Jeremy:

aubreypwd commented 5 years ago

So what you end up with is:

Note some interesting changes w/ Namespace thinking: