860 reputation
39
bio website
location
age 38
visits member for 2 years, 9 months
seen 9 hours ago

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
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).
Dec
9
comment Introducing function waypoints to protect device
If you have some logic that tells you what is dangerous, those checks should be, at the very minimum, inside your erase and you should not rely in anything else. What if the hacker finds a way to alter other parameters while letting using other value (v.g., PC is 0xDEADBEEE but the instruction will delete two words).
Dec
9
comment Designing a scalable schema for college database
modified fields are useless, you only get the info about the last change (you do not even know which change was it). Other than that, I generally agree. It is also worth mentioning that most DBMS allow for partitioning tables (so "old" records go to slower, cheaper storage) for improving scalability.
Dec
4
comment How to handle a memory consuming member variable
If it is immutable, better use the flyweight pattern (a provider for the "real objects", and each real object is wrapped by a lighter one which is the one you manipulte).
Nov
30
comment Is there a name for an internal incorrect behaviour that does not manifest itself as a bug?
I would call it an "internal bug" or even a "masked bug", but that's just my opinion
Nov
23
comment Is it normal for a programmer to not have 100% clarity over their own code at times?
To add to other (insightful) answers in the sense that it smells of over-complicated or poor designed code (do not worry, most of us had to pass that phase): Document. Both by giving proper names to variables/methods/classes/modules, by adding a proper description to each function, and by (when you see no other way around) writting a simple inline comment explaining why and how are you using some complex snippet of code.
Nov
19
comment how can I minimize my ajax calls to the server while creating a dashboard
I agree with the "no improvements" warning. At one in-house app, we pass about 600 records back to the desktop. The transmission of the data, even to a remote site, just takes a couple of seconds, but the browser needs 1+ minute to parse them, update the view, etc.
Nov
19
comment Is software inherently buggy and hence, vulnerable?
AFAIK, Gödel theorems are about systems where you compose all the possible rules/statements (in fact, Wikipedia specifically talks about arithmetic systems, not systems in general). And the result is that you cannot guarante to prove each of the statements as true or false. You could agree that a general programming language would qualify as a Gödel incomplete system, but a concrete program is way more closed and usually predictable. The real issue is that using the tools that calculate formal correction is only done for extreme cases (v.g. power plants) due to the effort they require.
Nov
17
comment Null Object Pattern and Input validation - copy real implementation or silently accept everything?
From a strictly logical POV, you could say that since you have no camera, your camera does not reject the WifiEncriptionType so it should not throw the IllegalArgumentException. So, I do not think not throwing it would be a breach of contract.
Nov
17
comment Control (avoid) changing fields with side-effects
Thanks for the feedback. Still I will let the question remain open for a few days; while I feel my option (number 4) is correct I would expect many people to have had the same issue, and I would like to know if the pattern has been identified / named (principally because there I will be able to study possible issues that I am missing)
Nov
17
comment Control (avoid) changing fields with side-effects
@Neil That is an option (covered in point 2). While it looks like the most "canonical" option, I do not like the extra DB accesses. Another option (which I would prefer) would be having an API update method that allows changing all of the "intrascendent" fields, and specific methods (like setDeceasedDate(employeeId, date) for changing "transcendent" fields. But the only way of translating such an API into ORM/JPA I can think of is my last proposal, and as I said I feel I might be overlooking some other solution
Nov
17
comment Control (avoid) changing fields with side-effects
@Neil, thanks for your help. Using an ORM (JPA), I will usually persist/update/retrieve whole objects/entities; I will not create an SQL query like "UPDATE Employee SET Name=?". Also, entities may be persisted indirectly (by using cascading).
Nov
9
comment The source is the documentation - part 1
I disagree with the example of the filesystem... after all, the definition of the Posix functions provides an standard API, so it is not like the different file systems are providing different functions (apart from the ones they chose to implement specifically9, just different implementations of the same functions
Nov
9
comment The source is the documentation - part 1
@jmoreno they are different approachs. For a filesystem, the specification would be the POSIX functions. You are building a module that must be used by code already existing (in difference with the usual task of building a module that will be used from programs still to be written).
Oct
21
comment A “Composite API” layer
Developers will have to maintain the security of the individual resources in one way, and the security of composed resources in another. How come? When you get a request for a parent, in the parent check the request credentials and, if valid, pass the request along to the children. Each of the children will check the credentials in its own, the same way they would handle an individual request.