Posts

bash

# ----------------------  # Git Aliases  # ---------------------- alias mbootd='mvnDebug exec:java -Dexec.mainClass=infrastructure.Main -Dmode=local' alias mboot='mvn exec:java -Dexec.mainClass=infrastructure.Main -Dmode=local' alias tfmt='terraform fmt -recursive -diff' alias ycheck='yarn check-types && cross-env REACT_APP_SENTRY_RELEASE=$(git rev-parse HEAD) webpack --config webpack.dev.js' alias go-aws-azure-login='~/Desktop/skip/installations/go-aws-azure-login' # Delete all branches except develop/staging/master locally alias gdel='git branch | grep -v "develop" | grep -v "master" | grep -v "staging" | xargs git branch -D'  alias deploy='mvn package -Dmaven.test.skip=true && cp ./target/*.war /c/installation/Tomcat7/webapps' alias mci='mvn clean install'   alias cleantom='rm /c/installation/Tomcat/webapps/*.war' alias j11='export JAVA_HOME=`/usr/libexec/java_ho...

Exposing instance variables using protected access

Exposing instance variables using protected access in a Java class is a design choice that can have implications on the encapsulation, maintainability, and flexibility of your code. While there are scenarios where protected access is appropriate, there are reasons why it's generally discouraged or should be used with caution: Breaks Encapsulation: One of the fundamental principles of object-oriented programming (OOP) is encapsulation, which involves hiding the internal implementation details of a class. Exposing instance variables with protected access effectively breaks encapsulation because subclass-level access allows direct manipulation of those variables. Limited Control: When you expose instance variables as protected, you give subclasses direct access to those variables, which means they can read and modify them without any control or validation. This can lead to unexpected behavior and make it harder to maintain the integrity of the class's internal state. Tight Couplin...

Integration testing

  Integration testing End-to-end testing: This involves testing the entire system from start to finish to ensure that all the microservices are working together as expected. Contract testing: This involves testing the interfaces between microservices to ensure that they are adhering to the agreed upon contracts. Integration testing with mock services: This involves using mock versions of certain microservices in order to test the integration of the other microservices. Component testing: This involves testing the individual microservices in isolation, as well as testing how they integrate with other components of the system. Testing with a staging environment: This involves deploying the microservices to a staging environment and testing them in a production-like setting. Testing with a production environment: This involves deploying the microservices to a production environment and testing them in a live setting. This should only be done if absolutely necessary, as it can be ri...

Git cheat

 # ----------------------  # Git Aliases  # ----------------------  alias deploy='mvn package -Dmaven.test.skip=true && cp ./target/*.war /c/installation/Tomcat7/webapps' alias mci='mvn clean install'   alias cleantom='rm /c/installation/Tomcat/webapps/*.war'  alias gpo='git pull origin'  alias gclone='git clone'  alias ga='git add'  alias gaa='git add .'  alias gaaa='git add --all'  alias gau='git add --update'  alias gf='git fetch'  alias gb='git branch'  alias gbd='git branch --delete '  alias gc='git commit'  alias gca='git commit --amend'  alias gcm='git commit --message'  alias pgacm='git add . && git commit -m'  alias gacm='git add . && git commit -m'  alias gcf='git commit --fixup'  alias gp='git push'  alias gpf='git push --force'  alias gps='git push --set-upstream origin'  alias gco=...

aggregation vs composition

Image
Aggregation (collection) differs from ordinary composition in that it does not imply ownership. In composition, when the owning object is destroyed, so are the contained objects. In aggregation, this is not necessarily true Composition (mixture) is a way to combine simple objects or data types into more complex ones. Compositions are a critical building block of many basic data structures Both denotes relationship between object and only differ in their strength. UML notations for different kind of dependency between two classes Composition : Since Engine is part-of Car, relationship between them is Composition. Here is how they are implemented between Java classes.   public class Car { //final will make sure engine is initialized private final Engine engine; public Car(){ engine = new Engine(); } } class Engine { private String type; } Aggregation  : Since Organization has Person as employees, relationship between them is Aggregation. Here is ...