Skip to content
This repository has been archived by the owner on Oct 10, 2018. It is now read-only.

Determine Design Pattern #14

Closed
ThierryA opened this issue Jan 9, 2018 · 5 comments
Closed

Determine Design Pattern #14

ThierryA opened this issue Jan 9, 2018 · 5 comments
Labels
Projects
Milestone

Comments

@ThierryA
Copy link
Contributor

ThierryA commented Jan 9, 2018

I would suggest to agree on a Design Pattern (ex. MVC, Simple Factory ...) which should be followed throughout the code base.

@ThierryA ThierryA added this to the v0.1 milestone Jan 9, 2018
@westonruter
Copy link
Contributor

Since this is a theme, would this be as relevant? I should think the theme would have minimal logic. I think it should look a lot like any PHP logic that is found in _s or any of the core themes. Namely: prefixed global functions.

@ThierryA
Copy link
Contributor Author

ThierryA commented Jan 10, 2018

Correct, there will things like theme support, potentially reusable template tags, potentially customizer settings.

If we decide to go for simple hook -> callback, we can agree to adopt an FP pattern like Underscores does (one of my favorite when done right) rather than an OO Pattern. Underscores doesn't have tests though and anything which contain logic should have tests for it.

Namely: prefixed global functions.

That triggered my attention, we are going to use namespaces right? If yes, then no need to prefix functions.

@westonruter
Copy link
Contributor

I don't think we should use namespaces for this, necessarily. The goal here is to provide an example theme that will get users up to speed with building an AMP-supporting theme as seamlessly as possible. Using namespaces and OOP and anything else that isn't found in _s could be a barrier to that. So yeah, just prefixed global functions is the normal way to develop a theme that developers are familiar with. We're not trying to create a theme that showcases best practices for modern PHP development. I'm trying to get confirmation, but PHP 5.2 may be required for WordPress.org theme directory as well.

@ThierryA
Copy link
Contributor Author

Roger that.

@ThierryA
Copy link
Contributor Author

Interesting progress on the Servehappy project which is related to this discussion.

@ThierryA ThierryA added this to Ready for Merging in v0.1 Mar 8, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
v0.1
Ready for Merging
Development

No branches or pull requests

2 participants