8,609 reputation
1635
bio website
location
age 32
visits member for 4 years, 1 month
seen 2 days ago
C:\>If you're happy and you know it, syntax error!
Syntax error

C:\>If you're happy and you know it, syntax error!
Syntax error

C:\>If you're happy and you know it, then you really ought to show it.  If you're happy and you know it, syntax error!
Syntax error

Project Euler Status


2d
comment Correct name for expression tree merging
@Giorgio I agree, though I can hardly know what OP has in mind.
2d
comment Correct name for expression tree merging
@Giorgio Perhaps he means that leaves are the operands and non-leaf nodes are operators, so possibly A and B would be the "and" operator while C, D, and E would be representative of boolean values. Just my interpretation.
Dec
17
comment Is it good practice to inherit from generic types?
I agree. Without contributing anything, I'd read "StringList" and think to myself, "What does it really do?"
Dec
17
revised Is it better to use strings or int to reference enums outside the java part of the system?
edited body
Dec
17
comment Is it better to use strings or int to reference enums outside the java part of the system?
@ScottWhitlock That is definitely the better way to go about it in order to avoid such problems. Though supposing you did that, you still see 1, 2, 3, 4 on the database or serialized in some file. Not ideal from a maintenance standpoint any way you slice it.
Dec
16
comment Is it better to use strings or int to reference enums outside the java part of the system?
@Oscar Happy to have helped. Let me know how it goes.
Dec
16
comment Is it better to use strings or int to reference enums outside the java part of the system?
@ScottWhitlock Not if you account for that, though they could decide to rename it entirely. They could accidentally delete the database and delete the project too, but we can't account for every possible incident here.
Dec
16
answered Is it better to use strings or int to reference enums outside the java part of the system?
Dec
16
revised Use of for loop conditional statement unrelated to iterating variable
added 1125 characters in body
Dec
16
answered Use of for loop conditional statement unrelated to iterating variable
Dec
16
comment What are technologies like XML, JSON, and YAML classified under?
I never claimed that it wasn't a language. You said, "A program that describes what computation should be performed and not how to compute it." Unless you want to start calling JSON a program, I am simply pointing out the err in that definition. Perhaps it was wikipedia's definition, that doesn't mean that I will start calling JSON a program. You should correct it here, and ideally on the wiki page as well.
Dec
15
comment How does one enforce the implementation of a static method?
Silly question, but here it goes: Why does it absolutely have to be static? Any static method can be converted into a non-static method, and you'd save yourself so much trouble.
Dec
15
answered (HTML) Form structure storage
Dec
15
comment What are technologies like XML, JSON, and YAML classified under?
HTML and Ant would be good examples of Declarative languages, however YAML and XML aren't specifying what computation should be performed. They just are, so I think it's worth mentioning.
Dec
11
comment Matching algorithms in context of data quality problems
Hmm, that I know of, there is no equivalent for birth dates, though a person is far more likely to be off by a digit (and not a day), so a good starting point is something that checks for the existence of birth dates whose digits are off by one.
Dec
10
comment What is the best way to initialize a child's reference to its parent?
@supercat I disagree with your sentiment that the parent class wouldn't get big and unwieldy, though supposing you somehow managed it, you've only slapped lipstick on a pig. You're forcing a pattern to meet your other requirements, which is a big no-no. At that point, you simply don't apply any pattern at all, or at the very least, don't call it parent-child.
Dec
10
comment What is the best way to initialize a child's reference to its parent?
@supercat Your car analogy is correct up to a certain point. The hubcap on a wheel depends on the wheel, but not the other way around. The gasoline depends on the gasoline tank, but not the other way around. The whole point of a parent-child relationship is to organize the concept of one entity depending on another but not vice versa. Why even attempt parent-child relationship if you intend to implement it badly? I'm not saying such cyclic dependencies between components don't exist, though hopefully you agree that they aren't "parent-child" relationships.
Dec
4
comment Various methods manipulating same member variable versus each takes inputs and provides output
@Ahmad Variables used throughout your class should generally be passed as constructor parameters and saved in your class. Otherwise, the parameters should be specific to the method and "forgotten" by your class when the method is finished if possible.
Dec
3
comment Various methods manipulating same member variable versus each takes inputs and provides output
As most of these things go, the answer is that it depends. It depends on what it must do, if you want a class to hold state, if it is going to be inherited. Thus this question cannot be answered as is.
Dec
2
comment What preconditions should be checked while adding/removing a listener?
As you said, it depends heavily on the context, though in my experience, if null is passed to a "addListener", something went wrong. I'd just assume not ignore such an error and pretend everything is fine. Something a lot worse than this could be at play that may affect other areas of the program. That was what I meant.