Item 15: Minimize the accessibility of classes and members

Encapsulation A well-designed component hides all its implementation details, cleanly separating its API from its implementation. Components then communicate only through their APIs and are oblivious to each others’ inner workings. This concept, known as information hiding or encapsulation, is a fundamental tenet of software design. The advantages of encapsulation are as follows: Speeds up

Read More

Spring: Big Picture

What is Spring? Spring makes it easy to create Java enterprise applications.It is a complimentary to Java EE. Spring is open source. It has a large and active community. Spring 5.0 requires JDK 8+ and provides out-of-the-box support for JDK 9. Fundation: Spring Framework The Spring Framework is an application framework and inversion of control container for the Java

Read More

Terraform: Import AWS resources

Problem: Resource already exists If there are some AWS resources that are not exist in terraform scripts and you run terraform apply, you might get “XXXX already exists” errors. I listed some of them: BucketAlreadyExists: The requested bucket name is not available EntityAlreadyExists: A policy called dummy-policy-name already exists. Duplicate names are not allowed ResourceInUseException: Table already exists: dummy-table-name

Read More

Jenkinsfile: Publish Docker Image to Amazon ECR

Problem You pushed a docker image to AWS ECR and get denied: requested access to the resource is denied error. stage(‘Publish Docker Image to AWS’){ steps { script { //build image commit_id = readFile(‘commit_id’).trim() def image = docker.build(“$ECR_REPO_NAME:$commit_id”) //push image docker.withRegistry( “https://$ECR_REGISTRY”, ECR_CRED) { echo ‘ Pushing Latest docker image’ image.push() } } } }

Read More

Useful commands for SSL certificates

Generate self signed certificate and export to truststore 1. Generate a certificate using keygen command in windows keytool -genkey -alias myAlias -keyalg RSA -sigalg SHA256withRSA -keystore keystore.jks -validity 10950 2. Self certify the csertificate keytool -selfcert -alias mycert-20161109 -keystore keystore.jks -validity 3950 3. Export certificate to folder keytool -export -alias myAlias -keystore keystore.jks -rfc -file

Read More