JeremyYao commented on PR #1410: URL: https://github.com/apache/daffodil-vscode/pull/1410#issuecomment-3284921247
> I agree that no comment is necessary. However, you can't always be rigid about these type of best practices. Take one letter variables for example - by following the letter of the law, you wouldn't be able to use them in for loops, which is one of the main places they are used. > > I generally don't like magic numbers/strings, but for something like this, I don't see a problem with it. We're using one of the commonly used default buffer sizes, and we're not in a context where we need to squeeze every ms of performance out that we can. We don't have a strong reason for choosing this specific size - we picked a commonly used default size and it was performant enough for our use case. Because of that (and because it's not user configurable), a magic number is reasonable here. > > On the other hand, having a variable called fourKilobytes and setting it to 4096 is worse than leaving the magic number in. If you have to change the buffer size, now you have to change the variable name too, or else you get a variable called fourKilobytes set to 8192, which defeats the purpose of replacing the magic number. It also doesn't go into the reasons why this number was chosen, which I would argue is necessary if you're going to abstract the value into a variable. Let's gather others' perspectives on this. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@daffodil.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org