- Naming concern: Semantically, how does a
SubmitButton
have aTextField
.Text
makes sense as it could be the name of theSubmitButton
itself. A more ideal name just looking at the class would beForm
having aText
field and anInputField
- No encapsulation:
- All instance variables are public allowing users of object to freely mess with the state, thus putting the object in an erroneous state. Better make them private and expose constructors to initialise.
- Also if possible it is better to make the instance variables final reduce unnecessary state change, unless it is explicitly needed to to make them mutable.
- It is better to make the class final to prevent unnecessary inheritance unless required.
- Null concerns: I'm not sure of the best practice to prevent nullability in C#. One way is to fail fast in the constructor itself:
// Approx Java code public class SubmitButton(Text text, TextField inputField) {
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ItemClickSupport.addTo(recyclerView3).setOnItemLongClickListener(object: ItemClickSupport.OnItemLongClickListener { | |
// Press alt + enter and click implement methods | |
}) |