Advertisement
Guest User

Untitled

a guest
Nov 2nd, 2015
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.11 KB | None | 0 0
  1. Re-inventing the wheel can be better. Take this for example: I need a thread-safe, linked, hash table. Java does not supply one, but I can create one by using Collections.synchronizedMap(). In terms of thread safety, the returned map is very good. But the map doesn't offer good performance in a medium-high concurrent environment. I write a new class and replace the old map. The new class only differs from the old because it is completely atomic. Both do their job well, acting as thread-safe maps, but one does its job better.
  2.  
  3. I'd like to end this by saying yes, you are correct on a level - if Java had supplied an atomic, linked, hash table I would use it instead of creating my own implementation. I'd just like to point out that even if something does a job that it is needed for, it may still be valid for a rewrite (maybe an API has all of these fancy features I don't want and I do not want to distribute a 12MB library when I'm only using 3MB of it, or maybe the API costs money and I can't afford it, or it has a license which is not compatible with my project's license, or if the API is no longer being maintained, etc).
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement