it's usable for future proofing I'd argue. like right now those lines are all together but if the code grows the definition and the usage can be hundreds of lines apart. also the variable you can use at multiple points but only have to change it once. I have a project right now where I have to do similar stuff and I have a list of strings defined at the top of the class to check against. It's super important to define it only once or else you'd have to change it everywhere if a change occurs. For instance if customer data changes to be "Y E S" or something else stupid
also this solution enables easier localisation features bc you're checking against variable and not hard coded string
It depends on scope imo. If localisation is a requirement then sure, but if my customer asks for a single language I won't use resources on laying the groundwork for a feature that's not within scope of the project.
yeah i totally agree with you. if it's school work just go with whatever works, you know the scope. If it's a big customer with potential follow-up projects, consider doing a little extra for your happy future. the next guy maintaining your work will thank you :D
30
u/rco8786 Nov 19 '21
What is that curly brace wrapper syntax all about? @{ and @if{
13
u/[deleted] Nov 19 '21
if it works dp not touch it
11
u/overtrick1978 Nov 19 '21
So what?
4
u/MurdoMaclachlan public boolean isInt(int i) { return true; } Nov 19 '21
Image Transcription: Code
I'm a human volunteer content transcriber for Reddit and you could be too! If you'd like more information on what we do and why we do it, click here!