-
Notifications
You must be signed in to change notification settings - Fork 710
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Code review #52
Comments
This is by far the most insightful code review I've ever received. Thanks a lot, really! I'll address those points when I can, most likely tomorrow. Update: had to do a release finally, incorporated some of those changes before that. Will address all of them when I have the time. Thanks again! |
🎉 let me know if there's anything that's not clear. |
I'll ask if something comes up! Can I tag you as a reviewer on the upcoming Pull Requests that will address this feedback? Meaning, do you have time / interest in reviewing the changes? :) |
Sure, go for it 👍 |
Thanks for sharing your code ! Amazing project, really ! You should take a look at https://flutter.io/cookbook/networking/background-parsing/, it could be interesting to implement it. |
@anasbud Thanks, glad you like it! I'll create an issue ticket about parsing in a separate Isolate, and see if it makes sense here. The last time I tried it, which was in January, it seemed that at least parsing JSON was fast enough. IIRC, the overhead of switching from main to background Isolate took longer than parsing the JSON, and there wasn't any UI thread stutter to begin with. Might be that some small optimizations could add up and in this project, it would actually make a lot of sense, but you never know until you investigate. :) |
Agreed. Amazing code review, and really great work! I generally concur with what's been said, and would suggest only minor changes. Adding further comments:
|
Thanks Brian! I'll address your feedback too when I can :) |
Wow nice code review indeed. |
This is the best format I could think of, to easily get embedded code snippets and links, and some notion of "actions".
Please note that my experience with mobile development only amounts to 1 React Native app, 1 iOS App, 0.1 Android app – and I did a bit of Dart once. I might be criticising things that are well-established conventions in the mobile / Dart world 🙂. I also nitpicked a lot.
General comments
==
operator orhashCode
), but worth stating anyway.map
overforEach
+ mutating an array). There isn't that much complicated logic in the app right now that it would make a big difference, but it would definitely help with readability.Things that are missing
I'm not sure they really are missing 😄 I'm just surprised not to see them:
Make
, or apackage.json
with yarn/npm in JS-land)I imagine these might come for free with the SDK though.
In no particular order, except for this first section,
File structure & naming
I see the
test
folder has the same structure aslib
, and test files are suffixed with_test
. Wouldn't this be easier to maintain if tests were located next to the file under test withinlib
? (I imagine there's some convention to follow here – personally I like that approach because it makes it much easier to see what has and doesn't have tests). You also might not have to do things likeFor more, see test/event_name_cleaner_test.dart.
if the test file was right there.Same for the test data inside
test_assets
at the moment. It would make it much easier to understand the XML parsing code in saymodels/event
if the XML stub was right next to it.The test data (https://github.com/roughike/inKino/tree/v1.0.0/test_assets) uses the
assets
terminology, but those files technically aren't bundled with the app – should usestub
instead?I'm not sure what to think of the terminology of having
networking
andmodel
underdata
. If the API you were talking to was anything that's not understood as a data source, it would still fall undernetworking
(eg. use the same networking utils) but wouldn't necessarily bedata
. Alsomodel
feels important enough that it should be top-level – and againmodels
are more than just data (business logic)Finally, have you considered organizing the app code by feature/domain (eg
events
,showtimes
, etc) rather than by file type / function (eg.redux
,models
)? It is sort of done already for Redux and the UI (which naturally work well by domain), so would be worth considering doing the same for the whole app IMHO.Tests
inKino/test/data/event_test.dart
Lines 15 to 17 in ead83ac
inKino/test/redux/show/show_middleware_test.dart
Line 32 in ead83ac
sut
– system under test?. Not the clearest variable name IMHO.middleware
?Utils
inKino/lib/utils/event_name_cleaner.dart
Lines 10 to 11 in d885528
Data
inKino/lib/data/models/event.dart
Lines 95 to 98 in d885528
inKino/lib/data/models/show.dart
Lines 32 to 36 in d885528
map
instead of aforEach
. (same comment for other models potentially)inKino/lib/data/models/theater.dart
Lines 8 to 11 in d885528
Networking
inKino/lib/data/networking/tmdb_api.dart
Lines 7 to 13 in d885528
tmdb_config.dart.sample
file with its content as what the README shows, and acp
command in the README.UI
inKino/lib/ui/common/info_message_view.dart
Lines 15 to 17 in d885528
inKino/lib/ui/theater_list/theater_list_view_model.dart
Lines 7 to 9 in d885528
inKino/lib/ui/showtimes/showtime_list.dart
Lines 19 to 21 in d885528
inKino/lib/ui/events/event_grid_item.dart
Lines 37 to 41 in d885528
inKino/lib/ui/events/event_poster.dart
Lines 38 to 45 in d885528
inKino/lib/ui/event_details/event_backdrop_photo.dart
Lines 39 to 48 in a54af3d
inKino/lib/ui/events/event_poster.dart
Lines 86 to 88 in d885528
example.com
, but I'm not entirely sure because I don't know how the placeholder works. Either way this seems like a bad idea – is there a better fallback value?Redux
_reducer
and_state
(and potentially_selectors
) to be co-located in the same file by default. All of this code is very tightly coupled, and is harder to follow in separate files (note: this might be true only in JS, maybe the IDE features for a language like Dart are good enough that it's less of an issue). That said, I know this isn't a very popular opinion even in JS land, and it only works if all those three things are relatively small, so take this with a grain of salt.inKino/lib/redux/app/app_middleware.dart
Lines 32 to 33 in d885528
inKino/lib/redux/store.dart
Lines 20 to 22 in d885528
app
to be the one combining all of the others.inKino/lib/redux/event/event_selectors.dart
Lines 21 to 24 in d885528
LinkedSet
type in Dart?Did I mention the code actually is very readable?
The text was updated successfully, but these errors were encountered: