Reputation
2,207
Top tag
Next privilege 2,500 Rep.
Create tag synonyms
Badges
1 7 14
Newest
 Informed
Impact
~53k people reached

Oct
13
comment Role vs Permission Based Access Control
Uh? The authentication layer will check that the user is he who claims to be; the layer that checks which functions/data can such an user access is the authorization layer
Sep
19
comment Multi inheritance in Java
From its beginning Java has made illegal multiple inheritance due to the troubles it causes; in fact it is very cleary stated that default methods introduction is only as a "last-measure" to introduce new logic into old API interfaces. Telling anyone "if you want multi-inheritance use default methods" is very bad advice.
Sep
19
comment Multi inheritance in Java
Note that in your example I would change the name of the interfaces to avoid them being negative; for example INoOutputFilter would become InputFilter. Then the NoOutputFilter class would implement only InputFilter
Sep
19
comment Multi inheritance in Java
Just to be clear, when you talk about composition, the "a lot of boilerplate code" are the two lines defining and initializing the inner filters, or there is something else? Because for your problem definition, the standard answer is usually "composition" which is the second solution you describe.
Sep
14
comment OAuthv2 for the JVM
First, your Google API is not an OAUTHv2 library, it is the Google API Client Library for Java that uses OAuthv2 to authenticate (so yes, it connects to the endpoints in the Google servers). Second, searching for Oltu artifacts in maven shows a resource server and an authserver. Third, if you are looking for client libraries, what exactly is your point in expecting them to implement resource/auth servers?
Sep
13
comment Database Structure: A product that will only temporarily be available and then slightly change
It reminds me of the composite pattern: a product that can be made of other products. You have the product "Item A" and the product "Item A offer", which in turns links to "Item A" and "Item B"
Sep
13
comment CRUD API: How do you specify which fields to update?
Why isn't identifier part of the person? For newly created Person instances that still are not persisted, and in the case the identifier is decided as part of the persistence mechanism, just leave it to null. As for the answer, JPA uses a version number; if you read version 23, when you update the item if the version in DB is 24 the write fails.
Sep
1
comment Strategy to avoid running out of memory in memory intensive application
One little help may be WeakReferences; object referenced by those can be freed by the GC. Of course, you should use those only in objects you can rebuild when needed (trading memory for the cost of building the object new when you need it).
Aug
29
comment Is creating a new List to modify a collection in a for each loop a design flaw?
In Java there are Iterator (works as you described) and ListIterator (works as you desire). This would point that in order to provide iterator functionality over a wide range of collections types and implementations, Iterator is extremely restrictive (what happens if you delete a node in a balanced tree? Does next() make sense anymore), with ListIterator being more powerful due to having less use cases.
Aug
29
comment Is creating a new List to modify a collection in a for each loop a design flaw?
@ElDuderino msdn.microsoft.com/en-us/library/dscyy5s0.aspx. Don't miss the You consume an iterator from client code by using a For Each…Next (Visual Basic) or foreach (C#) statement line
Jul
26
comment ASP.NET MVC : How asp.net mvc view engine bind model and render data in html form in browser?
The framework "remembers" (or can "reconstruct") the fact that x.Name ended rendered as an input element whose id and name were "Name". When the form is submitted and the URL has a "Name" parameter, it gets assigned to x.Name. What is difficult with that?
Jul
21
comment Should client side have a log?
Only give users information about the errors/situations they may solve themselves ("your password is wrong", "You are not allowed to perform that operation"). "Connection is lost" is somewhat borderline, depending of which side has the issue. For all of the others, "Internal error" and send the log to support.
Jul
21
comment How to handle mismatched request body and content-type header?
Generic responses (without HTTP status codes) will not be understood by many clients; they will assume their message was ok and just fail to decode your answer. Worse yet, they can just send you a message and just ignore the answer ("Server answers status is 200: Ok, so my message was correctly processed; that is all I need to know")
Jul
12
comment Why can't I refer to an interface inside of generic brackets in a variable declaration?
IIRC the terms you should google are covariance and contravariance. In short words, List<String> is not an instance/subclass of List<Object> because if it were then issues arise from using the generic type instance as parameters or return types.
Jul
12
comment Is there a name for this pattern?
It is not a pattern, it is a consequence of evaluating an assignment expression with the value being assigned (instead of, say, void).
Jun
27
comment Should you write your back-end as an API?
I have had to maintain a project where the logic was put in the UI layer, calling the same shared data structures. I have had to fix one bug thirty times because of that ("if we need to use the same logic again we will copy & paste! no need for an API"). Had been there a logic layer (now there is) it would have been enough with just one fix.
Jun
27
comment Should you write your back-end as an API?
I have had to maintain one system designed with YAGNI in mind; since it used Struts the previous developer put dependencies to Struts in almost all the code (and most of the business logic in Struts dispatcher classes). If you build a system with a good tiered design the API appears almost automatically (as the separation between presentation and business logic), if you don't then shit happens down the road.
Jun
17
comment Client-Side JavaScript Business Logic in .Net Solution Stack
Note that the point is not JS vs .Net but "on our servers" vs "on someone else's hardware". A .Net desktop client would be again the wrong solution, for exactly the same motives.
Jun
16
comment Is the semantic contract of an interface (OOP) more informative than a function signature (FP)?
Without any additional clues... maybe it is why the documentation is part of the contract?
Jun
2
comment Is there a hashCode()-like method that can be used for state checking?
You may implement hashCode so it only depends of the state, it will be still a valid implementation. It might be undesirable to use in maps (apart from being mutable) because of a possible high number of collisions. Or maybe I am missing your point.