Sunday 18 August 2013

notes about Generics

If I find something worth to mention and memorize about generics, I'll post it here.

Stuff like:
  • List<String> is (captureable by) a List<?>
  • List<List<String>> is NOT (captureable by) a List<List<?>>
  • List<List<String>> IS (captureable by) a List<? extends List<?>>
  • http://stackoverflow.com/a/3547372/575659

    Monday 17 June 2013

    Eclipse loves you, but sometimes it's not easy love...

    There are couple of things that are annoying in Eclipse, but overall it's great tool (and for JavaSE I prefer it even over IntelliJ), so it just needs to be fine tuned to be as awesome as Barney.


    Firstly:
    http://eclipse.dzone.com/articles/quickly-declare-and-initialise - I personally love templates, and I started to love this one just few seconds ago - removing one of the grates pain in the ass: 
    (List<Sth> sths= new ArrayList<Sth>();) of my daily work is the main reason for writing this entry.

    Secondly - decrease autocomplete delay:

    Making autocomplete really work (the way it should, IMO)

    This is also worth to mention (but I stayed with default behavior here):


    PS: http://www.yourkit.com/ <- this is damn awesome profiler (WAY better than JvisualVM, even with some plugins), too bad it's so costly and trial is only 15 days long. Anyway, that tool is surely WORTH being tested - just take a look here: http://www.yourkit.com/features/index.jsp#objects_view It saved my ass last week.

    Monday 13 May 2013

    Java memory 'n stuff

    I have found not bad presentation about memory complexity in Java. Clean code still should be a priority, but it's good to know the results of taken implementation decisions.

    http://www.cs.virginia.edu/kim/publicity/pldi09tutorials/memory-efficient-java-tutorial.pdf


    Saturday 2 February 2013

    Java References vs OutOfMemoryError



    3
    2
    1

    Go go go, read it! ;)


    I have found this article while searching something exactly like it on StackOverflow: SoftReferences vs Weakreferences / OutOfMemoryError so I'm just (re)sharing it.



    All my interest about java references' is thanks to Marek Defeciński and his todays speech about them   (you can easy find him @ web - he's well known megrer on GitHub* ;) ) 










    (* - Jacek Laskowski today talked about GitHub and it's social aspect that motivates people to constant growing their skills - great job!)

    Tuesday 22 January 2013

    Comapring floating-points

    Seems straight-forward... "Use delta!"


    But today I tried explain it to my fiend, and... it wasn't that easy for me. So as title of my blog says "if you can't explain it simply you don't understand it well enough" - it was time to use google :)


    And here it comes: http://randomascii.wordpress.com/2012/06/26/doubles-are-not-floats-so-dont-compare-them/ - I really recommend reading it, even as a Senior Developer you can be surprised by some things (I was).

    Some sample to encourage you - yes, it's worth your damn precious time:

       float x = 1.1;
       if (x != 1.1)
          printf(“OMG! Floats suck!\n”);
    


    On a fairly regular basis somebody will write code like this and then be shocked that the message is printed. Then somebody inevitably points them to my article and tells them to use an epsilon, and whenever that happens another angel loses their wings.

    As mentioned in above article choosing the right epsilon the key. Here is nicely explained how to how to make  that choice.

    And lastly, link provided by Tomek - a lot of reading ;)