957 reputation
59
bio website
location
age 38
visits member for 3 years
seen 8 hours ago

Apr
29
comment Is it okay to have objects that cast themselves, even if it pollutes the API of their subclasses?
Additionally, the example is flawed. There is a Member interface, but it only serves to check the access qualifiers. Typically, you get a list of methods or properties and use that directly (without mixing them, so no List<Member> appears), so you do not need to cast. Note that Class does not provide a getMembers() method. Of course, a clueless programmer might create the List<Member>, but that would make as little sense as making it a List<Object> and adding some Integer or String to it.
Apr
25
awarded  Yearling
Apr
14
awarded  Pundit
Apr
8
comment Recursively parse without resorting to ugly design patterns
You do not need all of the theory behind it. Just the rules to define a language that is a CFG. And now, just to adjust my previous example to your actual proposal, CrotchCode -> int CrochetCode [repeat] | < CrochetCode [reverse]| {CrochetCode} [group]| CrochetCode CrochetCode [list of commands]| Stitch Symbol | [empty set]
Apr
8
comment Recursively parse without resorting to ugly design patterns
Something like CrochetCode -> repeat {CrochetCode} | reverse {CrochetCode} | StitchSymbol | [empty set]
Apr
8
comment Recursively parse without resorting to ugly design patterns
At the risk of sounding too academical, I think you should go and try to learn the basics of parsers and compilers (namely, regular expressions and context free grammars) so at least you can define your language as a Regex/CFG. Once that is done, 90% of the work is finished, since there are lots of tools and techniques to create parsers from Regex/CFG.
Mar
31
answered Avoid opt(options) in javascript
Mar
10
comment What is the origin of the phrase “extirpated as a potential munition”
@esoterik that should be an answer (although maybe the question itself could be off-topic).
Feb
24
comment Is it reasonable to assume that any physical quantity can be represented by a 64-bit integer without overflow or underflow?
But you can assign a minimum physical value (IIRC, for mass it was the mass equivalent to 1 electron-volt). For example, you can measure the universe length using Planck length units with (IIRC) 200 digits. You can mentally talk about 1/10 of a Planck length, but physically it has no sense.
Feb
15
comment Testing process on life critical systems
Nothing to worry about, we have it covered: dilbert.com/strip/1996-02-01 and dilbert.com/strip/1996-01-31
Feb
6
accepted Open closed principle vs abstraction leaking (Java enums)
Feb
6
asked Open closed principle vs abstraction leaking (Java enums)
Jan
25
comment Is there an established pattern for associating a database entry with a Java class that executes on that data?
If you do not have state, it seems an example of the strategy pattern. You could still use JPA for that, but using enum. That enum would be a property of the actual "entity" (which would be the nodes or leafs of the tree).
Jan
25
comment Is there an established pattern for associating a database entry with a Java class that executes on that data?
In the discriminant column there is a value that allows JPA identify the specific subclass. For MyClass, you may define it as "X1", for MySubclass, "X2"... The value in the database would tell JPA if, when retrieving the data, it needs to new MyClass or new MySubclass. In the more extreme situation, you could use the entire name of the class as discriminant and end with the same table you would get with your first proposal (but of course, shorter codes may be quicker/more readable).
Jan
25
revised Is there an established pattern for associating a database entry with a Java class that executes on that data?
added 478 characters in body
Jan
25
answered Is there an established pattern for associating a database entry with a Java class that executes on that data?
Jan
6
comment java add new modules to an existing app
Additionally, has already HR its own IS. If they are used to managing one, presenting the data from the original app as part of their IS would be better than forcing them to use a different IS for that purpose.
Jan
6
comment java add new modules to an existing app
Note that if the "shared database" concept brings the problem of will break the cache layer that is used by the main app, most probably a separate database will have the same issue.
Dec
12
comment Why use arg type `class Object` instead of `Comparable[]`?
More than a "copy", you just assign the references to the new array. Also, those "type-lossing" methods usually come from versions prior to java 5 (which introduced generics)
Dec
12
comment Why use arg type `class Object` instead of `Comparable[]`?
You can use names.toArray(new String[names.size()]) or even names.toArray(new String[0]) to get directly an String[] (checked at compile time).