engage 2014 - JavaBlast

469 views
320 views

Published on

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
469
On SlideShare
0
From Embeds
0
Number of Embeds
4
Actions
Shares
0
Downloads
9
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

engage 2014 - JavaBlast

  1. 1. JavaBlast engage 2014 René Winkelmeyer midpoints GmbH
  2. 2. René Winkelmeyer Senior Consultant midpoints GmbH http://www.midpoints.de IBM Advanced Business Partner IBM Design Partner Services •  Notes / Domino Consulting •  E-Mail Management •  Mobile Products •  IBM Notes Traveler planning & deployment •  mobile app development •  Domino based iOS Device Management •  Domino based “Dropbox” for Notes and iOS About me
  3. 3. René Winkelmeyer Senior Consultant •  Skype muenzpraeger •  Twitter muenzpraeger •  LinkedIn muenzpraeger •  Slideshare muenzpraeger •  Web http://blog.winkelmeyer.com http://www.midpoints.de •  Mail mail@winkelmeyer.com rene.winkelmeyer@midpoints.de OpenNTF •  File Navigator •  Generic NSF View Widget for IBM Connections About me
  4. 4. 4 What’s this session about? §  This session is about Java and Eclipse. §  The goal is to make your life as an developer easier. §  Most of the content can be applied to Java in Domino and to Domino Designer. §  The views are my own – yours may be different. ;-)
  5. 5. Tip #1: Don’t return NULL values §  Returning NULL from your own methods is a bad behavior. §  Forces people to doublecheck for NULL and values. §  Instead return something „empty“ or your own „NULL“.
  6. 6. Tip #1: Don’t return NULL values
  7. 7. 7 Tip #2: Use the Eclipse Marketplace for IDE enhancements §  Thousands of helpful (and sometimes not helpful) addons are available for Eclipse §  Just go to the Eclipse Marketplace and search for your favorite term
  8. 8. 8 Tip #3: Style your Editor like you want §  People have different opinions on which kind of text display is better (for their eyes) §  Black text on white background §  White text on black background §  Colored text on white background §  Colored text on black background §  xxx text on xxx background
  9. 9. 9 Tip #3: Style your Editor like you want §  The „Eclipse Color Theme“ plug-in comes to your rescue. §  Different color codings (background, text etc.) for different editors within Eclipse
  10. 10. 10 Tip #3: Style your Editor like you want §  Header §  Content
  11. 11. 11 Tip #3: Style your Editor like you want
  12. 12. 12 Tip #4: Easy access to the files of your projects §  „StartExplorer“ give you the capability to access the physical files of your Java project directly from within the IDE.
  13. 13. 13 Tip #4: Easy access to the files of your projects §  Open shell at the file/folder location §  Open Explorer/Finder/Nautilus etc at the file/folder location §  Execute custom commands against the file/folder
  14. 14. 14 Tip #4: Easy access to the files of your projects
  15. 15. 15 Tip #5: Intelligent Code recommendation §  Replace the built-in content assist with „Code Recommenders“ – and learn how others use and built code.
  16. 16. 16 Tip #5: Intelligent Code recommendation §  „Favorites“ at the top of the new content assist show you what others have mostly used.
  17. 17. 17 Tip #5: Intelligent Code recommendation
  18. 18. 18 Tip #5: Intelligent Code recommendation
  19. 19. 19 Tip #6: Use meaningful names in your code §  Use meaningful names – ‘nuff said.
  20. 20. 20 Tip #7: Ease code comment generation §  Option 1: Write /** at the top of a method and press ENTER.
  21. 21. 21 Tip #7: Ease code comment generation §  Option 2: Auto-generate comments for selected elements
  22. 22. 22 Tip #8: Don’t document your code for documentation purposes §  Good documentation describes why the code is doing what is does – not what it‘s doing.
  23. 23. 23 Tip #8: Don’t document your code for documentation purposes §  Good documentation describes why the code is doing what is does – not what it‘s doing.
  24. 24. 24 Tip #9: Code styling – for projects and workspaces §  Having a similar pattern for „how code looks like“ makes it easier to read, understand and maintain. §  That‘s even more essential when working in a team.
  25. 25. 25 Tip #9: Code styling – for projects and workspaces
  26. 26. 26 Tip #9: Code styling – for projects and workspaces
  27. 27. 27 Tip #9: Code styling – for projects and workspaces
  28. 28. 28 Tip #10: Awesome “Reflection”s §  Reflection is the ability to make modifications at runtime by making use of Type Introspections. §  i. e. it allows you to add a JAR at runtime even if it‘s not in the classpath §  „setAccessible“ is for men, not for boys!
  29. 29. 29 Tip #11: Type-safe Enumerations §  Enumerations (or short: enums) are a rock-solid alternative to the commonly used static int or String constants.
  30. 30. 30 Tip #11: Type-safe Enumerations
  31. 31. 31 Tip #11: Type-safe Enumerations
  32. 32. 32 Tip #11: Type-safe Enumerations
  33. 33. 33 Tip #12: Use Buffered streams for I/O operations §  Use Buffered streams for I/O operations whenever possible. §  Unbuffered streams §  Read and write is handled by the OS directly, which may lead to heavy disk usage §  Buffered streams §  Read and write is handled in-memory
  34. 34. 34 Tip #12: Use Buffered streams for I/O operations
  35. 35. 35 Tip #13: Singleton – instance §  Singletons are bad. Some people say. Others really like them. §  The main use case for a Singleton is to have data available across classes. Think „global“.
  36. 36. 36 Tip #13: Singleton – instance §  Instantiated at the first call. Really handy if you run multi-threaded or concurrent access against the same data.
  37. 37. 37 Tip #13: Singleton – instance
  38. 38. 38 Tip #14: The Builder pattern §  A Builder gives you the capability to wrap complex objects into a fluent interface.
  39. 39. 39 Tip #14: The Builder pattern
  40. 40. 40 Tip #15: Serialize and Deserialize §  Serialization allows you to store (serizalizable) Objects in a JVM- independent way. §  It‘s a byte representation of the objects type and the objects data. §  The object needs to implement java.io.Serializable.
  41. 41. 41 Tip #15: Serialize and Deserialize
  42. 42. 42 Tip #15: Serialize and Deserialize
  43. 43. 43 Tip #16: Find Your Bugs §  Employ good coding practises (and find bad ones) using „FindBugs“ from the Eclipse Marketplace.
  44. 44. 44 Tip #16: Find Your Bugs
  45. 45. 45 Tip #16: Find Your Bugs §  You‘ll see the output right within your IDE.
  46. 46. 46 Tip #16: Find Your Bugs §  You‘ll see the output right within your IDE.
  47. 47. 47 Tip #17: Transform to HTML-escaped characters §  Had ever the need to convert (special) characters to HTML encoded strings? §  Several 3rd party libraries (i. e. Apache) are available for that. §  Leverage the built-in capabilities. A „char“ is represented as a number. So it‘s an easy one to encode that one.
  48. 48. 48 Tip #17: Transform to HTML-escaped characters
  49. 49. 49 Tip #18: Pass „unlimited“ objects as method arguments §  Pass „unlimited“ objects as method values just by adding „...“ to the end of the class name.
  50. 50. 50 Tip #19: Accessing localized ressources §  If you localize your applications make your that you can easily access it by placing it in your package.
  51. 51. 51 Tip #20: Edit your properties properly escaped §  Working with localization could be very interesting. Different charsets in different languages. §  Those localized files are normally placed in files like „messages_nl.properties“, „messages_de.properties“ and so on.
  52. 52. 52 Tip #20: Edit your properties properly escaped §  For a proper display they need to be converted to ASCII. §  One easy way is to convert them via the built-in tool „native2ascii“. The binary is located within the /bin folder of your Java distribution.
  53. 53. 53 Tip #20: Edit your properties properly escaped §  An alternative approach is to use the „Properties Editor“ plugin. §  It converts the text to ASCII when you save the file!
  54. 54. 54 Tip #21: Use “finally” for cleaning up §  „finally“ you can clean up. §  Think about closing I/O connections, recycle Domino objects etc.
  55. 55. 55 Tip #21: Use “finally” for cleaning up
  56. 56. 56 Tip #22: Debugging is simple – just do it
  57. 57. 57 Tip #23: Debug Detail formatters give you value insights §  Inspecting current object and variable values while debugging code is one of the big benefits using Eclipse. §  Change your variables and/or issue commands/methods against them. §  It applies also to Domino Java objects!
  58. 58. 58 Tip #23: Debug Detail formatters give you value insights
  59. 59. 59 Tip #23: Debug Detail formatters give you value insights
  60. 60. 60 Tip #24: Recycle, recycle, recycle §  Recycling is important in Domino! §  Recycling is important in Domino! §  Recycling is important in Domino! §  Recycling is important in Domino! §  Recycling is important in Domino! §  Recycling is important in Domino! §  Recycling is important in Domino!
  61. 61. 61 Tip #24: Recycle, recycle, recycle §  Free‘ing the Cpp-Handle is critical, as ressources are limited on the server. §  Free‘ing the parent normally frees the children. §  Keep your house clean, i. e. always recycle EmbeddedObjects.
  62. 62. 62 Tip #24: Recycle, recycle, recycle §  Running a NSD gives you insights of the currently used backend handles. §  If you‘re still on 8.5.2 => Upgrade!
  63. 63. 63 Tip #25: Exceptions are not for control-flow §  Use Exceptions for stuff you can recover and for unexpected conditions.
  64. 64. 64 Tip #25: Exceptions are not for control-flow
  65. 65. 65 Tip #25: Exceptions are not for control-flow
  66. 66. 66 Tip #26: Typed vs. Un-Typed Collections §  Typed collections make your life much more easier. §  You see in the code what type it is. §  No need for casting §  Easier for looping (instead of using an iterator)
  67. 67. 67 Tip #26: Typed vs. Un-Typed Collections
  68. 68. 68 Tip #26: Typed vs. Un-Typed Collections
  69. 69. 69 Tip #27: Don’t concatenate too much §  Even if it‘s convenient – try to avoid „too much“ method concatenation. §  Makes your life a lot easier, especially during development and debugging.
  70. 70. 70 Tip #27: Don’t concatenate too much
  71. 71. 71 Tip #28: Accessible fields §  Fields should always be private except for constants §  Accessible fields cause tight coupling §  They are corruptible §  If a field needs to be accessed => use „Getter“ and „Setter“
  72. 72. 72 Tip #28: Accessible fields
  73. 73. 73 Tip #29: Keep code clean §  Delete not-needed / „out-commented“ code §  Your SCM takes care of the history.
  74. 74. 74 Thank you very much!

×