Crossover for Work interview question

What is coding best practices

Interview Answer

Anonymous

11 Apr 2019

-In Java Always use Concern design pattern like for creating connection use Double locking Singleton which enhances the performance & does not let Memory leak to happen. -Go for Lazy initialization variable rather than eager initialization -Always check the Thread and Heap stack using Jvisual Vmon ur development tool which prevent you to have 'Internal-outof-memory-leak' on Production -If you are using using Thread always go for Thread Fork and join which enhances the performance,since it work on 'stealing algorithm' & tasks r converted into subtask and then subtasks r converted into small task & once its completion all threads output are joined Try to avoid Threads synchronization on method label or object label..Always go for Threadpool. -Once coding is done always Use SonarQueue or PMD to check the bugs & enhances its code quality -Always chose the Data Structure which is the most suited one as per client requirements & which takes less time & space complexity -Always throws & catch the exception with providing the error details information. ie, ex.getmessage('IOEXCEPTION') -Always use the dynamic way of coding..never do the static way of coding.So at later stage u can change ur code as per needs. -While doing operation on String always check its contents before doing any modification/operation on it..Else it will throw NPE at runtime For checking the contents of the object u can use ternary operator,eqals methods