Tag Info

New answers tagged


Right-biased Either. It can't be ignored, it must be handled, it's completely transparent. And IF you use the correct left handed error type it conveys all the same information as a java exception. Downside? Code with proper error handling looks disgusting (true of all mechanisms).


You haven't explained what is the purpose of the short representation of text, so one can only stipulate. I assume you need it to be able to distinguish different pieces of text while not having to do a full comparison. If you need only a hint and accept that two different pieces of text may sometimes result in the same short representation, use hashes. ...


expose the existing complex data model without introducing DTO classes One major flaw of this approach is that of coupling data access layer with API. It can go very bad very quickly if those models are used elsewhere except API. I currently work on a project where both web interface and JSON API (kind of REST, but not quite) use the same Hibernate ...


You're constructing dates based on midnight local time. During daylight savings time, which UTC does not follow, midnight local time is the same as 11 p.m. the day before UTC time, if your local time zone is set to London\Western Europe time.


there are various ways: rewrite the recursion into an iterative version and you don't have to worry about recursion depth only the stack depth if the iterative version requires one. Use an outside variable of some kind (static variable, field member,...) to track the recursion depth. This has the downside that it takes up some bytes just for this method ...


Yes, there is another way of limiting recursion depth, but I would not encourage it. In general, we can say that you are currently using a data-driven approach. public void myMethod(File arg, int accumulator) { where the accumulator counts the recursion call depth. The other way is to enumerate the calls. Said another way, hard-code the calls: private ...

Top 50 recent answers are included