mapbox/vtquery

Some code comments

Closed this issue · 3 comments

joto commented

I am just looking at the code with focus on the use of vtzero. Here are some things:

Thanks @joto! Sorry I totally missed this. Mind tagging @mapsam next time? I'll respond to your comments below from the perspective of #42 landing soon.

all comments about geometry_processors.cpp

src/geometry_processors.cpp has been removed in place of vector-tile's 2.x branch - so these should be cleared up.

Don't write comments that don't tell the reader anything more than the code already does

Regarding some comments be unnecessary, I hear you. I've been learning a lot with this library, and have been pairing with @flippmoke and writing notes as code comments. They are helpful to me! I'll remove them before a release, though. Regarding the rest of your comments on the code comments, it's safe to assume they'll be removed. They are very much for me, not intended for a release or anyone else.

https://github.com/mapbox/vtquery/blob/master/src/vtquery.cpp#L134 creates an unnecessary std::string. Something like this should work: { const auto svalue = value.string_value(); return Nan::Newv8::String(svalue.data(), svalue.size()).ToLocalChecked();

We now have a property_value_visitor and this is no longer the case, unless vector-tile does this internally. https://github.com/mapbox/vtquery/blob/vector-tile-2x/src/vtquery.cpp#L131-L158

The execute() function is too long

👍 I'll work on breaking things out. Introducing vector-tile slimmed it down a bit, but we can do better.

Consider making https://github.com/mapbox/vtquery/blob/master/src/vtquery.cpp#L31 a std::vectorvtzero::property. It is unclear what https://github.com/mapbox/vtquery/blob/master/src/vtquery.cpp#L262-L268 is actually bying us. There are all these conversions tostd::string` why?

Use the type defined in https://github.com/mapbox/vtquery/blob/master/src/vtquery.cpp#L31 in https://github.com/mapbox/vtquery/blob/master/src/vtquery.cpp#L35 and https://github.com/mapbox/vtquery/blob/master/src/vtquery.cpp#L55 .

This is now a mapbox::feature::properties_map.

Consider making the code more object oriented and turn them into real classes.

I like this a lot, will work on it!


My todos

@joto a majority of these have been updated and are now in master. I'm going to refrain from turning the structs into classes for now, since we are planning on breaking things out into more modules over at #14 (prior art mapbox/vtvalidate#14)

Last up is to clean the code comments!

Comments cleaned up in #60