-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Extract Viewer Commands to ViewerCommand class #6059
Extract Viewer Commands to ViewerCommand class #6059
Conversation
To allow keyboard commands to use the same command as gestures
Issues
======
+ Solved 2
- Added 3
Complexity decreasing per file
==============================
+ AnkiDroid/src/main/java/com/ichi2/anki/AbstractFlashcardViewer.java -3
See the complete overview on Codacy |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
one tiny question but otherwise LGTM
Why do you want to remove code from abstrractflashcardviewer ? |
Primarily: It's so large that it's become hard to reason about the state of the object. There's a lot of responsibilities which are combined, and some state is implicitly modelled as the state of the UI elements, rather than explicitly. "Single responsibility principle" is the typical term to Google, but everyone has different opinions on what it means. If you want to add new code, then it's still fairly easy, but it increases the class size. If you want to modify existing code, then it takes much longer as you'll struggle to mentally manage the context required to make the change without introducing regressions. Testing also becomes harder for this reason, as it's hard to exhaustively test all code paths. Finally, there's a lot of code in |
This went out with 2.10alpha72 - available as soon as google is done processing it |
Non-functional prep work for #6052
Also removes code from
AbstractFlashCardViewer
, which is a side-goal of mine.Don't mind if this is squashed, commits are small to ensure they're readable in review.
Checklist
if
statements)