Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
PG Lewis
@pglewis
when it's dynamic, my IDE is more likely to miss it, so I shy away from that a lot
but it's really a minor point, just letting you know why I didn't do the call_user_func approach myself
Justin Sternberg
@jtsternberg
So the trade-off is that the code is more readable but less readable by humans
(ish)
ugh, didn't finish my thought
PG Lewis
@pglewis
the getters and setters litter things up a bit, that's my least favorite part
Justin Sternberg
@jtsternberg
So the trade-off is that the code is more readable to IDEs but less readable by humans
PG Lewis
@pglewis
phpStorm has convinced me somewhat that if my IDE reads it better, so do I lol
Justin Sternberg
@jtsternberg
yah, haven't dove into phpStorm yet
PG Lewis
@pglewis
like I said, the getter/setter litter is probably the biggest downside I see
but without having to actually write them all, how much do they get in my way?
just doesn't appeal to the "less code, always less code" training in me
Justin Sternberg
@jtsternberg
nor me :)
PG Lewis
@pglewis
but I have found as a pattern, they tend to be pretty maintainable and they do free you up from letting people get to deep in your implementation
Justin Sternberg
@jtsternberg
I'd also like to hear your reasoning for having them all be individual properties instead of using the array thing.
PG Lewis
@pglewis
and that's what I'm trying to address for starters, because the back compat part is the hardest part
I have grown a hate for literal strings in my code
can't auto-complete
global search for 'type' is a nightmare
whereas a getter, get_type() on an object, one click and I'm in the method
Justin Sternberg
@jtsternberg
Ok, so IDE chaining stuff
PG Lewis
@pglewis
arrays get messy debugging too
I really couldn't have done the nested fields at this point trying to maintain field arrays and field object arrays at the same time
and I'm not sure what the separate meta_box array was bringing to the table
Justin Sternberg
@jtsternberg
yah, def. was due for some refactoring, and I'm super glad to be rid of the field arrays/objects stuff
PG Lewis
@pglewis
those properties are properties of the metabox object... that's what object props are for the way I see it
Justin Sternberg
@jtsternberg
yah, that's a fair statement
PG Lewis
@pglewis
simplifies the data structure a lot when debugging, that screen-shot from a few days ago shows that
cmb2-nested-data.png
all your metabox properties are right there, not nested in an extra layer inside the metabox array
Justin Sternberg
@jtsternberg
yah
PG Lewis
@pglewis
but I'm not a hard-ass on code style, I've learned over the years to work in a when in Rome approach
Justin Sternberg
@jtsternberg
This has been my baby for a long time, so I'm sure you understand the questioning. :D
PG Lewis
@pglewis
I'm totally open to that, I'm never sold on what I'm doing, myself
Justin Sternberg
@jtsternberg
I just want to be convinced that if it's not how I would do it, that it's actually better overall
PG Lewis
@pglewis
this is to say: you are a developer
Justin Sternberg
@jtsternberg
Not because I think my way is the best, but you only know what you know :D
PG Lewis
@pglewis
totally on the same page
I'm glad to have it poked at for weaknesses
we both have to live with any major restructuring if it makes it out into the wild
Justin Sternberg
@jtsternberg
certainly. I'm super-glad you're on board, and really appreciate your (and others') work on it
PG Lewis
@pglewis
one of the things about code approaches that aid the IDE, is those same patterns also aid new coders
string constants as array keys give you no insights as to what other keys may be available
but I can look at a group of getters and setters for a class and get a lay of the land for how the interface is supposed to work
things that rely on dynamic bits mean I have to understand run-time context to understand that line
explicit method calls I can see what's happening at a glance and know whether or not it pertains to what I'm looking for / doing
Justin Sternberg
@jtsternberg
yah, for sure
PG Lewis
@pglewis
I'm still not sold 100% on the exact inheritance we're doing
where field group is extended by the metabox and field objects
in one sense it's logical: both of those can be a collection of fields