Sunday, September 17, 2017

Java Application Logging and Masking Sensitive Data in Log4j

Unit Testing Java Applications and Spring MVC Application

SonarQube and Best Practices

Adding PMD tool into Eclipse and Effective Usage

How Selenium tool helps in Software Regression Testing

Understanding Configuration Management

Cluster Configuration for JBoss Servers

Cluster Configuration for Tomcat Server

Micro Services

Make XML based Resftul Webservices into JSON based

How to add XSD validation into Restful WebService

JBoss 6.4 EAP Configuration - an overview

Java Server Faces - An Overview

Importance of Validator Framework in Struts

EJB 3.2 and Latest Upgrades

SQL Injection and ways to avoid it in JDBC and in Hibernate

How to call Stored Procedure from Hibernate

How to add Security to Restful WebServices

Securing SOAP Web Service

CXF WebServices and Client

Effective coding with SOLID principles

Understanding OWASP Secure Code Standards

Java Coding Standards and Best practices and OWASP Secure coding practices

1 Reduce memory usage in loops (for,while) - Avoid String Concatenation, Avoid unnnecessary object creation inside loops, Avoid string object creation inside loops, use literals
2 Consider negative values and zero when you are doing any calculations using integer and float values
3 Need more vigilance when using String concatenation : Check for double quotes and single quotes
4 Avoid Memory and Resource Leakages: Check whether you have closed resources, like, file, socket connections, db transactions etc., in all scenarios successful execution, handled exceptions, unhandled excepption and thread based situations. Always use finally block to handles these.
5 Avoiding code which will lead to Deadlock
6 Avoid usign ThreadLocal as it may consume more memory and lead to resource leakages
7 Reserve Proper memory for Java program. Setup proper minimum memory and maximum memory allocation
8 Handling Data and Time - Create 1 Single Utility class to handle all date and time manipulations. Else it will lead to differences.
9 Check for Null. When ever if you are not sure on any reference, then do null check before processing its values. Handle the anotehr scenario
10 Effective iteration and search in collections, array and strings : Use Java provided methods, collections methods and apache common untils classes to perform effective search,  iteration, conversion, parsings and string parsing, string splits etc.,
11 Effective usage of IO : most of us dint get a chance to use all available classes and methods of IO operations. Choose best effective class and method to perform.
Also need to close all resources once they are done.
12 Handling of String Search. Please use String Regex and Pattern effectively
13 Lines of code per method. Do not write methods with more than 50 lines of code
14 Follow proper design principles like SOLID and Java Design petterns 
15 Naming conventions :
Give simple and self explanatory names to classes and methods
Create a class which is targetted to perofrm only single and simple task.
Split methods into multiple methods to perform single operation
Move all common utility kind of codes to common class and use them. Make them utility classes
Move all magical strings to common class - Constants
Create ENUM instead usign magical strings